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

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: Update tests, mark TODOs 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 856 matching lines...) Expand 10 before | Expand all | Expand 10 after
867 867
868 // NTP contents should be preloaded. 868 // NTP contents should be preloaded.
869 ASSERT_NE(static_cast<InstantNTP*>(NULL), instant()->ntp()); 869 ASSERT_NE(static_cast<InstantNTP*>(NULL), instant()->ntp());
870 EXPECT_FALSE(instant()->ntp()->IsLocal()); 870 EXPECT_FALSE(instant()->ntp()->IsLocal());
871 871
872 // NTP not reloaded after being killed. 872 // NTP not reloaded after being killed.
873 instant()->InstantPageRenderViewGone(instant()->ntp()->contents()); 873 instant()->InstantPageRenderViewGone(instant()->ntp()->contents());
874 EXPECT_EQ(NULL, instant()->ntp()); 874 EXPECT_EQ(NULL, instant()->ntp());
875 875
876 // Open new tab. Should use local NTP. 876 // Open new tab. Should use local NTP.
877 // TODO(creis): Same problem.
877 ui_test_utils::NavigateToURLWithDisposition( 878 ui_test_utils::NavigateToURLWithDisposition(
878 browser(), 879 browser(),
879 GURL(chrome::kChromeUINewTabURL), 880 GURL(chrome::kChromeUINewTabURL),
880 NEW_FOREGROUND_TAB, 881 NEW_FOREGROUND_TAB,
881 ui_test_utils::BROWSER_TEST_WAIT_FOR_TAB); 882 ui_test_utils::BROWSER_TEST_WAIT_FOR_TAB);
882 content::WebContents* active_tab = 883 content::WebContents* active_tab =
883 browser()->tab_strip_model()->GetActiveWebContents(); 884 browser()->tab_strip_model()->GetActiveWebContents();
884 EXPECT_EQ(instant()->GetLocalInstantURL(), active_tab->GetURL().spec()); 885 EXPECT_EQ(instant()->GetLocalInstantURL(), active_tab->GetURL().spec());
885 } 886 }
886 887
887 IN_PROC_BROWSER_TEST_F(InstantExtendedTest, PreloadedNTPDoesntSupportInstant) { 888 IN_PROC_BROWSER_TEST_F(InstantExtendedTest, PreloadedNTPDoesntSupportInstant) {
888 // Setup Instant. 889 // Setup Instant.
889 GURL instant_url = test_server()->GetURL("files/empty.html?strk=1"); 890 GURL instant_url = test_server()->GetURL("files/empty.html?strk=1");
890 InstantTestBase::Init(instant_url); 891 InstantTestBase::Init(instant_url);
891 ASSERT_NO_FATAL_FAILURE(SetupInstant(browser())); 892 ASSERT_NO_FATAL_FAILURE(SetupInstant(browser()));
892 FocusOmniboxAndWaitForInstantOverlayAndNTPSupport(); 893 FocusOmniboxAndWaitForInstantOverlayAndNTPSupport();
893 894
894 // NTP contents should have fallen back to the local page. 895 // NTP contents should have fallen back to the local page.
895 ASSERT_NE(static_cast<InstantNTP*>(NULL), instant()->ntp()); 896 ASSERT_NE(static_cast<InstantNTP*>(NULL), instant()->ntp());
896 EXPECT_TRUE(instant()->ntp()->IsLocal()); 897 EXPECT_TRUE(instant()->ntp()->IsLocal());
897 898
898 // Open new tab. Should use local NTP. 899 // Open new tab. Should use local NTP.
900 // TODO(creis): Same problem.
899 ui_test_utils::NavigateToURLWithDisposition( 901 ui_test_utils::NavigateToURLWithDisposition(
900 browser(), 902 browser(),
901 GURL(chrome::kChromeUINewTabURL), 903 GURL(chrome::kChromeUINewTabURL),
902 NEW_FOREGROUND_TAB, 904 NEW_FOREGROUND_TAB,
903 ui_test_utils::BROWSER_TEST_WAIT_FOR_TAB); 905 ui_test_utils::BROWSER_TEST_WAIT_FOR_TAB);
904 content::WebContents* active_tab = 906 content::WebContents* active_tab =
905 browser()->tab_strip_model()->GetActiveWebContents(); 907 browser()->tab_strip_model()->GetActiveWebContents();
906 EXPECT_EQ(instant()->GetLocalInstantURL(), active_tab->GetURL().spec()); 908 EXPECT_EQ(instant()->GetLocalInstantURL(), active_tab->GetURL().spec());
907 } 909 }
908 910
(...skipping 1406 matching lines...) Expand 10 before | Expand all | Expand 10 after
2315 2317
2316 // Flaky: http://crbug.com/238863 2318 // Flaky: http://crbug.com/238863
2317 #if defined(OS_CHROMEOS) 2319 #if defined(OS_CHROMEOS)
2318 #define MAYBE_RedirectToLocalOnLoadFailure DISABLED_RedirectToLocalOnLoadFailure 2320 #define MAYBE_RedirectToLocalOnLoadFailure DISABLED_RedirectToLocalOnLoadFailure
2319 #else 2321 #else
2320 #define MAYBE_RedirectToLocalOnLoadFailure RedirectToLocalOnLoadFailure 2322 #define MAYBE_RedirectToLocalOnLoadFailure RedirectToLocalOnLoadFailure
2321 #endif 2323 #endif
2322 IN_PROC_BROWSER_TEST_F( 2324 IN_PROC_BROWSER_TEST_F(
2323 InstantExtendedFirstTabTest, MAYBE_RedirectToLocalOnLoadFailure) { 2325 InstantExtendedFirstTabTest, MAYBE_RedirectToLocalOnLoadFailure) {
2324 // Create a new window to test the first NTP load. 2326 // Create a new window to test the first NTP load.
2327 // TODO(creis): This fails in BrowserInstantController's
2328 // MaybeSwapInInstantNTPContents because the pending entry hasn't
2329 // committed yet. It's trying to SwapInInstantNTP as part of the OpenURL
2330 // call, which can't work. (What if the navigation were to fail?)
2325 ui_test_utils::NavigateToURLWithDisposition( 2331 ui_test_utils::NavigateToURLWithDisposition(
2326 browser(), 2332 browser(),
2327 GURL(chrome::kChromeUINewTabURL), 2333 GURL(chrome::kChromeUINewTabURL),
2328 NEW_WINDOW, 2334 NEW_WINDOW,
2329 ui_test_utils::BROWSER_TEST_WAIT_FOR_BROWSER); 2335 ui_test_utils::BROWSER_TEST_WAIT_FOR_BROWSER);
2330 2336
2331 const BrowserList* native_browser_list = BrowserList::GetInstance( 2337 const BrowserList* native_browser_list = BrowserList::GetInstance(
2332 chrome::HOST_DESKTOP_TYPE_NATIVE); 2338 chrome::HOST_DESKTOP_TYPE_NATIVE);
2333 ASSERT_EQ(2u, native_browser_list->size()); 2339 ASSERT_EQ(2u, native_browser_list->size());
2334 set_browser(native_browser_list->get(1)); 2340 set_browser(native_browser_list->get(1));
(...skipping 11 matching lines...) Expand all
2346 // NTP contents should be preloaded. 2352 // NTP contents should be preloaded.
2347 ASSERT_NE(static_cast<InstantNTP*>(NULL), instant()->ntp()); 2353 ASSERT_NE(static_cast<InstantNTP*>(NULL), instant()->ntp());
2348 EXPECT_TRUE(instant()->ntp()->IsLocal()); 2354 EXPECT_TRUE(instant()->ntp()->IsLocal());
2349 2355
2350 // Overlay contents should be preloaded. 2356 // Overlay contents should be preloaded.
2351 ASSERT_NE(static_cast<InstantOverlay*>(NULL), instant()->overlay()); 2357 ASSERT_NE(static_cast<InstantOverlay*>(NULL), instant()->overlay());
2352 EXPECT_TRUE(instant()->overlay()->IsLocal()); 2358 EXPECT_TRUE(instant()->overlay()->IsLocal());
2353 2359
2354 // Instant tab contents should be preloaded. 2360 // Instant tab contents should be preloaded.
2355 ASSERT_NE(static_cast<InstantTab*>(NULL), instant()->instant_tab()); 2361 ASSERT_NE(static_cast<InstantTab*>(NULL), instant()->instant_tab());
2362 // TODO(creis): This is where the test fails.
2356 EXPECT_TRUE(instant()->instant_tab()->IsLocal()); 2363 EXPECT_TRUE(instant()->instant_tab()->IsLocal());
2357 } 2364 }
2358 2365
2359 IN_PROC_BROWSER_TEST_F(InstantExtendedTest, 2366 IN_PROC_BROWSER_TEST_F(InstantExtendedTest,
2360 PageVisibilityEventOnCommit) { 2367 PageVisibilityEventOnCommit) {
2361 ASSERT_NO_FATAL_FAILURE(SetupInstant(browser())); 2368 ASSERT_NO_FATAL_FAILURE(SetupInstant(browser()));
2362 FocusOmniboxAndWaitForInstantOverlayAndNTPSupport(); 2369 FocusOmniboxAndWaitForInstantOverlayAndNTPSupport();
2363 2370
2364 // Set the text, and wait for suggestions to show up. 2371 // Set the text, and wait for suggestions to show up.
2365 ASSERT_TRUE(SetOmniboxTextAndWaitForOverlayToShow("search")); 2372 ASSERT_TRUE(SetOmniboxTextAndWaitForOverlayToShow("search"));
(...skipping 16 matching lines...) Expand all
2382 2389
2383 // Test that if the LogDropdownShown() call records a histogram value. 2390 // Test that if the LogDropdownShown() call records a histogram value.
2384 IN_PROC_BROWSER_TEST_F(InstantExtendedTest, LogDropdownShown) { 2391 IN_PROC_BROWSER_TEST_F(InstantExtendedTest, LogDropdownShown) {
2385 ASSERT_NO_FATAL_FAILURE(SetupInstant(browser())); 2392 ASSERT_NO_FATAL_FAILURE(SetupInstant(browser()));
2386 FocusOmniboxAndWaitForInstantOverlayAndNTPSupport(); 2393 FocusOmniboxAndWaitForInstantOverlayAndNTPSupport();
2387 int64 histogramValue = GetHistogramCount("Instant.TimeToFirstShowFromWeb"); 2394 int64 histogramValue = GetHistogramCount("Instant.TimeToFirstShowFromWeb");
2388 ASSERT_TRUE(SetOmniboxTextAndWaitForOverlayToShow("a")); 2395 ASSERT_TRUE(SetOmniboxTextAndWaitForOverlayToShow("a"));
2389 EXPECT_EQ(histogramValue + 1, 2396 EXPECT_EQ(histogramValue + 1,
2390 GetHistogramCount("Instant.TimeToFirstShowFromWeb")); 2397 GetHistogramCount("Instant.TimeToFirstShowFromWeb"));
2391 } 2398 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698