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 f8069f526fb74391a0d02ab6efb8e9ed30a98633..5936bded42b2aa3a4555f16cd85a0b158436ef85 100644 |
--- a/content/browser/frame_host/navigator_impl_unittest.cc |
+++ b/content/browser/frame_host/navigator_impl_unittest.cc |
@@ -274,9 +274,12 @@ TEST_F(NavigatorTestWithBrowserSideNavigation, BeginNavigation) { |
const GURL kUrl3("http://www.gmail.com/"); |
contents()->NavigateAndCommit(kUrl1); |
+ process()->sink().ClearMessages(); |
// Add a subframe. |
FrameTreeNode* root_node = contents()->GetFrameTree()->root(); |
+ NavigatorImpl* navigator = |
+ static_cast<NavigatorImpl*>(root_node->navigator()); |
TestRenderFrameHost* subframe_rfh = main_test_rfh()->AppendChild("Child"); |
ASSERT_TRUE(subframe_rfh); |
@@ -284,7 +287,7 @@ TEST_F(NavigatorTestWithBrowserSideNavigation, BeginNavigation) { |
FrameTreeNode* subframe_node = subframe_rfh->frame_tree_node(); |
RequestNavigation(subframe_node, kUrl2); |
NavigationRequest* subframe_request = |
- GetNavigationRequestForFrameTreeNode(subframe_node); |
+ navigator->GetNavigationRequestForNodeForTesting(subframe_node); |
TestNavigationURLLoader* subframe_loader = |
GetLoaderForNavigationRequest(subframe_request); |
@@ -315,7 +318,7 @@ TEST_F(NavigatorTestWithBrowserSideNavigation, BeginNavigation) { |
// Now start a navigation at the root node. |
RequestNavigation(root_node, kUrl3); |
NavigationRequest* main_request = |
- GetNavigationRequestForFrameTreeNode(root_node); |
+ navigator->GetNavigationRequestForNodeForTesting(root_node); |
ASSERT_TRUE(main_request); |
EXPECT_EQ(NavigationRequest::WAITING_FOR_RENDERER_RESPONSE, |
main_request->state()); |
@@ -341,12 +344,31 @@ 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(navigator->GetNavigationRequestForNodeForTesting(subframe_node)); |
if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
switches::kSitePerProcess)) { |
EXPECT_TRUE(GetSpeculativeRenderFrameHost(subframe_node)); |
} else { |
EXPECT_FALSE(GetSpeculativeRenderFrameHost(subframe_node)); |
} |
+ |
+ // Have the root node's speculative RenderFrameHost commit the navigation. |
+ 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)); |
+ EXPECT_FALSE(DidRenderFrameHostRequestCommit(main_test_rfh())); |
+ |
+ // The subframe request is still there as the subframe still exists. |
+ ASSERT_TRUE(navigator->GetNavigationRequestForNodeForTesting(subframe_node)); |
+ |
+ // Commit the navigation. |
+ speculative_root_rfh->SendNavigate(1, kUrl3); |
+ |
+ // The subframe request should have been cleaned up with the subframe. |
+ ASSERT_FALSE(navigator->GetNavigationRequestForNodeForTesting(subframe_node)); |
carlosk
2015/04/08 09:01:48
As I removed the N::CancelNavigation from FTN::~Fr
clamy
2015/04/08 11:29:11
Well since it's failing they are not.
carlosk
2015/04/08 16:05:39
Yeah. It did pass on my workstation but I only tes
|
} |
// PlzNavigate: Test that committing an HTTP 204 or HTTP 205 response cancels |