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();
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.
screenshot_manager()->WaitUntilScreenshotIsReady();
entry = NavigationEntryImpl::FromNavigationEntry(
web_contents->GetController().GetEntryAtIndex(4));
- EXPECT_TRUE(screenshot_manager()->ScreenshotSetForEntry(entry));
+ EXPECT_FALSE(screenshot_manager()->ScreenshotSetForEntry(entry));
}
}
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, history.replaceState,
+// and history.pushState do not capture screenshots.
IN_PROC_BROWSER_TEST_F(WebContentsViewAuraTest, ReplaceStateReloadPushState) {
ASSERT_NO_FATAL_FAILURE(
StartTestWithPage("files/overscroll_navigation.html"));
web_contents->GetController().Reload(true);
WaitForLoadStop(web_contents);
// reloading the page shouldn't capture a screenshot
- EXPECT_FALSE(screenshot_manager()->screenshot_taken_for());
+ // TODO (mfomitchev): currently broken. Uncomment when
+ // FrameHostMsg_DidCommitProvisionalLoad_Params.was_within_same_page
+ // is populated properly when reloading the page.
+ //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());
+ // pushing a state shouldn't capture a screenshot
+ // TODO (mfomitchev): currently broken. Uncomment when
+ // FrameHostMsg_DidCommitProvisionalLoad_Params.was_within_same_page
+ // is populated properly when pushState is used.
+ //EXPECT_FALSE(screenshot_manager()->screenshot_taken_for());
}
// TODO(sadrul): This test is disabled because it reparents in a way the