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

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

Issue 2655433002: Execute BeforeUnload on subframe browser-initiated navigations (Closed)
Patch Set: Rebase Created 3 years, 11 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_impl.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 b828ab1864add9e5c8ffedf13cb307bc2fb5281a..81dda4549471434e14c63470d9743f503e6e20ca 100644
--- a/content/browser/frame_host/navigator_impl_unittest.cc
+++ b/content/browser/frame_host/navigator_impl_unittest.cc
@@ -306,12 +306,17 @@ TEST_F(NavigatorTestWithBrowserSideNavigation, BeginNavigation) {
FrameTreeNode* subframe_node = subframe_rfh->frame_tree_node();
RequestNavigation(subframe_node, kUrl2);
NavigationRequest* subframe_request = subframe_node->navigation_request();
- TestNavigationURLLoader* subframe_loader =
- GetLoaderForNavigationRequest(subframe_request);
- // Subframe navigations should start right away as they don't have to request
- // beforeUnload to run at the renderer.
+ // 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);
EXPECT_EQ(NavigationRequest::STARTED, subframe_request->state());
EXPECT_EQ(kUrl2, subframe_request->common_params().url);
« no previous file with comments | « no previous file | content/browser/frame_host/render_frame_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698