| 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 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 #if defined(OS_LINUX) | 359 #if defined(OS_LINUX) |
| 360 #define MAYBE_UsesOverlayIfTabNotReady DISABLED_UsesOverlayIfTabNotReady | 360 #define MAYBE_UsesOverlayIfTabNotReady DISABLED_UsesOverlayIfTabNotReady |
| 361 #else | 361 #else |
| 362 #define MAYBE_UsesOverlayIfTabNotReady UsesOverlayIfTabNotReady | 362 #define MAYBE_UsesOverlayIfTabNotReady UsesOverlayIfTabNotReady |
| 363 #endif | 363 #endif |
| 364 | 364 |
| 365 IN_PROC_BROWSER_TEST_F(InstantExtendedTest, MAYBE_UsesOverlayIfTabNotReady) { | 365 IN_PROC_BROWSER_TEST_F(InstantExtendedTest, MAYBE_UsesOverlayIfTabNotReady) { |
| 366 ASSERT_NO_FATAL_FAILURE(SetupInstant(browser())); | 366 ASSERT_NO_FATAL_FAILURE(SetupInstant(browser())); |
| 367 FocusOmniboxAndWaitForInstantOverlayAndNTPSupport(); | 367 FocusOmniboxAndWaitForInstantOverlayAndNTPSupport(); |
| 368 | 368 |
| 369 // Open a new tab and navigate to instant URL. Start typing before InstantTab | 369 // Open a new tab and start typing before InstantTab is properly hooked up. |
| 370 // is properly hooked up. Should use the overlay. | 370 // Should use the overlay. |
| 371 ui_test_utils::NavigateToURLWithDisposition( | 371 ui_test_utils::NavigateToURLWithDisposition( |
| 372 browser(), | 372 browser(), |
| 373 instant_url(), | 373 GURL(chrome::kChromeUINewTabURL), |
| 374 NEW_BACKGROUND_TAB, | 374 NEW_FOREGROUND_TAB, |
| 375 ui_test_utils::BROWSER_TEST_NONE); | 375 ui_test_utils::BROWSER_TEST_WAIT_FOR_TAB); |
| 376 EXPECT_EQ(2, browser()->tab_strip_model()->count()); | |
| 377 browser()->tab_strip_model()->ActivateTabAt(1, false); | |
| 378 ASSERT_TRUE(SetOmniboxTextAndWaitForOverlayToShow("query")); | 376 ASSERT_TRUE(SetOmniboxTextAndWaitForOverlayToShow("query")); |
| 379 | 377 |
| 380 // But Instant tab should still exist. | 378 // But Instant tab should still exist. |
| 381 ASSERT_NE(static_cast<InstantTab*>(NULL), instant()->instant_tab()); | 379 ASSERT_NE(static_cast<InstantTab*>(NULL), instant()->instant_tab()); |
| 382 EXPECT_FALSE(instant()->UseTabForSuggestions()); | 380 EXPECT_FALSE(instant()->UseTabForSuggestions()); |
| 383 | 381 |
| 384 // Wait for Instant Tab support if it still hasn't finished loading. | 382 // Wait for Instant Tab support if it still hasn't finished loading. |
| 385 if (!instant()->instant_tab()->supports_instant()) { | 383 if (!instant()->instant_tab()->supports_instant()) { |
| 386 content::WindowedNotificationObserver instant_tab_observer( | 384 content::WindowedNotificationObserver instant_tab_observer( |
| 387 chrome::NOTIFICATION_INSTANT_TAB_SUPPORT_DETERMINED, | 385 chrome::NOTIFICATION_INSTANT_TAB_SUPPORT_DETERMINED, |
| (...skipping 2324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2712 GURL(chrome::kChromeUINewTabURL), | 2710 GURL(chrome::kChromeUINewTabURL), |
| 2713 NEW_FOREGROUND_TAB, | 2711 NEW_FOREGROUND_TAB, |
| 2714 ui_test_utils::BROWSER_TEST_WAIT_FOR_TAB); | 2712 ui_test_utils::BROWSER_TEST_WAIT_FOR_TAB); |
| 2715 ASSERT_TRUE(ui_test_utils::SendKeyPressSync(browser(), ui::VKEY_OEM_PERIOD, | 2713 ASSERT_TRUE(ui_test_utils::SendKeyPressSync(browser(), ui::VKEY_OEM_PERIOD, |
| 2716 true, true, false, false)); | 2714 true, true, false, false)); |
| 2717 EXPECT_TRUE(UpdateSearchState(instant()->instant_tab()->contents())); | 2715 EXPECT_TRUE(UpdateSearchState(instant()->instant_tab()->contents())); |
| 2718 EXPECT_EQ(1, on_toggle_voice_search_calls_); | 2716 EXPECT_EQ(1, on_toggle_voice_search_calls_); |
| 2719 } | 2717 } |
| 2720 | 2718 |
| 2721 #endif // HTML_INSTANT_EXTENDED_POPUP | 2719 #endif // HTML_INSTANT_EXTENDED_POPUP |
| OLD | NEW |