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

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

Issue 2783723002: Keep track in the browser of which frames have onunload and onbeforeunload handlers. (Closed)
Patch Set: fix content_browsertests with plznavigate and also remove now unnecessary unloadcontroller change Created 3 years, 9 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 0d2f9b0f29c1790237b866dece5c8c94d5dc91f7..dd68bf558ed86384c43a5b4c7fa0a1865c96a8a5 100644
--- a/content/browser/frame_host/navigator_impl_unittest.cc
+++ b/content/browser/frame_host/navigator_impl_unittest.cc
@@ -269,6 +269,7 @@ TEST_F(NavigatorTestWithBrowserSideNavigation,
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();
@@ -307,14 +308,8 @@ TEST_F(NavigatorTestWithBrowserSideNavigation, BeginNavigation) {
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);
nasko 2017/03/29 23:31:26 Aren't we losing coverage for a beforeunload handl
jam 2017/03/30 14:53:22 we already have test cases for this, i.e. all the
TestNavigationURLLoader* subframe_loader =
GetLoaderForNavigationRequest(subframe_request);
ASSERT_TRUE(subframe_loader);
@@ -341,15 +336,11 @@ TEST_F(NavigatorTestWithBrowserSideNavigation, BeginNavigation) {
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);

Powered by Google App Engine
This is Rietveld 408576698