| 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 2426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2811 observer.Wait(); | 2813 observer.Wait(); |
| 2812 | 2814 |
| 2813 const std::string& url = | 2815 const std::string& url = |
| 2814 browser()->tab_strip_model()->GetActiveWebContents()->GetURL().spec(); | 2816 browser()->tab_strip_model()->GetActiveWebContents()->GetURL().spec(); |
| 2815 // Make sure we actually used search_url, not instant_url. | 2817 // Make sure we actually used search_url, not instant_url. |
| 2816 ASSERT_THAT(url, HasSubstr("&is_search")); | 2818 ASSERT_THAT(url, HasSubstr("&is_search")); |
| 2817 EXPECT_THAT(url, HasSubstr("&es_sm=")); | 2819 EXPECT_THAT(url, HasSubstr("&es_sm=")); |
| 2818 } | 2820 } |
| 2819 | 2821 |
| 2820 #endif // if !defined(HTML_INSTANT_EXTENDED_POPUP) | 2822 #endif // if !defined(HTML_INSTANT_EXTENDED_POPUP) |
| OLD | NEW |