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

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

Issue 417343003: Don't capture screenshots for in-page navigations. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Whitepace Created 6 years, 5 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
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 673db0f77c665d549c913b049f93b6d92d1c5c67..7476c699c1d92d6f2f90fcb922262f96354e8e57 100644
--- a/content/browser/web_contents/web_contents_view_aura_browsertest.cc
+++ b/content/browser/web_contents/web_contents_view_aura_browsertest.cc
@@ -408,42 +408,39 @@ IN_PROC_BROWSER_TEST_F(WebContentsViewAuraTest, MAYBE_OverscrollScreenshot) {
set_min_screenshot_interval(0);
// Do a few navigations initiated by the page.
+ // Screenshots should never be captured since these are all in-page
+ // navigations
ExecuteSyncJSFunction(main_frame, "navigate_next()");
EXPECT_EQ(1, GetCurrentIndex());
ExecuteSyncJSFunction(main_frame, "navigate_next()");
EXPECT_EQ(2, GetCurrentIndex());
screenshot_manager()->WaitUntilScreenshotIsReady();
- // The current entry won't have any screenshots. But the entries in the
- // history should now have screenshots.
NavigationEntryImpl* entry = NavigationEntryImpl::FromNavigationEntry(
web_contents->GetController().GetEntryAtIndex(2));
EXPECT_FALSE(entry->screenshot().get());
entry = NavigationEntryImpl::FromNavigationEntry(
web_contents->GetController().GetEntryAtIndex(1));
- EXPECT_TRUE(screenshot_manager()->ScreenshotSetForEntry(entry));
+ EXPECT_FALSE(screenshot_manager()->ScreenshotSetForEntry(entry));
entry = NavigationEntryImpl::FromNavigationEntry(
web_contents->GetController().GetEntryAtIndex(0));
- EXPECT_TRUE(screenshot_manager()->ScreenshotSetForEntry(entry));
+ EXPECT_FALSE(screenshot_manager()->ScreenshotSetForEntry(entry));
- // Navigate again. Index 2 should now have a screenshot.
ExecuteSyncJSFunction(main_frame, "navigate_next()");
- EXPECT_EQ(3, GetCurrentIndex());
screenshot_manager()->WaitUntilScreenshotIsReady();
entry = NavigationEntryImpl::FromNavigationEntry(
web_contents->GetController().GetEntryAtIndex(2));
- EXPECT_TRUE(screenshot_manager()->ScreenshotSetForEntry(entry));
+ EXPECT_FALSE(screenshot_manager()->ScreenshotSetForEntry(entry));
entry = NavigationEntryImpl::FromNavigationEntry(
web_contents->GetController().GetEntryAtIndex(3));
EXPECT_FALSE(entry->screenshot().get());
-
{
// Now, swipe right to navigate backwards. This should navigate away from
- // index 3 to index 2, and index 3 should have a screenshot.
+ // index 3 to index 2.
base::string16 expected_title = base::ASCIIToUTF16("Title: #2");
content::TitleWatcher title_watcher(web_contents, expected_title);
aura::Window* content = web_contents->GetContentNativeView();
@@ -460,7 +457,7 @@ IN_PROC_BROWSER_TEST_F(WebContentsViewAuraTest, MAYBE_OverscrollScreenshot) {
screenshot_manager()->WaitUntilScreenshotIsReady();
entry = NavigationEntryImpl::FromNavigationEntry(
web_contents->GetController().GetEntryAtIndex(3));
- EXPECT_TRUE(screenshot_manager()->ScreenshotSetForEntry(entry));
+ EXPECT_FALSE(screenshot_manager()->ScreenshotSetForEntry(entry));
}
// Navigate a couple more times.
@@ -484,7 +481,7 @@ IN_PROC_BROWSER_TEST_F(WebContentsViewAuraTest, MAYBE_OverscrollScreenshot) {
screenshot_manager()->WaitUntilScreenshotIsReady();
entry = NavigationEntryImpl::FromNavigationEntry(
web_contents->GetController().GetEntryAtIndex(4));
- EXPECT_TRUE(screenshot_manager()->ScreenshotSetForEntry(entry));
+ EXPECT_FALSE(screenshot_manager()->ScreenshotSetForEntry(entry));
}
}
@@ -566,9 +563,8 @@ 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.
+// Tests that navigations resulting from reloads and history.replaceState,
+// and histrory.pushState do not capture screenshots.
Charlie Reis 2014/07/25 22:07:40 history
mfomitchev 2014/07/25 22:29:15 Done.
IN_PROC_BROWSER_TEST_F(WebContentsViewAuraTest, ReplaceStateReloadPushState) {
ASSERT_NO_FATAL_FAILURE(
StartTestWithPage("files/overscroll_navigation.html"));
@@ -590,8 +586,8 @@ IN_PROC_BROWSER_TEST_F(WebContentsViewAuraTest, ReplaceStateReloadPushState) {
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());
+ // pushing a state shouldn't capture a screenshot
+ EXPECT_FALSE(screenshot_manager()->screenshot_taken_for());
Charlie Reis 2014/07/25 22:07:40 How did this pass? pushState changes the URL path
mfomitchev 2014/07/25 22:29:15 responded above
}
// TODO(sadrul): This test is disabled because it reparents in a way the

Powered by Google App Engine
This is Rietveld 408576698