Chromium Code Reviews| Index: chrome/browser/ui/search/instant_extended_interactive_uitest.cc |
| diff --git a/chrome/browser/ui/search/instant_extended_interactive_uitest.cc b/chrome/browser/ui/search/instant_extended_interactive_uitest.cc |
| index 83752412ffafe48627045a36c4c56be0736c15c2..a1ab0c0fc333a1ceac218e82617092fc2181de04 100644 |
| --- a/chrome/browser/ui/search/instant_extended_interactive_uitest.cc |
| +++ b/chrome/browser/ui/search/instant_extended_interactive_uitest.cc |
| @@ -46,8 +46,6 @@ |
| #include "chrome/browser/ui/browser_list.h" |
| #include "chrome/browser/ui/browser_tabstrip.h" |
| #include "chrome/browser/ui/omnibox/omnibox_view.h" |
| -#include "chrome/browser/ui/search/instant_ntp.h" |
| -#include "chrome/browser/ui/search/instant_ntp_prerenderer.h" |
| #include "chrome/browser/ui/search/instant_tab.h" |
| #include "chrome/browser/ui/search/instant_test_utils.h" |
| #include "chrome/browser/ui/search/search_tab_helper.h" |
| @@ -167,24 +165,6 @@ class InstantExtendedTest : public InProcessBrowserTest, |
| return histogram->SnapshotSamples()->TotalCount(); |
| } |
| - void SendDownArrow() { |
| - omnibox()->model()->OnUpOrDownKeyPressed(1); |
| - // Wait for JavaScript to run the key handler by executing a blank script. |
| - EXPECT_TRUE(ExecuteScript(std::string())); |
| - } |
| - |
| - void SendUpArrow() { |
| - omnibox()->model()->OnUpOrDownKeyPressed(-1); |
| - // Wait for JavaScript to run the key handler by executing a blank script. |
| - EXPECT_TRUE(ExecuteScript(std::string())); |
| - } |
| - |
| - void SendEscape() { |
| - omnibox()->model()->OnEscapeKeyPressed(); |
| - // Wait for JavaScript to run the key handler by executing a blank script. |
| - EXPECT_TRUE(ExecuteScript(std::string())); |
| - } |
| - |
| bool UpdateSearchState(content::WebContents* contents) WARN_UNUSED_RESULT { |
| return GetIntFromJS(contents, "onMostVisitedChangedCalls", |
| &on_most_visited_change_calls_) && |
| @@ -366,84 +346,9 @@ class InstantPolicyTest : public ExtensionBrowserTest, public InstantTestBase { |
| DISALLOW_COPY_AND_ASSIGN(InstantPolicyTest); |
| }; |
| -IN_PROC_BROWSER_TEST_F(InstantExtendedNetworkTest, NTPReactsToNetworkChanges) { |
|
kmadhusu
2014/01/09 23:31:43
Please remove the corresponding friend declaration
samarth
2014/01/10 05:13:32
Done.
|
| - // Setup Instant. |
| - ASSERT_NO_FATAL_FAILURE(SetupInstant(browser())); |
| - FocusOmniboxAndWaitForInstantNTPSupport(); |
| - |
| - InstantService* instant_service = |
| - InstantServiceFactory::GetForProfile(browser()->profile()); |
| - ASSERT_NE(static_cast<InstantService*>(NULL), instant_service); |
| - |
| - // The setup first initializes the platform specific NetworkChangeNotifier. |
| - // The InstantExtendedNetworkTest replaces it with a fake, but by the time, |
| - // InstantNTPPrerenderer has already registered itself. So the |
| - // InstantNTPPrerenderer needs to register itself as NetworkChangeObserver |
| - // again. |
| - net::NetworkChangeNotifier::AddNetworkChangeObserver( |
| - instant_service->ntp_prerenderer()); |
| - |
| - // The fake network change notifier will provide the network state to be |
| - // offline, so the ntp will be local. |
| - ASSERT_NE(static_cast<InstantNTP*>(NULL), |
| - instant_service->ntp_prerenderer()->ntp()); |
| - EXPECT_TRUE(instant_service->ntp_prerenderer()->ntp()->IsLocal()); |
| - |
| - // Change the connect state, and wait for the notifications to be run, and NTP |
| - // support to be determined. |
| - SetConnectionType(net::NetworkChangeNotifier::CONNECTION_ETHERNET); |
| - FocusOmniboxAndWaitForInstantNTPSupport(); |
| - |
| - // Verify the network state is fine, and InstantNTPPrerenderer doesn't want |
| - // to switch to local NTP anymore. |
| - EXPECT_FALSE(net::NetworkChangeNotifier::IsOffline()); |
| - EXPECT_FALSE(instant_service->ntp_prerenderer()->ShouldSwitchToLocalNTP()); |
| - |
| - // Open new tab. |
| - ui_test_utils::NavigateToURLWithDisposition( |
| - browser(), |
| - GURL(chrome::kChromeUINewTabURL), |
| - NEW_FOREGROUND_TAB, |
| - ui_test_utils::BROWSER_TEST_WAIT_FOR_TAB); |
| - content::WebContents* active_tab = |
| - browser()->tab_strip_model()->GetActiveWebContents(); |
| - |
| - // Verify new NTP is not local. |
| - EXPECT_TRUE(chrome::IsInstantNTP(active_tab)); |
| - EXPECT_NE(instant_service->ntp_prerenderer()->GetLocalInstantURL(), |
| - active_tab->GetURL().spec()); |
| - ASSERT_NE(static_cast<InstantNTP*>(NULL), |
| - instant_service->ntp_prerenderer()->ntp()); |
| - EXPECT_FALSE(instant_service->ntp_prerenderer()->ntp()->IsLocal()); |
| - |
| - SetConnectionType(net::NetworkChangeNotifier::CONNECTION_NONE); |
| - FocusOmniboxAndWaitForInstantNTPSupport(); |
| - |
| - // Verify the network state is fine, and InstantNTPPrerenderer doesn't want |
| - // to switch to local NTP anymore. |
| - EXPECT_TRUE(net::NetworkChangeNotifier::IsOffline()); |
| - EXPECT_TRUE(instant_service->ntp_prerenderer()->ShouldSwitchToLocalNTP()); |
| - |
| - // Open new tab. Preloaded NTP contents should have been used. |
| - ui_test_utils::NavigateToURLWithDisposition( |
| - browser(), |
| - GURL(chrome::kChromeUINewTabURL), |
| - NEW_FOREGROUND_TAB, |
| - ui_test_utils::BROWSER_TEST_WAIT_FOR_TAB); |
| - active_tab = browser()->tab_strip_model()->GetActiveWebContents(); |
| - |
| - // Verify new NTP is not local. |
| - EXPECT_TRUE(chrome::IsInstantNTP(active_tab)); |
| - EXPECT_EQ(instant_service->ntp_prerenderer()->GetLocalInstantURL(), |
| - active_tab->GetURL().spec()); |
| - ASSERT_NE(static_cast<InstantNTP*>(NULL), |
| - instant_service->ntp_prerenderer()->ntp()); |
| - EXPECT_TRUE(instant_service->ntp_prerenderer()->ntp()->IsLocal()); |
| -} |
| - |
| IN_PROC_BROWSER_TEST_F(InstantExtendedTest, SearchReusesInstantTab) { |
| ASSERT_NO_FATAL_FAILURE(SetupInstant(browser())); |
| - FocusOmniboxAndWaitForInstantNTPSupport(); |
| + FocusOmnibox(); |
| content::WindowedNotificationObserver observer( |
| chrome::NOTIFICATION_INSTANT_TAB_SUPPORT_DETERMINED, |
| @@ -472,7 +377,7 @@ IN_PROC_BROWSER_TEST_F(InstantExtendedTest, SearchReusesInstantTab) { |
| IN_PROC_BROWSER_TEST_F(InstantExtendedTest, |
| SearchDoesntReuseInstantTabWithoutSupport) { |
| ASSERT_NO_FATAL_FAILURE(SetupInstant(browser())); |
| - FocusOmniboxAndWaitForInstantNTPSupport(); |
| + FocusOmnibox(); |
| // Don't wait for the navigation to complete. |
| SetOmniboxText("flowers"); |
| @@ -490,7 +395,7 @@ IN_PROC_BROWSER_TEST_F(InstantExtendedTest, |
| IN_PROC_BROWSER_TEST_F(InstantExtendedTest, |
| TypedSearchURLDoesntReuseInstantTab) { |
| ASSERT_NO_FATAL_FAILURE(SetupInstant(browser())); |
| - FocusOmniboxAndWaitForInstantNTPSupport(); |
| + FocusOmnibox(); |
| // Create an observer to wait for the instant tab to support Instant. |
| content::WindowedNotificationObserver observer_1( |
| @@ -522,7 +427,7 @@ IN_PROC_BROWSER_TEST_F(InstantExtendedTest, |
| IN_PROC_BROWSER_TEST_F(InstantExtendedTest, OmniboxMarginSetForSearchURLs) { |
| ASSERT_NO_FATAL_FAILURE(SetupInstant(browser())); |
| - FocusOmniboxAndWaitForInstantNTPSupport(); |
| + FocusOmnibox(); |
| // Create an observer to wait for the instant tab to support Instant. |
| content::WindowedNotificationObserver observer( |
| @@ -545,7 +450,7 @@ IN_PROC_BROWSER_TEST_F(InstantExtendedTest, OmniboxMarginSetForSearchURLs) { |
| IN_PROC_BROWSER_TEST_F(InstantExtendedTest, NoMostVisitedChangedOnTabSwitch) { |
| // Initialize Instant. |
| ASSERT_NO_FATAL_FAILURE(SetupInstant(browser())); |
| - FocusOmniboxAndWaitForInstantNTPSupport(); |
| + FocusOmnibox(); |
| // Open new tab. Preloaded NTP contents should have been used. |
| ui_test_utils::NavigateToURLWithDisposition( |
| @@ -577,7 +482,7 @@ IN_PROC_BROWSER_TEST_F(InstantPolicyTest, ThemeBackgroundAccess) { |
| InstallThemeSource(); |
| ASSERT_NO_FATAL_FAILURE(InstallThemeAndVerify("theme", "camo theme")); |
| ASSERT_NO_FATAL_FAILURE(SetupInstant(browser())); |
| - FocusOmniboxAndWaitForInstantNTPSupport(); |
| + FocusOmnibox(); |
| // The "Instant" New Tab should have access to chrome-search: scheme but not |
| // chrome: scheme. |
| @@ -604,7 +509,7 @@ IN_PROC_BROWSER_TEST_F(InstantPolicyTest, |
| NoThemeBackgroundChangeEventOnTabSwitch) { |
| InstallThemeSource(); |
| ASSERT_NO_FATAL_FAILURE(SetupInstant(browser())); |
| - FocusOmniboxAndWaitForInstantNTPSupport(); |
| + FocusOmnibox(); |
| // Install a theme. |
| ASSERT_NO_FATAL_FAILURE(InstallThemeAndVerify("theme", "camo theme")); |
| @@ -653,7 +558,7 @@ IN_PROC_BROWSER_TEST_F(InstantPolicyTest, |
| MAYBE_SendThemeBackgroundChangedEvent) { |
| InstallThemeSource(); |
| ASSERT_NO_FATAL_FAILURE(SetupInstant(browser())); |
| - FocusOmniboxAndWaitForInstantNTPSupport(); |
| + FocusOmnibox(); |
| // Install a theme. |
| ASSERT_NO_FATAL_FAILURE(InstallThemeAndVerify("theme", "camo theme")); |
| @@ -698,7 +603,7 @@ IN_PROC_BROWSER_TEST_F(InstantExtendedTest, |
| ASSERT_NO_FATAL_FAILURE(SetupInstant(browser())); |
| // Focus omnibox and confirm overlay isn't shown. |
| - FocusOmniboxAndWaitForInstantNTPSupport(); |
| + FocusOmnibox(); |
| // Create an observer to wait for the instant tab to support Instant. |
| content::WindowedNotificationObserver observer( |
| @@ -745,7 +650,7 @@ IN_PROC_BROWSER_TEST_F(InstantExtendedTest, |
| ASSERT_NO_FATAL_FAILURE(SetupInstant(browser())); |
| // Focus omnibox and confirm overlay isn't shown. |
| - FocusOmniboxAndWaitForInstantNTPSupport(); |
| + FocusOmnibox(); |
| // Create an observer to wait for the instant tab to support Instant. |
| content::WindowedNotificationObserver observer( |
| @@ -798,7 +703,7 @@ IN_PROC_BROWSER_TEST_F(InstantExtendedTest, |
| // Flaky on all bots since re-enabled in r208032, crbug.com/253092 |
| IN_PROC_BROWSER_TEST_F(InstantExtendedTest, DISABLED_NavigateBackToNTP) { |
| ASSERT_NO_FATAL_FAILURE(SetupInstant(browser())); |
| - FocusOmniboxAndWaitForInstantNTPSupport(); |
| + FocusOmnibox(); |
| // Open a new tab page. |
| ui_test_utils::NavigateToURLWithDisposition( |
| @@ -858,7 +763,7 @@ IN_PROC_BROWSER_TEST_F(InstantExtendedTest, |
| DISABLED_DispatchMVChangeEventWhileNavigatingBackToNTP) { |
| // Setup Instant. |
| ASSERT_NO_FATAL_FAILURE(SetupInstant(browser())); |
| - FocusOmniboxAndWaitForInstantNTPSupport(); |
| + FocusOmnibox(); |
| // Open new tab. Preloaded NTP contents should have been used. |
| ui_test_utils::NavigateToURLWithDisposition( |
| @@ -899,7 +804,7 @@ IN_PROC_BROWSER_TEST_F(InstantExtendedTest, |
| IN_PROC_BROWSER_TEST_F(InstantExtendedPrefetchTest, SetPrefetchQuery) { |
| ASSERT_NO_FATAL_FAILURE(SetupInstant(browser())); |
| - FocusOmniboxAndWaitForInstantNTPSupport(); |
| + FocusOmnibox(); |
| content::WindowedNotificationObserver new_tab_observer( |
| content::NOTIFICATION_NAV_ENTRY_COMMITTED, |
| @@ -959,7 +864,7 @@ IN_PROC_BROWSER_TEST_F(InstantExtendedPrefetchTest, SetPrefetchQuery) { |
| IN_PROC_BROWSER_TEST_F(InstantExtendedPrefetchTest, ClearPrefetchedResults) { |
| ASSERT_NO_FATAL_FAILURE(SetupInstant(browser())); |
| - FocusOmniboxAndWaitForInstantNTPSupport(); |
| + FocusOmnibox(); |
| content::WindowedNotificationObserver new_tab_observer( |
| content::NOTIFICATION_NAV_ENTRY_COMMITTED, |
| @@ -1051,7 +956,7 @@ IN_PROC_BROWSER_TEST_F(InstantExtendedTest, Referrer) { |
| GURL result_url = |
| test_server()->GetURL("files/referrer_policy/referrer-policy-log.html"); |
| ASSERT_NO_FATAL_FAILURE(SetupInstant(browser())); |
| - FocusOmniboxAndWaitForInstantNTPSupport(); |
| + FocusOmnibox(); |
| // Type a query and press enter to get results. |
| SetOmniboxText("query"); |