Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(166)

Side by Side Diff: chrome/browser/history/history_browsertest.cc

Issue 10144015: Convert session history ui test to a browser test, renabling all the disabled tests and got rid of … (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: readd history test (this isn't session history) Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/session_history_uitest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <vector> 5 #include <vector>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
11 #include "chrome/browser/history/history.h" 11 #include "chrome/browser/history/history.h"
12 #include "chrome/browser/prefs/pref_service.h" 12 #include "chrome/browser/prefs/pref_service.h"
13 #include "chrome/browser/profiles/profile.h" 13 #include "chrome/browser/profiles/profile.h"
14 #include "chrome/browser/ui/browser.h" 14 #include "chrome/browser/ui/browser.h"
15 #include "chrome/common/chrome_switches.h" 15 #include "chrome/common/chrome_switches.h"
16 #include "chrome/common/url_constants.h"
16 #include "chrome/common/pref_names.h" 17 #include "chrome/common/pref_names.h"
17 #include "chrome/test/base/in_process_browser_test.h" 18 #include "chrome/test/base/in_process_browser_test.h"
18 #include "chrome/test/base/ui_test_utils.h" 19 #include "chrome/test/base/ui_test_utils.h"
20 #include "content/public/browser/web_contents.h"
19 #include "content/test/test_browser_thread.h" 21 #include "content/test/test_browser_thread.h"
20 #include "googleurl/src/gurl.h" 22 #include "googleurl/src/gurl.h"
21 23
22 using content::BrowserThread; 24 using content::BrowserThread;
23 25
24 namespace { 26 namespace {
25 27
26 // Note: WaitableEvent is not used for synchronization between the main thread 28 // Note: WaitableEvent is not used for synchronization between the main thread
27 // and history backend thread because the history subsystem posts tasks back 29 // and history backend thread because the history subsystem posts tasks back
28 // to the main thread. Had we tried to Signal an event in such a task 30 // to the main thread. Had we tried to Signal an event in such a task
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 ConsiderSlowRedirectAsUserInitiated) { 279 ConsiderSlowRedirectAsUserInitiated) {
278 // Test the history length for the following page transition. 280 // Test the history length for the following page transition.
279 // 281 //
280 // -open-> Page 21 -redirect-> Page 22. 282 // -open-> Page 21 -redirect-> Page 22.
281 // 283 //
282 // If redirect occurs more than 5 seconds later after the page is loaded, 284 // If redirect occurs more than 5 seconds later after the page is loaded,
283 // the redirect is likely to be user-initiated. 285 // the redirect is likely to be user-initiated.
284 // Therefore, Page 21 should be in the history in addition to Page 22. 286 // Therefore, Page 21 should be in the history in addition to Page 22.
285 LoadAndWaitForFile("history_length_test_page_21.html"); 287 LoadAndWaitForFile("history_length_test_page_21.html");
286 } 288 }
289
290 // If this test flakes, use bug 22111.
291 IN_PROC_BROWSER_TEST_F(HistoryBrowserTest, HistorySearchXSS) {
292 GURL url(std::string(chrome::kChromeUIHistoryURL) +
293 "#q=%3Cimg%20src%3Dx%3Ax%20onerror%3D%22document.title%3D'XSS'%22%3E");
294 ui_test_utils::NavigateToURL(browser(), url);
295 // Mainly, this is to ensure we send a synchronous message to the renderer
296 // so that we're not susceptible (less susceptible?) to a race condition.
297 // Should a race condition ever trigger, it won't result in flakiness.
298 int num = ui_test_utils::FindInPage(
299 browser()->GetSelectedTabContentsWrapper(), ASCIIToUTF16("<img"), true,
300 true, NULL);
301 EXPECT_GT(num, 0);
302 EXPECT_EQ(ASCIIToUTF16("History"),
303 browser()->GetSelectedWebContents()->GetTitle());
304 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/session_history_uitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698