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

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

Issue 903043002: Skip BeforeUnload on cross-site navigations when there are no handlers Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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 e31ce22eb170c76e91378ca9d111bec52f4da125..beffa529ba07649b350c51bd931c8e7837320f65 100644
--- a/content/browser/frame_host/navigator_impl_unittest.cc
+++ b/content/browser/frame_host/navigator_impl_unittest.cc
@@ -200,6 +200,7 @@ TEST_F(NavigatorTestWithBrowserSideNavigation,
const GURL kUrl2("http://www.chromium.org/");
contents()->NavigateAndCommit(kUrl1);
+ main_test_rfh()->SendBeforeUnloadHandlersPresent(true);
// Start a new navigation.
FrameTreeNode* node = main_test_rfh()->frame_tree_node();
@@ -267,12 +268,7 @@ TEST_F(NavigatorTestWithBrowserSideNavigation, BeginNavigation) {
NavigationRequest* main_request =
GetNavigationRequestForFrameTreeNode(root_node);
ASSERT_TRUE(main_request);
- EXPECT_EQ(NavigationRequest::WAITING_FOR_RENDERER_RESPONSE,
- main_request->state());
- EXPECT_FALSE(GetSpeculativeRenderFrameHost(root_node));
-
- // Simulate a BeforeUnloadACK IPC on the main frame.
- main_test_rfh()->SendBeforeUnloadACK(true);
Charlie Reis 2015/02/17 23:04:31 We should include a PlzNavigate test for the case
clamy 2015/02/18 13:27:23 I added a test to check that we properly wait befo
Charlie Reis 2015/02/19 00:33:44 Acknowledged.
+ EXPECT_EQ(NavigationRequest::STARTED, main_request->state());
TestNavigationURLLoader* main_loader =
GetLoaderForNavigationRequest(main_request);
EXPECT_EQ(kUrl3, main_request->common_params().url);
@@ -281,9 +277,6 @@ TEST_F(NavigatorTestWithBrowserSideNavigation, BeginNavigation) {
EXPECT_TRUE(main_loader->request_info()->is_main_frame);
EXPECT_FALSE(main_loader->request_info()->parent_is_main_frame);
EXPECT_TRUE(main_request->browser_initiated());
- // BeforeUnloadACK was received from the renderer so the navigation should
- // have started.
- EXPECT_EQ(NavigationRequest::STARTED, main_request->state());
// Main frame navigation to a different site should use a speculative
// RenderFrameHost.
@@ -698,7 +691,6 @@ TEST_F(NavigatorTestWithBrowserSideNavigation,
->sink()
.ClearMessages();
RequestNavigation(node, kUrl1);
- main_test_rfh()->SendBeforeUnloadACK(true);
EXPECT_EQ(rfh1, GetSpeculativeRenderFrameHost(node));
EXPECT_NE(RenderFrameHostImpl::STATE_DEFAULT,
GetSpeculativeRenderFrameHost(node)->rfh_state());

Powered by Google App Engine
This is Rietveld 408576698