| 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" |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 scoped_ptr<net::ScopedDefaultHostResolverProc> scoped_host_resolver_proc_; | 91 scoped_ptr<net::ScopedDefaultHostResolverProc> scoped_host_resolver_proc_; |
| 92 scoped_ptr<net::NetworkChangeNotifier::DisableForTest> | 92 scoped_ptr<net::NetworkChangeNotifier::DisableForTest> |
| 93 disable_network_change_notifier_; | 93 disable_network_change_notifier_; |
| 94 }; | 94 }; |
| 95 | 95 |
| 96 IN_PROC_BROWSER_TEST_F(InstantExtendedManualTest, MANUAL_ShowsGoogleNTP) { | 96 IN_PROC_BROWSER_TEST_F(InstantExtendedManualTest, MANUAL_ShowsGoogleNTP) { |
| 97 set_browser(browser()); | 97 set_browser(browser()); |
| 98 InstantService* instant_service = | 98 InstantService* instant_service = |
| 99 InstantServiceFactory::GetForProfile(browser()->profile()); | 99 InstantServiceFactory::GetForProfile(browser()->profile()); |
| 100 ASSERT_NE(static_cast<InstantService*>(NULL), instant_service); | 100 ASSERT_NE(static_cast<InstantService*>(NULL), instant_service); |
| 101 instant_service->ntp_prerenderer()->ReloadStaleNTP(); | 101 instant_service->ntp_prerenderer()->ReloadInstantNTP(); |
| 102 | 102 |
| 103 FocusOmniboxAndWaitForInstantNTPSupport(); | 103 FocusOmniboxAndWaitForInstantNTPSupport(); |
| 104 content::WindowedNotificationObserver observer( | 104 content::WindowedNotificationObserver observer( |
| 105 content::NOTIFICATION_NAV_ENTRY_COMMITTED, | 105 content::NOTIFICATION_NAV_ENTRY_COMMITTED, |
| 106 content::NotificationService::AllSources()); | 106 content::NotificationService::AllSources()); |
| 107 ui_test_utils::NavigateToURLWithDisposition( | 107 ui_test_utils::NavigateToURLWithDisposition( |
| 108 browser(), | 108 browser(), |
| 109 GURL(chrome::kChromeUINewTabURL), | 109 GURL(chrome::kChromeUINewTabURL), |
| 110 CURRENT_TAB, | 110 CURRENT_TAB, |
| 111 ui_test_utils::BROWSER_TEST_NONE); | 111 ui_test_utils::BROWSER_TEST_NONE); |
| 112 observer.Wait(); | 112 observer.Wait(); |
| 113 content::WebContents* active_tab = | 113 content::WebContents* active_tab = |
| 114 browser()->tab_strip_model()->GetActiveWebContents(); | 114 browser()->tab_strip_model()->GetActiveWebContents(); |
| 115 EXPECT_TRUE(IsGooglePage(active_tab)); | 115 EXPECT_TRUE(IsGooglePage(active_tab)); |
| 116 } | 116 } |
| 117 | 117 |
| 118 IN_PROC_BROWSER_TEST_F(InstantExtendedManualTest, MANUAL_SearchesFromFakebox) { | 118 IN_PROC_BROWSER_TEST_F(InstantExtendedManualTest, MANUAL_SearchesFromFakebox) { |
| 119 set_browser(browser()); | 119 set_browser(browser()); |
| 120 InstantService* instant_service = | 120 InstantService* instant_service = |
| 121 InstantServiceFactory::GetForProfile(browser()->profile()); | 121 InstantServiceFactory::GetForProfile(browser()->profile()); |
| 122 ASSERT_NE(static_cast<InstantService*>(NULL), instant_service); | 122 ASSERT_NE(static_cast<InstantService*>(NULL), instant_service); |
| 123 instant_service->ntp_prerenderer()->ReloadStaleNTP(); | 123 instant_service->ntp_prerenderer()->ReloadInstantNTP(); |
| 124 | 124 |
| 125 FocusOmniboxAndWaitForInstantNTPSupport(); | 125 FocusOmniboxAndWaitForInstantNTPSupport(); |
| 126 // Open a new tab page. | 126 // Open a new tab page. |
| 127 content::WindowedNotificationObserver observer( | 127 content::WindowedNotificationObserver observer( |
| 128 content::NOTIFICATION_NAV_ENTRY_COMMITTED, | 128 content::NOTIFICATION_NAV_ENTRY_COMMITTED, |
| 129 content::NotificationService::AllSources()); | 129 content::NotificationService::AllSources()); |
| 130 ui_test_utils::NavigateToURLWithDisposition( | 130 ui_test_utils::NavigateToURLWithDisposition( |
| 131 browser(), | 131 browser(), |
| 132 GURL(chrome::kChromeUINewTabURL), | 132 GURL(chrome::kChromeUINewTabURL), |
| 133 CURRENT_TAB, | 133 CURRENT_TAB, |
| (...skipping 30 matching lines...) Expand all Loading... |
| 164 // The omnibox should say "test" and have visible focus. | 164 // The omnibox should say "test" and have visible focus. |
| 165 EXPECT_EQ("test", GetOmniboxText()); | 165 EXPECT_EQ("test", GetOmniboxText()); |
| 166 EXPECT_EQ(OMNIBOX_FOCUS_VISIBLE, omnibox()->model()->focus_state()); | 166 EXPECT_EQ(OMNIBOX_FOCUS_VISIBLE, omnibox()->model()->focus_state()); |
| 167 | 167 |
| 168 // Pressing enter should search for [test]. | 168 // Pressing enter should search for [test]. |
| 169 const string16& search_title = ASCIIToUTF16("test - Google Search"); | 169 const string16& search_title = ASCIIToUTF16("test - Google Search"); |
| 170 content::TitleWatcher title_watcher(active_tab, search_title); | 170 content::TitleWatcher title_watcher(active_tab, search_title); |
| 171 PressEnterAndWaitForNavigation(); | 171 PressEnterAndWaitForNavigation(); |
| 172 EXPECT_EQ(search_title, title_watcher.WaitAndGetTitle()); | 172 EXPECT_EQ(search_title, title_watcher.WaitAndGetTitle()); |
| 173 } | 173 } |
| OLD | NEW |