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

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

Issue 2511993002: Migrate md history test code to ScopedFeatureList. (Closed)
Patch Set: rebase Created 4 years, 1 month 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
« no previous file with comments | « no previous file | chrome/browser/ui/find_bar/find_bar_host_browsertest.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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <utility> 5 #include <utility>
6 #include <vector> 6 #include <vector>
7 7
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/message_loop/message_loop.h" 12 #include "base/message_loop/message_loop.h"
13 #include "base/strings/utf_string_conversions.h" 13 #include "base/strings/utf_string_conversions.h"
14 #include "base/test/scoped_feature_list.h"
14 #include "build/build_config.h" 15 #include "build/build_config.h"
15 #include "chrome/app/chrome_command_ids.h" 16 #include "chrome/app/chrome_command_ids.h"
16 #include "chrome/browser/history/history_service_factory.h" 17 #include "chrome/browser/history/history_service_factory.h"
17 #include "chrome/browser/history/history_test_utils.h" 18 #include "chrome/browser/history/history_test_utils.h"
18 #include "chrome/browser/profiles/profile.h" 19 #include "chrome/browser/profiles/profile.h"
19 #include "chrome/browser/ui/browser.h" 20 #include "chrome/browser/ui/browser.h"
20 #include "chrome/browser/ui/browser_commands.h" 21 #include "chrome/browser/ui/browser_commands.h"
21 #include "chrome/browser/ui/tabs/tab_strip_model.h" 22 #include "chrome/browser/ui/tabs/tab_strip_model.h"
22 #include "chrome/browser/ui/webui/md_history_ui.h" 23 #include "chrome/common/chrome_features.h"
23 #include "chrome/common/chrome_switches.h" 24 #include "chrome/common/chrome_switches.h"
24 #include "chrome/common/pref_names.h" 25 #include "chrome/common/pref_names.h"
25 #include "chrome/common/url_constants.h" 26 #include "chrome/common/url_constants.h"
26 #include "chrome/test/base/in_process_browser_test.h" 27 #include "chrome/test/base/in_process_browser_test.h"
27 #include "chrome/test/base/ui_test_utils.h" 28 #include "chrome/test/base/ui_test_utils.h"
28 #include "components/history/core/browser/history_db_task.h" 29 #include "components/history/core/browser/history_db_task.h"
29 #include "components/history/core/browser/history_service.h" 30 #include "components/history/core/browser/history_service.h"
30 #include "components/prefs/pref_service.h" 31 #include "components/prefs/pref_service.h"
31 #include "content/public/browser/web_contents.h" 32 #include "content/public/browser/web_contents.h"
32 #include "content/public/test/browser_test_utils.h" 33 #include "content/public/test/browser_test_utils.h"
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 255
255 // http://crbug.com/22111 (linux), http://crbug.com/530246 (win) 256 // http://crbug.com/22111 (linux), http://crbug.com/530246 (win)
256 #if defined(OS_LINUX) || defined(OS_WIN) 257 #if defined(OS_LINUX) || defined(OS_WIN)
257 #define MAYBE_HistorySearchXSS DISABLED_HistorySearchXSS 258 #define MAYBE_HistorySearchXSS DISABLED_HistorySearchXSS
258 #else 259 #else
259 #define MAYBE_HistorySearchXSS HistorySearchXSS 260 #define MAYBE_HistorySearchXSS HistorySearchXSS
260 #endif 261 #endif
261 IN_PROC_BROWSER_TEST_F(HistoryBrowserTest, MAYBE_HistorySearchXSS) { 262 IN_PROC_BROWSER_TEST_F(HistoryBrowserTest, MAYBE_HistorySearchXSS) {
262 // TODO(tsergeant): Enable this test on MD History once it is possible to pass 263 // TODO(tsergeant): Enable this test on MD History once it is possible to pass
263 // in a query via URL (crbug.com/619799). 264 // in a query via URL (crbug.com/619799).
264 MdHistoryUI::SetEnabledForTesting(false); 265 base::test::ScopedFeatureList scoped_feature_list;
266 scoped_feature_list.InitAndDisableFeature(features::kMaterialDesignHistory);
265 267
266 GURL url(std::string(chrome::kChromeUIHistoryURL) + 268 GURL url(std::string(chrome::kChromeUIHistoryURL) +
267 "#q=%3Cimg%20src%3Dx%3Ax%20onerror%3D%22document.title%3D'XSS'%22%3E"); 269 "#q=%3Cimg%20src%3Dx%3Ax%20onerror%3D%22document.title%3D'XSS'%22%3E");
268 ui_test_utils::NavigateToURL(browser(), url); 270 ui_test_utils::NavigateToURL(browser(), url);
269 // Mainly, this is to ensure we send a synchronous message to the renderer 271 // Mainly, this is to ensure we send a synchronous message to the renderer
270 // so that we're not susceptible (less susceptible?) to a race condition. 272 // so that we're not susceptible (less susceptible?) to a race condition.
271 // Should a race condition ever trigger, it won't result in flakiness. 273 // Should a race condition ever trigger, it won't result in flakiness.
272 int num = ui_test_utils::FindInPage( 274 int num = ui_test_utils::FindInPage(
273 browser()->tab_strip_model()->GetActiveWebContents(), 275 browser()->tab_strip_model()->GetActiveWebContents(),
274 base::ASCIIToUTF16("<img"), true, 276 base::ASCIIToUTF16("<img"), true,
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
506 508
507 content::WebContents* active_web_contents = 509 content::WebContents* active_web_contents =
508 browser()->tab_strip_model()->GetActiveWebContents(); 510 browser()->tab_strip_model()->GetActiveWebContents();
509 ASSERT_EQ(web_contents, active_web_contents); 511 ASSERT_EQ(web_contents, active_web_contents);
510 ASSERT_EQ(history_url, active_web_contents->GetURL()); 512 ASSERT_EQ(history_url, active_web_contents->GetURL());
511 513
512 content::WebContents* second_tab = 514 content::WebContents* second_tab =
513 browser()->tab_strip_model()->GetWebContentsAt(1); 515 browser()->tab_strip_model()->GetWebContentsAt(1);
514 ASSERT_NE(history_url, second_tab->GetURL()); 516 ASSERT_NE(history_url, second_tab->GetURL());
515 } 517 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/find_bar/find_bar_host_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698