| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/strings/string_util.h" | 5 #include "base/strings/string_util.h" |
| 6 #include "chrome/browser/chrome_notification_types.h" | 6 #include "chrome/browser/chrome_notification_types.h" |
| 7 #include "chrome/browser/search/instant_service.h" | 7 #include "chrome/browser/search/instant_service.h" |
| 8 #include "chrome/browser/search/instant_service_factory.h" | 8 #include "chrome/browser/search/instant_service_factory.h" |
| 9 #include "chrome/browser/search/search.h" | 9 #include "chrome/browser/search/search.h" |
| 10 #include "chrome/browser/task_manager/task_manager.h" | 10 #include "chrome/browser/task_manager/task_manager.h" |
| 11 #include "chrome/browser/task_manager/task_manager_browsertest_util.h" | 11 #include "chrome/browser/task_manager/task_manager_browsertest_util.h" |
| 12 #include "chrome/browser/ui/browser.h" | 12 #include "chrome/browser/ui/browser.h" |
| 13 #include "chrome/browser/ui/browser_commands.h" | 13 #include "chrome/browser/ui/browser_commands.h" |
| 14 #include "chrome/browser/ui/host_desktop.h" | 14 #include "chrome/browser/ui/host_desktop.h" |
| 15 #include "chrome/browser/ui/omnibox/omnibox_view.h" | 15 #include "chrome/browser/ui/omnibox/omnibox_view.h" |
| 16 #include "chrome/browser/ui/search/instant_test_utils.h" | 16 #include "chrome/browser/ui/search/instant_test_utils.h" |
| 17 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 17 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 18 #include "chrome/common/search_types.h" | 18 #include "chrome/common/search_types.h" |
| 19 #include "chrome/common/url_constants.h" | 19 #include "chrome/common/url_constants.h" |
| 20 #include "chrome/test/base/in_process_browser_test.h" | 20 #include "chrome/test/base/in_process_browser_test.h" |
| 21 #include "chrome/test/base/interactive_test_utils.h" | 21 #include "chrome/test/base/interactive_test_utils.h" |
| 22 #include "chrome/test/base/ui_test_utils.h" | 22 #include "chrome/test/base/ui_test_utils.h" |
| 23 #include "components/omnibox/common/omnibox_focus_state.h" | 23 #include "components/omnibox/common/omnibox_focus_state.h" |
| 24 #include "components/search/search.h" |
| 24 #include "content/public/browser/navigation_controller.h" | 25 #include "content/public/browser/navigation_controller.h" |
| 25 #include "content/public/browser/navigation_entry.h" | 26 #include "content/public/browser/navigation_entry.h" |
| 26 #include "content/public/browser/notification_service.h" | 27 #include "content/public/browser/notification_service.h" |
| 27 #include "content/public/browser/render_process_host.h" | 28 #include "content/public/browser/render_process_host.h" |
| 28 #include "content/public/browser/web_contents.h" | 29 #include "content/public/browser/web_contents.h" |
| 29 #include "content/public/test/browser_test_utils.h" | 30 #include "content/public/test/browser_test_utils.h" |
| 30 #include "net/base/network_change_notifier.h" | 31 #include "net/base/network_change_notifier.h" |
| 31 #include "net/dns/mock_host_resolver.h" | 32 #include "net/dns/mock_host_resolver.h" |
| 32 #include "url/gurl.h" | 33 #include "url/gurl.h" |
| 33 | 34 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 disable_network_change_notifier_.reset( | 67 disable_network_change_notifier_.reset( |
| 67 new net::NetworkChangeNotifier::DisableForTest()); | 68 new net::NetworkChangeNotifier::DisableForTest()); |
| 68 } | 69 } |
| 69 | 70 |
| 70 void TearDownOnMainThread() override { | 71 void TearDownOnMainThread() override { |
| 71 disable_network_change_notifier_.reset(); | 72 disable_network_change_notifier_.reset(); |
| 72 } | 73 } |
| 73 | 74 |
| 74 protected: | 75 protected: |
| 75 void SetUpInProcessBrowserTestFixture() override { | 76 void SetUpInProcessBrowserTestFixture() override { |
| 76 chrome::EnableQueryExtractionForTesting(); | 77 search::EnableQueryExtractionForTesting(); |
| 77 } | 78 } |
| 78 | 79 |
| 79 content::WebContents* active_tab() { | 80 content::WebContents* active_tab() { |
| 80 return browser()->tab_strip_model()->GetActiveWebContents(); | 81 return browser()->tab_strip_model()->GetActiveWebContents(); |
| 81 } | 82 } |
| 82 | 83 |
| 83 bool IsGooglePage(content::WebContents* contents) { | 84 bool IsGooglePage(content::WebContents* contents) { |
| 84 bool is_google = false; | 85 bool is_google = false; |
| 85 if (!GetBoolFromJS(contents, "!!window.google", &is_google)) | 86 if (!GetBoolFromJS(contents, "!!window.google", &is_google)) |
| 86 return false; | 87 return false; |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 EXPECT_EQ("test", GetOmniboxText()); | 141 EXPECT_EQ("test", GetOmniboxText()); |
| 141 EXPECT_EQ(OMNIBOX_FOCUS_VISIBLE, omnibox()->model()->focus_state()); | 142 EXPECT_EQ(OMNIBOX_FOCUS_VISIBLE, omnibox()->model()->focus_state()); |
| 142 | 143 |
| 143 // Pressing enter should search for [test]. | 144 // Pressing enter should search for [test]. |
| 144 const base::string16& search_title = | 145 const base::string16& search_title = |
| 145 base::ASCIIToUTF16("test - Google Search"); | 146 base::ASCIIToUTF16("test - Google Search"); |
| 146 content::TitleWatcher title_watcher(active_tab, search_title); | 147 content::TitleWatcher title_watcher(active_tab, search_title); |
| 147 PressEnterAndWaitForNavigation(); | 148 PressEnterAndWaitForNavigation(); |
| 148 EXPECT_EQ(search_title, title_watcher.WaitAndGetTitle()); | 149 EXPECT_EQ(search_title, title_watcher.WaitAndGetTitle()); |
| 149 } | 150 } |
| OLD | NEW |