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

Unified Diff: content/browser/web_contents/web_contents_view_aura_browsertest.cc

Issue 316403004: Test for the fix for history.replaceState navigations submitted earlier. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressing review feedback. Created 6 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | content/test/data/overscroll_navigation.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/web_contents/web_contents_view_aura_browsertest.cc
diff --git a/content/browser/web_contents/web_contents_view_aura_browsertest.cc b/content/browser/web_contents/web_contents_view_aura_browsertest.cc
index 492ab7b49a91cc12a45f1c53c721a09b607f7f13..685097e5f0851c0190c5ab57e836623ec5bac6a8 100644
--- a/content/browser/web_contents/web_contents_view_aura_browsertest.cc
+++ b/content/browser/web_contents/web_contents_view_aura_browsertest.cc
@@ -555,6 +555,34 @@ IN_PROC_BROWSER_TEST_F(WebContentsViewAuraTest,
EXPECT_EQ(NULL, screenshot_manager()->screenshot_taken_for());
}
+// Tests that navigations resulting from reloads and history.replaceState
+// do not capture screenshots while navigations resulting from
+// histrory.pushState do.
+IN_PROC_BROWSER_TEST_F(WebContentsViewAuraTest, ReplaceStateReloadPushState) {
+ ASSERT_NO_FATAL_FAILURE(
+ StartTestWithPage("files/overscroll_navigation.html"));
+ WebContentsImpl* web_contents =
+ static_cast<WebContentsImpl*>(shell()->web_contents());
+ RenderFrameHost* main_frame = web_contents->GetMainFrame();
+
+ set_min_screenshot_interval(0);
+ screenshot_manager()->Reset();
+ ExecuteSyncJSFunction(main_frame, "use_replace_state()");
+ screenshot_manager()->WaitUntilScreenshotIsReady();
+ // history.replaceState shouldn't capture a screenshot
+ EXPECT_FALSE(screenshot_manager()->screenshot_taken_for());
+ screenshot_manager()->Reset();
+ web_contents->GetController().Reload(true);
+ WaitForLoadStop(web_contents);
+ // reloading the page shouldn't capture a screenshot
+ EXPECT_FALSE(screenshot_manager()->screenshot_taken_for());
+ screenshot_manager()->Reset();
+ ExecuteSyncJSFunction(main_frame, "use_push_state()");
+ screenshot_manager()->WaitUntilScreenshotIsReady();
+ // pushing a state should capture a screenshot
+ EXPECT_TRUE(screenshot_manager()->screenshot_taken_for());
+}
+
// TODO(sadrul): This test is disabled because it reparents in a way the
// FocusController does not support. This code would crash in
// a production build. It only passed prior to this revision
« no previous file with comments | « no previous file | content/test/data/overscroll_navigation.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698