Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1162)

Side by Side Diff: chrome/browser/ui/search/instant_extended_interactive_uitest.cc

Issue 15041004: Replace PruneAllButActive with PruneAllButVisible. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 864 matching lines...) Expand 10 before | Expand all | Expand 10 after
875 875
876 // NTP contents should be preloaded. 876 // NTP contents should be preloaded.
877 ASSERT_NE(static_cast<InstantNTP*>(NULL), instant()->ntp()); 877 ASSERT_NE(static_cast<InstantNTP*>(NULL), instant()->ntp());
878 EXPECT_FALSE(instant()->ntp()->IsLocal()); 878 EXPECT_FALSE(instant()->ntp()->IsLocal());
879 879
880 // NTP not reloaded after being killed. 880 // NTP not reloaded after being killed.
881 instant()->InstantPageRenderViewGone(instant()->ntp()->contents()); 881 instant()->InstantPageRenderViewGone(instant()->ntp()->contents());
882 EXPECT_EQ(NULL, instant()->ntp()); 882 EXPECT_EQ(NULL, instant()->ntp());
883 883
884 // Open new tab. Should use local NTP. 884 // Open new tab. Should use local NTP.
885 // TODO(creis): Same problem.
885 ui_test_utils::NavigateToURLWithDisposition( 886 ui_test_utils::NavigateToURLWithDisposition(
886 browser(), 887 browser(),
887 GURL(chrome::kChromeUINewTabURL), 888 GURL(chrome::kChromeUINewTabURL),
888 NEW_FOREGROUND_TAB, 889 NEW_FOREGROUND_TAB,
889 ui_test_utils::BROWSER_TEST_WAIT_FOR_TAB); 890 ui_test_utils::BROWSER_TEST_WAIT_FOR_TAB);
890 content::WebContents* active_tab = 891 content::WebContents* active_tab =
891 browser()->tab_strip_model()->GetActiveWebContents(); 892 browser()->tab_strip_model()->GetActiveWebContents();
892 EXPECT_EQ(instant()->GetLocalInstantURL(), active_tab->GetURL().spec()); 893 EXPECT_EQ(instant()->GetLocalInstantURL(), active_tab->GetURL().spec());
893 } 894 }
894 895
895 IN_PROC_BROWSER_TEST_F(InstantExtendedTest, PreloadedNTPDoesntSupportInstant) { 896 IN_PROC_BROWSER_TEST_F(InstantExtendedTest, PreloadedNTPDoesntSupportInstant) {
896 // Setup Instant. 897 // Setup Instant.
897 GURL instant_url = test_server()->GetURL("files/empty.html?strk=1"); 898 GURL instant_url = test_server()->GetURL("files/empty.html?strk=1");
898 InstantTestBase::Init(instant_url); 899 InstantTestBase::Init(instant_url);
899 ASSERT_NO_FATAL_FAILURE(SetupInstant(browser())); 900 ASSERT_NO_FATAL_FAILURE(SetupInstant(browser()));
900 FocusOmniboxAndWaitForInstantOverlayAndNTPSupport(); 901 FocusOmniboxAndWaitForInstantOverlayAndNTPSupport();
901 902
902 // NTP contents should have fallen back to the local page. 903 // NTP contents should have fallen back to the local page.
903 ASSERT_NE(static_cast<InstantNTP*>(NULL), instant()->ntp()); 904 ASSERT_NE(static_cast<InstantNTP*>(NULL), instant()->ntp());
904 EXPECT_TRUE(instant()->ntp()->IsLocal()); 905 EXPECT_TRUE(instant()->ntp()->IsLocal());
905 906
906 // Open new tab. Should use local NTP. 907 // Open new tab. Should use local NTP.
908 // TODO(creis): Same problem.
907 ui_test_utils::NavigateToURLWithDisposition( 909 ui_test_utils::NavigateToURLWithDisposition(
908 browser(), 910 browser(),
909 GURL(chrome::kChromeUINewTabURL), 911 GURL(chrome::kChromeUINewTabURL),
910 NEW_FOREGROUND_TAB, 912 NEW_FOREGROUND_TAB,
911 ui_test_utils::BROWSER_TEST_WAIT_FOR_TAB); 913 ui_test_utils::BROWSER_TEST_WAIT_FOR_TAB);
912 content::WebContents* active_tab = 914 content::WebContents* active_tab =
913 browser()->tab_strip_model()->GetActiveWebContents(); 915 browser()->tab_strip_model()->GetActiveWebContents();
914 EXPECT_EQ(instant()->GetLocalInstantURL(), active_tab->GetURL().spec()); 916 EXPECT_EQ(instant()->GetLocalInstantURL(), active_tab->GetURL().spec());
915 } 917 }
916 918
(...skipping 1530 matching lines...) Expand 10 before | Expand all | Expand 10 after
2447 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { 2449 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
2448 command_line->AppendSwitch(switches::kEnableInstantExtendedAPI); 2450 command_line->AppendSwitch(switches::kEnableInstantExtendedAPI);
2449 command_line->AppendSwitch(switches::kDisableLocalFirstLoadNTP); 2451 command_line->AppendSwitch(switches::kDisableLocalFirstLoadNTP);
2450 } 2452 }
2451 }; 2453 };
2452 2454
2453 // Flaky: http://crbug.com/238863 2455 // Flaky: http://crbug.com/238863
2454 IN_PROC_BROWSER_TEST_F( 2456 IN_PROC_BROWSER_TEST_F(
2455 InstantExtendedFirstTabTest, DISABLED_RedirectToLocalOnLoadFailure) { 2457 InstantExtendedFirstTabTest, DISABLED_RedirectToLocalOnLoadFailure) {
2456 // Create a new window to test the first NTP load. 2458 // Create a new window to test the first NTP load.
2459 // TODO(creis): This fails in BrowserInstantController's
2460 // MaybeSwapInInstantNTPContents because the pending entry hasn't
2461 // committed yet. It's trying to SwapInInstantNTP as part of the OpenURL
2462 // call, which can't work. (What if the navigation were to fail?)
2457 ui_test_utils::NavigateToURLWithDisposition( 2463 ui_test_utils::NavigateToURLWithDisposition(
2458 browser(), 2464 browser(),
2459 GURL(chrome::kChromeUINewTabURL), 2465 GURL(chrome::kChromeUINewTabURL),
2460 NEW_WINDOW, 2466 NEW_WINDOW,
2461 ui_test_utils::BROWSER_TEST_WAIT_FOR_BROWSER); 2467 ui_test_utils::BROWSER_TEST_WAIT_FOR_BROWSER);
2462 2468
2463 const BrowserList* native_browser_list = BrowserList::GetInstance( 2469 const BrowserList* native_browser_list = BrowserList::GetInstance(
2464 chrome::HOST_DESKTOP_TYPE_NATIVE); 2470 chrome::HOST_DESKTOP_TYPE_NATIVE);
2465 ASSERT_EQ(2u, native_browser_list->size()); 2471 ASSERT_EQ(2u, native_browser_list->size());
2466 set_browser(native_browser_list->get(1)); 2472 set_browser(native_browser_list->get(1));
(...skipping 11 matching lines...) Expand all
2478 // NTP contents should be preloaded. 2484 // NTP contents should be preloaded.
2479 ASSERT_NE(static_cast<InstantNTP*>(NULL), instant()->ntp()); 2485 ASSERT_NE(static_cast<InstantNTP*>(NULL), instant()->ntp());
2480 EXPECT_TRUE(instant()->ntp()->IsLocal()); 2486 EXPECT_TRUE(instant()->ntp()->IsLocal());
2481 2487
2482 // Overlay contents should be preloaded. 2488 // Overlay contents should be preloaded.
2483 ASSERT_NE(static_cast<InstantOverlay*>(NULL), instant()->overlay()); 2489 ASSERT_NE(static_cast<InstantOverlay*>(NULL), instant()->overlay());
2484 EXPECT_TRUE(instant()->overlay()->IsLocal()); 2490 EXPECT_TRUE(instant()->overlay()->IsLocal());
2485 2491
2486 // Instant tab contents should be preloaded. 2492 // Instant tab contents should be preloaded.
2487 ASSERT_NE(static_cast<InstantTab*>(NULL), instant()->instant_tab()); 2493 ASSERT_NE(static_cast<InstantTab*>(NULL), instant()->instant_tab());
2494 // TODO(creis): This is where the test fails.
2488 EXPECT_TRUE(instant()->instant_tab()->IsLocal()); 2495 EXPECT_TRUE(instant()->instant_tab()->IsLocal());
2489 } 2496 }
2490 2497
2491 IN_PROC_BROWSER_TEST_F(InstantExtendedTest, 2498 IN_PROC_BROWSER_TEST_F(InstantExtendedTest,
2492 PageVisibilityEventOnCommit) { 2499 PageVisibilityEventOnCommit) {
2493 ASSERT_NO_FATAL_FAILURE(SetupInstant(browser())); 2500 ASSERT_NO_FATAL_FAILURE(SetupInstant(browser()));
2494 FocusOmniboxAndWaitForInstantOverlayAndNTPSupport(); 2501 FocusOmniboxAndWaitForInstantOverlayAndNTPSupport();
2495 2502
2496 // Set the text, and wait for suggestions to show up. 2503 // Set the text, and wait for suggestions to show up.
2497 ASSERT_TRUE(SetOmniboxTextAndWaitForOverlayToShow("search")); 2504 ASSERT_TRUE(SetOmniboxTextAndWaitForOverlayToShow("search"));
(...skipping 16 matching lines...) Expand all
2514 2521
2515 // Test that if the LogDropdownShown() call records a histogram value. 2522 // Test that if the LogDropdownShown() call records a histogram value.
2516 IN_PROC_BROWSER_TEST_F(InstantExtendedTest, LogDropdownShown) { 2523 IN_PROC_BROWSER_TEST_F(InstantExtendedTest, LogDropdownShown) {
2517 ASSERT_NO_FATAL_FAILURE(SetupInstant(browser())); 2524 ASSERT_NO_FATAL_FAILURE(SetupInstant(browser()));
2518 FocusOmniboxAndWaitForInstantOverlayAndNTPSupport(); 2525 FocusOmniboxAndWaitForInstantOverlayAndNTPSupport();
2519 int64 histogramValue = GetHistogramCount("Instant.TimeToFirstShowFromWeb"); 2526 int64 histogramValue = GetHistogramCount("Instant.TimeToFirstShowFromWeb");
2520 ASSERT_TRUE(SetOmniboxTextAndWaitForOverlayToShow("a")); 2527 ASSERT_TRUE(SetOmniboxTextAndWaitForOverlayToShow("a"));
2521 EXPECT_EQ(histogramValue + 1, 2528 EXPECT_EQ(histogramValue + 1,
2522 GetHistogramCount("Instant.TimeToFirstShowFromWeb")); 2529 GetHistogramCount("Instant.TimeToFirstShowFromWeb"));
2523 } 2530 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698