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

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

Issue 2803633004: Revert of Keep track in the browser of which frames have onunload and onbeforeunload handlers. (Closed)
Patch Set: Created 3 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
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);
« no previous file with comments | « content/browser/frame_host/navigation_request.cc ('k') | content/browser/frame_host/render_frame_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698