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

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

Issue 218093002: Ensure fullscreen mode is exited for same-site navigations. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 9 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 | « content/browser/web_contents/web_contents_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/web_contents/web_contents_impl_unittest.cc
diff --git a/content/browser/web_contents/web_contents_impl_unittest.cc b/content/browser/web_contents/web_contents_impl_unittest.cc
index a6a66bbdf77c2a0634a30c6975e56ff88ea398e4..051e011c8bf2480b1112d3efd379c1d40c462f4b 100644
--- a/content/browser/web_contents/web_contents_impl_unittest.cc
+++ b/content/browser/web_contents/web_contents_impl_unittest.cc
@@ -1299,6 +1299,58 @@ TEST_F(WebContentsImplTest, NavigationExitsFullscreen) {
contents()->SetDelegate(NULL);
}
+// Tests that fullscreen is exited throughout the object hierarchy when
+// instructing NavigationController to GoBack() or GoForward().
+TEST_F(WebContentsImplTest, HistoryNavigationExitsFullscreen) {
+ FakeFullscreenDelegate fake_delegate;
+ contents()->SetDelegate(&fake_delegate);
+ TestRenderViewHost* const orig_rvh = test_rvh();
+
+ // Navigate to a site.
+ const GURL url("http://www.google.com");
+ controller().LoadURL(url, Referrer(), PAGE_TRANSITION_TYPED, std::string());
+ contents()->TestDidNavigate(orig_rvh, 1, url, PAGE_TRANSITION_TYPED);
+ EXPECT_EQ(orig_rvh, contents()->GetRenderViewHost());
+
+ // Now, navigate to another page on the same site.
+ const GURL url2("http://www.google.com/search?q=kittens");
+ controller().LoadURL(url2, Referrer(), PAGE_TRANSITION_TYPED, std::string());
+ EXPECT_FALSE(contents()->cross_navigation_pending());
+ contents()->TestDidNavigate(orig_rvh, 2, url2, PAGE_TRANSITION_TYPED);
+ EXPECT_EQ(orig_rvh, contents()->GetRenderViewHost());
+
+ // Sanity-check: Confirm we're not starting out in fullscreen mode.
+ EXPECT_FALSE(orig_rvh->IsFullscreen());
+ EXPECT_FALSE(contents()->IsFullscreenForCurrentTab());
+ EXPECT_FALSE(fake_delegate.IsFullscreenForTabOrPending(contents()));
+
+ for (int i = 0; i < 2; ++i) {
+ // Toggle fullscreen mode on (as if initiated via IPC from renderer).
+ orig_rvh->OnMessageReceived(
+ ViewHostMsg_ToggleFullscreen(orig_rvh->GetRoutingID(), true));
+ EXPECT_TRUE(orig_rvh->IsFullscreen());
+ EXPECT_TRUE(contents()->IsFullscreenForCurrentTab());
+ EXPECT_TRUE(fake_delegate.IsFullscreenForTabOrPending(contents()));
+
+ // Navigate backward (or forward).
+ if (i == 0)
+ controller().GoBack();
+ else
+ controller().GoForward();
+ EXPECT_FALSE(contents()->cross_navigation_pending());
+ EXPECT_EQ(orig_rvh, contents()->GetRenderViewHost());
+ contents()->TestDidNavigate(
+ orig_rvh, i + 1, url, PAGE_TRANSITION_FORWARD_BACK);
+
+ // Confirm fullscreen has exited.
+ EXPECT_FALSE(orig_rvh->IsFullscreen());
+ EXPECT_FALSE(contents()->IsFullscreenForCurrentTab());
+ EXPECT_FALSE(fake_delegate.IsFullscreenForTabOrPending(contents()));
+ }
+
+ contents()->SetDelegate(NULL);
+}
+
// Tests that fullscreen is exited throughout the object hierarchy on a renderer
// crash.
TEST_F(WebContentsImplTest, CrashExitsFullscreen) {
« no previous file with comments | « content/browser/web_contents/web_contents_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698