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 "base/command_line.h" |
5 #include "base/files/file_util.h" | 6 #include "base/files/file_util.h" |
6 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
7 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
8 #include "base/strings/string16.h" | 9 #include "base/strings/string16.h" |
9 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
10 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
11 #include "chrome/app/chrome_command_ids.h" | 12 #include "chrome/app/chrome_command_ids.h" |
12 #include "chrome/browser/history/history_service_factory.h" | 13 #include "chrome/browser/history/history_service_factory.h" |
13 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
14 #include "chrome/browser/ui/browser.h" | 15 #include "chrome/browser/ui/browser.h" |
15 #include "chrome/browser/ui/browser_commands.h" | 16 #include "chrome/browser/ui/browser_commands.h" |
16 #include "chrome/browser/ui/browser_finder.h" | 17 #include "chrome/browser/ui/browser_finder.h" |
17 #include "chrome/browser/ui/browser_navigator.h" | 18 #include "chrome/browser/ui/browser_navigator.h" |
18 #include "chrome/browser/ui/browser_tabstrip.h" | 19 #include "chrome/browser/ui/browser_tabstrip.h" |
19 #include "chrome/browser/ui/browser_window.h" | 20 #include "chrome/browser/ui/browser_window.h" |
20 #include "chrome/browser/ui/chrome_pages.h" | 21 #include "chrome/browser/ui/chrome_pages.h" |
21 #include "chrome/browser/ui/find_bar/find_bar.h" | 22 #include "chrome/browser/ui/find_bar/find_bar.h" |
22 #include "chrome/browser/ui/find_bar/find_bar_controller.h" | 23 #include "chrome/browser/ui/find_bar/find_bar_controller.h" |
23 #include "chrome/browser/ui/find_bar/find_bar_host_unittest_util.h" | 24 #include "chrome/browser/ui/find_bar/find_bar_host_unittest_util.h" |
24 #include "chrome/browser/ui/find_bar/find_notification_details.h" | 25 #include "chrome/browser/ui/find_bar/find_notification_details.h" |
25 #include "chrome/browser/ui/find_bar/find_tab_helper.h" | 26 #include "chrome/browser/ui/find_bar/find_tab_helper.h" |
26 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 27 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 28 #include "chrome/common/chrome_switches.h" |
27 #include "chrome/common/url_constants.h" | 29 #include "chrome/common/url_constants.h" |
28 #include "chrome/test/base/find_in_page_observer.h" | 30 #include "chrome/test/base/find_in_page_observer.h" |
29 #include "chrome/test/base/in_process_browser_test.h" | 31 #include "chrome/test/base/in_process_browser_test.h" |
30 #include "chrome/test/base/ui_test_utils.h" | 32 #include "chrome/test/base/ui_test_utils.h" |
31 #include "components/history/core/browser/history_service.h" | 33 #include "components/history/core/browser/history_service.h" |
32 #include "content/public/browser/download_manager.h" | 34 #include "content/public/browser/download_manager.h" |
33 #include "content/public/browser/notification_service.h" | 35 #include "content/public/browser/notification_service.h" |
34 #include "content/public/browser/notification_types.h" | 36 #include "content/public/browser/notification_types.h" |
35 #include "content/public/browser/render_view_host.h" | 37 #include "content/public/browser/render_view_host.h" |
36 #include "content/public/browser/web_contents.h" | 38 #include "content/public/browser/web_contents.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 const int kMoveIterations = 30; | 78 const int kMoveIterations = 30; |
77 | 79 |
78 } // namespace | 80 } // namespace |
79 | 81 |
80 class FindInPageControllerTest : public InProcessBrowserTest { | 82 class FindInPageControllerTest : public InProcessBrowserTest { |
81 public: | 83 public: |
82 FindInPageControllerTest() { | 84 FindInPageControllerTest() { |
83 chrome::DisableFindBarAnimationsDuringTesting(true); | 85 chrome::DisableFindBarAnimationsDuringTesting(true); |
84 } | 86 } |
85 | 87 |
| 88 // Disable new downloads UI as it is very very slow. https://crbug.com/526577 |
| 89 // TODO(dbeam): remove this once the downloads UI is not slow. |
| 90 void SetUpCommandLine(base::CommandLine* command_line) override { |
| 91 InProcessBrowserTest::SetUpCommandLine(command_line); |
| 92 command_line->AppendSwitch(switches::kDisableMaterialDesignDownloads); |
| 93 } |
| 94 |
86 protected: | 95 protected: |
87 bool GetFindBarWindowInfoForBrowser( | 96 bool GetFindBarWindowInfoForBrowser( |
88 Browser* browser, gfx::Point* position, bool* fully_visible) { | 97 Browser* browser, gfx::Point* position, bool* fully_visible) { |
89 FindBarTesting* find_bar = | 98 FindBarTesting* find_bar = |
90 browser->GetFindBarController()->find_bar()->GetFindBarTesting(); | 99 browser->GetFindBarController()->find_bar()->GetFindBarTesting(); |
91 return find_bar->GetFindBarWindowInfo(position, fully_visible); | 100 return find_bar->GetFindBarWindowInfo(position, fully_visible); |
92 } | 101 } |
93 | 102 |
94 bool GetFindBarWindowInfo(gfx::Point* position, bool* fully_visible) { | 103 bool GetFindBarWindowInfo(gfx::Point* position, bool* fully_visible) { |
95 return GetFindBarWindowInfoForBrowser(browser(), position, fully_visible); | 104 return GetFindBarWindowInfoForBrowser(browser(), position, fully_visible); |
(...skipping 1462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1558 | 1567 |
1559 EXPECT_TRUE(chrome::ExecuteCommand(browser_incognito, IDC_FIND_NEXT)); | 1568 EXPECT_TRUE(chrome::ExecuteCommand(browser_incognito, IDC_FIND_NEXT)); |
1560 WebContents* web_contents_incognito = | 1569 WebContents* web_contents_incognito = |
1561 browser_incognito->tab_strip_model()->GetActiveWebContents(); | 1570 browser_incognito->tab_strip_model()->GetActiveWebContents(); |
1562 ui_test_utils::FindInPageNotificationObserver observer( | 1571 ui_test_utils::FindInPageNotificationObserver observer( |
1563 web_contents_incognito); | 1572 web_contents_incognito); |
1564 observer.Wait(); | 1573 observer.Wait(); |
1565 EXPECT_EQ(ASCIIToUTF16("bar"), | 1574 EXPECT_EQ(ASCIIToUTF16("bar"), |
1566 GetFindBarTextForBrowser(browser_incognito)); | 1575 GetFindBarTextForBrowser(browser_incognito)); |
1567 } | 1576 } |
OLD | NEW |