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

Unified Diff: content/browser/frame_host/navigator_impl_unittest.cc

Issue 1066823004: PlzNavigate: improve tracking of improper subframe swap-out. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and changes from CR coments (sorry about the mixed patch set) Created 5 years, 8 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/browser/frame_host/render_frame_host_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/frame_host/navigator_impl_unittest.cc
diff --git a/content/browser/frame_host/navigator_impl_unittest.cc b/content/browser/frame_host/navigator_impl_unittest.cc
index d265010d48eb50848c73d2510a3c7136ee9d891e..d1120058f4e685358d7a5ce125e4c913f66fdc2d 100644
--- a/content/browser/frame_host/navigator_impl_unittest.cc
+++ b/content/browser/frame_host/navigator_impl_unittest.cc
@@ -258,14 +258,16 @@ TEST_F(NavigatorTestWithBrowserSideNavigation,
EXPECT_FALSE(GetSpeculativeRenderFrameHost(node));
}
-// PlzNavigate: Test that a proper NavigationRequest is created by
-// RequestNavigation.
-TEST_F(NavigatorTestWithBrowserSideNavigation, BeginNavigation) {
+// PlzNavigate: Test that navigation state is properly maintained when
+// navigating simultaneously at the root frame and at a subframe levels.
+TEST_F(NavigatorTestWithBrowserSideNavigation,
clamy 2015/04/27 12:05:20 Note that the original goal of this test is to che
+ NavigatingAtRootAndSubframeSimultaneously) {
const GURL kUrl1("http://www.google.com/");
const GURL kUrl2("http://www.chromium.org/");
const GURL kUrl3("http://www.gmail.com/");
contents()->NavigateAndCommit(kUrl1);
+ process()->sink().ClearMessages();
// Add a subframe.
FrameTreeNode* root_node = contents()->GetFrameTree()->root();
@@ -331,12 +333,24 @@ TEST_F(NavigatorTestWithBrowserSideNavigation, BeginNavigation) {
// As the main frame hasn't yet committed the subframe still exists. Thus, the
// above situation regarding subframe navigations is valid here.
+ ASSERT_TRUE(subframe_node->navigation_request());
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kSitePerProcess)) {
EXPECT_TRUE(GetSpeculativeRenderFrameHost(subframe_node));
} else {
EXPECT_FALSE(GetSpeculativeRenderFrameHost(subframe_node));
}
+
+ // Have the navigation commit for the root node's speculative RenderFrameHost.
clamy 2015/04/27 12:05:20 This comment is misleading. If you want to simulat
+ scoped_refptr<ResourceResponse> response(new ResourceResponse);
+ main_loader->CallOnResponseStarted(response, MakeEmptyStream());
+ TestRenderFrameHost* speculative_root_rfh =
+ GetSpeculativeRenderFrameHost(root_node);
+ ASSERT_TRUE(speculative_root_rfh);
+ EXPECT_TRUE(DidRenderFrameHostRequestCommit(speculative_root_rfh));
+
+ // The subframe request is still there as the subframe still exists.
+ ASSERT_TRUE(subframe_node->navigation_request());
}
// PlzNavigate: Test that committing an HTTP 204 or HTTP 205 response cancels
« no previous file with comments | « no previous file | content/browser/frame_host/render_frame_host_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698