| 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 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 #if defined(OS_LINUX) | 353 #if defined(OS_LINUX) |
| 354 #define MAYBE_UsesOverlayIfTabNotReady DISABLED_UsesOverlayIfTabNotReady | 354 #define MAYBE_UsesOverlayIfTabNotReady DISABLED_UsesOverlayIfTabNotReady |
| 355 #else | 355 #else |
| 356 #define MAYBE_UsesOverlayIfTabNotReady UsesOverlayIfTabNotReady | 356 #define MAYBE_UsesOverlayIfTabNotReady UsesOverlayIfTabNotReady |
| 357 #endif | 357 #endif |
| 358 | 358 |
| 359 IN_PROC_BROWSER_TEST_F(InstantExtendedTest, MAYBE_UsesOverlayIfTabNotReady) { | 359 IN_PROC_BROWSER_TEST_F(InstantExtendedTest, MAYBE_UsesOverlayIfTabNotReady) { |
| 360 ASSERT_NO_FATAL_FAILURE(SetupInstant(browser())); | 360 ASSERT_NO_FATAL_FAILURE(SetupInstant(browser())); |
| 361 FocusOmniboxAndWaitForInstantOverlayAndNTPSupport(); | 361 FocusOmniboxAndWaitForInstantOverlayAndNTPSupport(); |
| 362 | 362 |
| 363 // Open a new tab and start typing before InstantTab is properly hooked up. | 363 // Open a new tab and navigate to instant URL. Start typing before InstantTab |
| 364 // Should use the overlay. | 364 // is properly hooked up. Should use the overlay. |
| 365 ui_test_utils::NavigateToURLWithDisposition( | 365 ui_test_utils::NavigateToURLWithDisposition( |
| 366 browser(), | 366 browser(), |
| 367 GURL(chrome::kChromeUINewTabURL), | 367 instant_url(), |
| 368 NEW_FOREGROUND_TAB, | 368 NEW_BACKGROUND_TAB, |
| 369 ui_test_utils::BROWSER_TEST_WAIT_FOR_TAB); | 369 ui_test_utils::BROWSER_TEST_NONE); |
| 370 EXPECT_EQ(2, browser()->tab_strip_model()->count()); |
| 371 browser()->tab_strip_model()->ActivateTabAt(1, false); |
| 370 ASSERT_TRUE(SetOmniboxTextAndWaitForOverlayToShow("query")); | 372 ASSERT_TRUE(SetOmniboxTextAndWaitForOverlayToShow("query")); |
| 371 | 373 |
| 372 // But Instant tab should still exist. | 374 // But Instant tab should still exist. |
| 373 ASSERT_NE(static_cast<InstantTab*>(NULL), instant()->instant_tab()); | 375 ASSERT_NE(static_cast<InstantTab*>(NULL), instant()->instant_tab()); |
| 374 EXPECT_FALSE(instant()->UseTabForSuggestions()); | 376 EXPECT_FALSE(instant()->UseTabForSuggestions()); |
| 375 | 377 |
| 376 // Wait for Instant Tab support if it still hasn't finished loading. | 378 // Wait for Instant Tab support if it still hasn't finished loading. |
| 377 if (!instant()->instant_tab()->supports_instant()) { | 379 if (!instant()->instant_tab()->supports_instant()) { |
| 378 content::WindowedNotificationObserver instant_tab_observer( | 380 content::WindowedNotificationObserver instant_tab_observer( |
| 379 chrome::NOTIFICATION_INSTANT_TAB_SUPPORT_DETERMINED, | 381 chrome::NOTIFICATION_INSTANT_TAB_SUPPORT_DETERMINED, |
| (...skipping 2294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2674 IDS_TASK_MANAGER_INSTANT_OVERLAY_PREFIX, string16()); | 2676 IDS_TASK_MANAGER_INSTANT_OVERLAY_PREFIX, string16()); |
| 2675 | 2677 |
| 2676 int instant_overlays = 0; | 2678 int instant_overlays = 0; |
| 2677 for (int i = 0; i < task_manager->ResourceCount(); ++i) { | 2679 for (int i = 0; i < task_manager->ResourceCount(); ++i) { |
| 2678 string16 title = task_manager->GetResourceTitle(i); | 2680 string16 title = task_manager->GetResourceTitle(i); |
| 2679 if (StartsWith(title, prefix, true)) | 2681 if (StartsWith(title, prefix, true)) |
| 2680 ++instant_overlays; | 2682 ++instant_overlays; |
| 2681 } | 2683 } |
| 2682 EXPECT_EQ(2, instant_overlays); | 2684 EXPECT_EQ(2, instant_overlays); |
| 2683 } | 2685 } |
| OLD | NEW |