| 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 <sstream> | 5 #include <sstream> |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/metrics/field_trial.h" | 8 #include "base/metrics/field_trial.h" |
| 9 #include "base/metrics/histogram_base.h" | 9 #include "base/metrics/histogram_base.h" |
| 10 #include "base/metrics/histogram_samples.h" | 10 #include "base/metrics/histogram_samples.h" |
| (...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 #if defined(OS_LINUX) | 358 #if defined(OS_LINUX) |
| 359 #define MAYBE_UsesOverlayIfTabNotReady DISABLED_UsesOverlayIfTabNotReady | 359 #define MAYBE_UsesOverlayIfTabNotReady DISABLED_UsesOverlayIfTabNotReady |
| 360 #else | 360 #else |
| 361 #define MAYBE_UsesOverlayIfTabNotReady UsesOverlayIfTabNotReady | 361 #define MAYBE_UsesOverlayIfTabNotReady UsesOverlayIfTabNotReady |
| 362 #endif | 362 #endif |
| 363 | 363 |
| 364 IN_PROC_BROWSER_TEST_F(InstantExtendedTest, MAYBE_UsesOverlayIfTabNotReady) { | 364 IN_PROC_BROWSER_TEST_F(InstantExtendedTest, MAYBE_UsesOverlayIfTabNotReady) { |
| 365 ASSERT_NO_FATAL_FAILURE(SetupInstant(browser())); | 365 ASSERT_NO_FATAL_FAILURE(SetupInstant(browser())); |
| 366 FocusOmniboxAndWaitForInstantOverlayAndNTPSupport(); | 366 FocusOmniboxAndWaitForInstantOverlayAndNTPSupport(); |
| 367 | 367 |
| 368 // Open a new tab and start typing before InstantTab is properly hooked up. | 368 // Open a new tab and navigate to instant URL. Start typing before InstantTab |
| 369 // Should use the overlay. | 369 // is properly hooked up. Should use the overlay. |
| 370 ui_test_utils::NavigateToURLWithDisposition( | 370 ui_test_utils::NavigateToURLWithDisposition( |
| 371 browser(), | 371 browser(), |
| 372 GURL(chrome::kChromeUINewTabURL), | 372 instant_url(), |
| 373 NEW_FOREGROUND_TAB, | 373 NEW_BACKGROUND_TAB, |
| 374 ui_test_utils::BROWSER_TEST_WAIT_FOR_TAB); | 374 ui_test_utils::BROWSER_TEST_NONE); |
| 375 EXPECT_EQ(2, browser()->tab_strip_model()->count()); |
| 376 browser()->tab_strip_model()->ActivateTabAt(1, false); |
| 375 ASSERT_TRUE(SetOmniboxTextAndWaitForOverlayToShow("query")); | 377 ASSERT_TRUE(SetOmniboxTextAndWaitForOverlayToShow("query")); |
| 376 | 378 |
| 377 // But Instant tab should still exist. | 379 // But Instant tab should still exist. |
| 378 ASSERT_NE(static_cast<InstantTab*>(NULL), instant()->instant_tab()); | 380 ASSERT_NE(static_cast<InstantTab*>(NULL), instant()->instant_tab()); |
| 379 EXPECT_FALSE(instant()->UseTabForSuggestions()); | 381 EXPECT_FALSE(instant()->UseTabForSuggestions()); |
| 380 | 382 |
| 381 // Wait for Instant Tab support if it still hasn't finished loading. | 383 // Wait for Instant Tab support if it still hasn't finished loading. |
| 382 if (!instant()->instant_tab()->supports_instant()) { | 384 if (!instant()->instant_tab()->supports_instant()) { |
| 383 content::WindowedNotificationObserver instant_tab_observer( | 385 content::WindowedNotificationObserver instant_tab_observer( |
| 384 chrome::NOTIFICATION_INSTANT_TAB_SUPPORT_DETERMINED, | 386 chrome::NOTIFICATION_INSTANT_TAB_SUPPORT_DETERMINED, |
| (...skipping 2505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2890 browser()->tab_strip_model()->ActivateTabAt(0, false); | 2892 browser()->tab_strip_model()->ActivateTabAt(0, false); |
| 2891 | 2893 |
| 2892 // Switch back to new tab. | 2894 // Switch back to new tab. |
| 2893 browser()->tab_strip_model()->ActivateTabAt(1, false); | 2895 browser()->tab_strip_model()->ActivateTabAt(1, false); |
| 2894 | 2896 |
| 2895 // Confirm that new tab got no onmostvisitedchanged event. | 2897 // Confirm that new tab got no onmostvisitedchanged event. |
| 2896 active_tab = browser()->tab_strip_model()->GetActiveWebContents(); | 2898 active_tab = browser()->tab_strip_model()->GetActiveWebContents(); |
| 2897 EXPECT_TRUE(UpdateSearchState(active_tab)); | 2899 EXPECT_TRUE(UpdateSearchState(active_tab)); |
| 2898 EXPECT_EQ(1, on_most_visited_change_calls_); | 2900 EXPECT_EQ(1, on_most_visited_change_calls_); |
| 2899 } | 2901 } |
| OLD | NEW |