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 dd68bf558ed86384c43a5b4c7fa0a1865c96a8a5..0d2f9b0f29c1790237b866dece5c8c94d5dc91f7 100644 |
--- a/content/browser/frame_host/navigator_impl_unittest.cc |
+++ b/content/browser/frame_host/navigator_impl_unittest.cc |
@@ -269,7 +269,6 @@ |
const GURL kUrl2("http://www.chromium.org/"); |
contents()->NavigateAndCommit(kUrl1); |
- main_test_rfh()->set_has_beforeunload_handlers(); |
// Start a new navigation. |
FrameTreeNode* node = main_test_rfh()->frame_tree_node(); |
@@ -308,8 +307,14 @@ |
RequestNavigation(subframe_node, kUrl2); |
NavigationRequest* subframe_request = subframe_node->navigation_request(); |
+ // We should be waiting for the BeforeUnload event to execute in the subframe. |
ASSERT_TRUE(subframe_request); |
- |
+ EXPECT_EQ(NavigationRequest::WAITING_FOR_RENDERER_RESPONSE, |
+ subframe_request->state()); |
+ EXPECT_TRUE(subframe_rfh->is_waiting_for_beforeunload_ack()); |
+ |
+ // Simulate the BeforeUnload ACK. The navigation should start. |
+ subframe_rfh->SendBeforeUnloadACK(true); |
TestNavigationURLLoader* subframe_loader = |
GetLoaderForNavigationRequest(subframe_request); |
ASSERT_TRUE(subframe_loader); |
@@ -336,11 +341,15 @@ |
RequestNavigation(root_node, kUrl3); |
NavigationRequest* main_request = root_node->navigation_request(); |
ASSERT_TRUE(main_request); |
+ EXPECT_EQ(NavigationRequest::WAITING_FOR_RENDERER_RESPONSE, |
+ main_request->state()); |
// Main frame navigation to a different site should use a speculative |
// RenderFrameHost. |
EXPECT_TRUE(GetSpeculativeRenderFrameHost(root_node)); |
+ // Simulate a BeforeUnloadACK IPC on the main frame. |
+ main_test_rfh()->SendBeforeUnloadACK(true); |
TestNavigationURLLoader* main_loader = |
GetLoaderForNavigationRequest(main_request); |
EXPECT_EQ(kUrl3, main_request->common_params().url); |