OLD | NEW |
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 <stddef.h> | 5 #include <stddef.h> |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/feature_list.h" |
8 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
9 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
10 #include "base/run_loop.h" | 11 #include "base/run_loop.h" |
11 #include "base/strings/string16.h" | 12 #include "base/strings/string16.h" |
12 #include "base/strings/string_util.h" | 13 #include "base/strings/string_util.h" |
13 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.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/profiles/profile.h" | 18 #include "chrome/browser/profiles/profile.h" |
18 #include "chrome/browser/ui/browser.h" | 19 #include "chrome/browser/ui/browser.h" |
19 #include "chrome/browser/ui/browser_commands.h" | 20 #include "chrome/browser/ui/browser_commands.h" |
20 #include "chrome/browser/ui/browser_finder.h" | 21 #include "chrome/browser/ui/browser_finder.h" |
21 #include "chrome/browser/ui/browser_tabstrip.h" | 22 #include "chrome/browser/ui/browser_tabstrip.h" |
22 #include "chrome/browser/ui/browser_window.h" | 23 #include "chrome/browser/ui/browser_window.h" |
23 #include "chrome/browser/ui/chrome_pages.h" | 24 #include "chrome/browser/ui/chrome_pages.h" |
24 #include "chrome/browser/ui/find_bar/find_bar.h" | 25 #include "chrome/browser/ui/find_bar/find_bar.h" |
25 #include "chrome/browser/ui/find_bar/find_bar_controller.h" | 26 #include "chrome/browser/ui/find_bar/find_bar_controller.h" |
26 #include "chrome/browser/ui/find_bar/find_bar_host_unittest_util.h" | 27 #include "chrome/browser/ui/find_bar/find_bar_host_unittest_util.h" |
27 #include "chrome/browser/ui/find_bar/find_notification_details.h" | 28 #include "chrome/browser/ui/find_bar/find_notification_details.h" |
28 #include "chrome/browser/ui/find_bar/find_tab_helper.h" | 29 #include "chrome/browser/ui/find_bar/find_tab_helper.h" |
29 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 30 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 31 #include "chrome/common/chrome_features.h" |
30 #include "chrome/common/chrome_switches.h" | 32 #include "chrome/common/chrome_switches.h" |
31 #include "chrome/common/url_constants.h" | 33 #include "chrome/common/url_constants.h" |
32 #include "chrome/test/base/find_in_page_observer.h" | 34 #include "chrome/test/base/find_in_page_observer.h" |
33 #include "chrome/test/base/in_process_browser_test.h" | 35 #include "chrome/test/base/in_process_browser_test.h" |
34 #include "chrome/test/base/ui_test_utils.h" | 36 #include "chrome/test/base/ui_test_utils.h" |
35 #include "components/history/core/browser/history_service.h" | 37 #include "components/history/core/browser/history_service.h" |
36 #include "components/prefs/pref_service.h" | 38 #include "components/prefs/pref_service.h" |
37 #include "content/public/browser/download_manager.h" | 39 #include "content/public/browser/download_manager.h" |
38 #include "content/public/browser/notification_service.h" | 40 #include "content/public/browser/notification_service.h" |
39 #include "content/public/browser/notification_types.h" | 41 #include "content/public/browser/notification_types.h" |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 // chrome://downloads, data directory | 304 // chrome://downloads, data directory |
303 #if defined(OS_WIN) || defined(OS_MACOSX) | 305 #if defined(OS_WIN) || defined(OS_MACOSX) |
304 // Disabled due to crbug.com/175711 and http://crbug.com/419987 | 306 // Disabled due to crbug.com/175711 and http://crbug.com/419987 |
305 #define MAYBE_SearchWithinSpecialURL \ | 307 #define MAYBE_SearchWithinSpecialURL \ |
306 DISABLED_SearchWithinSpecialURL | 308 DISABLED_SearchWithinSpecialURL |
307 #else | 309 #else |
308 #define MAYBE_SearchWithinSpecialURL \ | 310 #define MAYBE_SearchWithinSpecialURL \ |
309 SearchWithinSpecialURL | 311 SearchWithinSpecialURL |
310 #endif | 312 #endif |
311 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, MAYBE_SearchWithinSpecialURL) { | 313 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, MAYBE_SearchWithinSpecialURL) { |
| 314 // TODO(tsergeant): Get this test working on MD History, which loads very |
| 315 // asynchronously and causes this test to fail. |
| 316 std::unique_ptr<base::FeatureList> feature_list(new base::FeatureList); |
| 317 feature_list->InitializeFromCommandLine( |
| 318 std::string(), features::kMaterialDesignHistoryFeature.name); |
| 319 base::FeatureList::ClearInstanceForTesting(); |
| 320 base::FeatureList::SetInstance(std::move(feature_list)); |
| 321 |
312 WebContents* web_contents = | 322 WebContents* web_contents = |
313 browser()->tab_strip_model()->GetActiveWebContents(); | 323 browser()->tab_strip_model()->GetActiveWebContents(); |
314 | 324 |
315 base::FilePath data_dir = | 325 base::FilePath data_dir = |
316 ui_test_utils::GetTestFilePath(base::FilePath(), base::FilePath()); | 326 ui_test_utils::GetTestFilePath(base::FilePath(), base::FilePath()); |
317 ui_test_utils::NavigateToURL(browser(), net::FilePathToFileURL(data_dir)); | 327 ui_test_utils::NavigateToURL(browser(), net::FilePathToFileURL(data_dir)); |
318 EXPECT_EQ(1, FindInPageASCII(web_contents, "downloads", | 328 EXPECT_EQ(1, FindInPageASCII(web_contents, "downloads", |
319 kFwd, kIgnoreCase, NULL)); | 329 kFwd, kIgnoreCase, NULL)); |
320 | 330 |
321 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUIHistoryURL)); | 331 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUIHistoryURL)); |
(...skipping 1226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1548 | 1558 |
1549 EXPECT_TRUE(chrome::ExecuteCommand(browser_incognito, IDC_FIND_NEXT)); | 1559 EXPECT_TRUE(chrome::ExecuteCommand(browser_incognito, IDC_FIND_NEXT)); |
1550 WebContents* web_contents_incognito = | 1560 WebContents* web_contents_incognito = |
1551 browser_incognito->tab_strip_model()->GetActiveWebContents(); | 1561 browser_incognito->tab_strip_model()->GetActiveWebContents(); |
1552 ui_test_utils::FindInPageNotificationObserver observer( | 1562 ui_test_utils::FindInPageNotificationObserver observer( |
1553 web_contents_incognito); | 1563 web_contents_incognito); |
1554 observer.Wait(); | 1564 observer.Wait(); |
1555 EXPECT_EQ(ASCIIToUTF16("bar"), | 1565 EXPECT_EQ(ASCIIToUTF16("bar"), |
1556 GetFindBarTextForBrowser(browser_incognito)); | 1566 GetFindBarTextForBrowser(browser_incognito)); |
1557 } | 1567 } |
OLD | NEW |