Index: content/browser/web_contents/web_contents_impl_unittest.cc |
diff --git a/content/browser/web_contents/web_contents_impl_unittest.cc b/content/browser/web_contents/web_contents_impl_unittest.cc |
index f9dcf5daa5d11009b61dc73c7b1a1476139c11a5..08f23f69226c2acd069abe0c0b3085ecabd1adb3 100644 |
--- a/content/browser/web_contents/web_contents_impl_unittest.cc |
+++ b/content/browser/web_contents/web_contents_impl_unittest.cc |
@@ -550,13 +550,6 @@ TEST_F(WebContentsImplTest, CrossSiteBoundaries) { |
pending_rfh->GetRenderViewHost()->set_delete_counter( |
&pending_rvh_delete_count); |
- // Navigations should be suspended in pending_rfh until BeforeUnloadACK. |
- if (!IsBrowserSideNavigationEnabled()) { |
- EXPECT_TRUE(pending_rfh->are_navigations_suspended()); |
- orig_rfh->SendBeforeUnloadACK(true); |
- EXPECT_FALSE(pending_rfh->are_navigations_suspended()); |
- } |
- |
// DidNavigate from the pending page |
contents()->TestDidNavigateWithSequenceNumber( |
pending_rfh, entry_id, true, url2, Referrer(), ui::PAGE_TRANSITION_TYPED, |
@@ -589,13 +582,6 @@ TEST_F(WebContentsImplTest, CrossSiteBoundaries) { |
TestRenderFrameHost* goback_rfh = contents()->GetPendingMainFrame(); |
EXPECT_TRUE(contents()->CrossProcessNavigationPending()); |
- // Navigations should be suspended in goback_rfh until BeforeUnloadACK. |
- if (!IsBrowserSideNavigationEnabled()) { |
- EXPECT_TRUE(goback_rfh->are_navigations_suspended()); |
- pending_rfh->SendBeforeUnloadACK(true); |
- EXPECT_FALSE(goback_rfh->are_navigations_suspended()); |
- } |
- |
// DidNavigate from the back action |
contents()->TestDidNavigateWithSequenceNumber( |
goback_rfh, entry_id, false, url2, Referrer(), ui::PAGE_TRANSITION_TYPED, |
@@ -803,13 +789,6 @@ TEST_F(WebContentsImplTest, NavigateFromSitelessUrl) { |
pending_rfh->GetRenderViewHost()->set_delete_counter( |
&pending_rvh_delete_count); |
- // Navigations should be suspended in pending_rvh until BeforeUnloadACK. |
- if (!IsBrowserSideNavigationEnabled()) { |
- EXPECT_TRUE(pending_rfh->are_navigations_suspended()); |
- orig_rfh->SendBeforeUnloadACK(true); |
- EXPECT_FALSE(pending_rfh->are_navigations_suspended()); |
- } |
- |
// DidNavigate from the pending page. |
contents()->TestDidNavigate(pending_rfh, entry_id, true, url2, |
ui::PAGE_TRANSITION_TYPED); |
@@ -1052,6 +1031,7 @@ TEST_F(WebContentsImplTest, CrossSiteUnloadHandlers) { |
controller().LoadURL( |
url, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); |
int entry_id = controller().GetPendingEntry()->GetUniqueID(); |
+ main_test_rfh()->set_has_beforeunload_handlers(); |
main_test_rfh()->PrepareForCommit(); |
contents()->TestDidNavigate(orig_rfh, entry_id, true, url, |
ui::PAGE_TRANSITION_TYPED); |
@@ -1115,8 +1095,6 @@ TEST_F(WebContentsImplTest, CrossSiteNavigationPreempted) { |
const GURL url2("http://www.yahoo.com"); |
controller().LoadURL( |
url2, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); |
- EXPECT_TRUE(orig_rfh->is_waiting_for_beforeunload_ack()); |
- orig_rfh->PrepareForCommit(); |
EXPECT_TRUE(contents()->CrossProcessNavigationPending()); |
// Suppose the original renderer navigates before the new one is ready. |
@@ -1165,10 +1143,6 @@ TEST_F(WebContentsImplTest, CrossSiteNavigationBackPreempted) { |
EXPECT_TRUE(contents()->CrossProcessNavigationPending()); |
TestRenderFrameHost* google_rfh = contents()->GetPendingMainFrame(); |
- // Simulate beforeunload approval. |
- EXPECT_TRUE(webui_rfh->is_waiting_for_beforeunload_ack()); |
- webui_rfh->PrepareForCommit(); |
- |
// DidNavigate from the pending page. |
contents()->TestDidNavigateWithSequenceNumber( |
google_rfh, entry_id, true, url2, Referrer(), ui::PAGE_TRANSITION_TYPED, |
@@ -1218,13 +1192,6 @@ TEST_F(WebContentsImplTest, CrossSiteNavigationBackPreempted) { |
EXPECT_TRUE(contents()->GetPendingMainFrame()); |
EXPECT_EQ(entry1, controller().GetPendingEntry()); |
- // Simulate beforeunload approval. |
- EXPECT_TRUE(google_rfh->is_waiting_for_beforeunload_ack()); |
- base::TimeTicks now = base::TimeTicks::Now(); |
- google_rfh->PrepareForCommit(); |
- google_rfh->OnMessageReceived( |
- FrameHostMsg_BeforeUnload_ACK(0, true, now, now)); |
- |
// DidNavigate from the first back. This aborts the second back's pending RFH. |
contents()->TestDidNavigateWithSequenceNumber( |
google_rfh, goback_entry->GetUniqueID(), false, url2, Referrer(), |
@@ -1277,10 +1244,6 @@ TEST_F(WebContentsImplTest, CrossSiteNavigationBackOldNavigationIgnored) { |
EXPECT_TRUE(contents()->CrossProcessNavigationPending()); |
TestRenderFrameHost* google_rfh = contents()->GetPendingMainFrame(); |
- // Simulate beforeunload approval. |
- EXPECT_TRUE(webui_rfh->is_waiting_for_beforeunload_ack()); |
- webui_rfh->PrepareForCommit(); |
- |
// DidNavigate from the pending page. |
contents()->TestDidNavigate(google_rfh, entry_id, true, url2, |
ui::PAGE_TRANSITION_TYPED); |
@@ -1368,12 +1331,8 @@ TEST_F(WebContentsImplTest, CrossSiteNavigationNotPreemptedByFrame) { |
child_rfh->SendNavigateWithTransition(0, false, |
GURL("http://google.com/frame"), |
ui::PAGE_TRANSITION_AUTO_SUBFRAME); |
- EXPECT_TRUE(orig_rfh->is_waiting_for_beforeunload_ack()); |
- // Now simulate the onbeforeunload approval and verify the navigation is |
- // not canceled. |
- orig_rfh->PrepareForCommit(); |
- EXPECT_FALSE(orig_rfh->is_waiting_for_beforeunload_ack()); |
+ // Verify the navigation is not canceled. |
EXPECT_TRUE(contents()->CrossProcessNavigationPending()); |
} |
@@ -1394,6 +1353,7 @@ TEST_F(WebContentsImplTest, CrossSiteNotPreemptedDuringBeforeUnload) { |
url, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); |
int entry1_id = controller().GetPendingEntry()->GetUniqueID(); |
TestRenderFrameHost* orig_rfh = main_test_rfh(); |
+ orig_rfh->set_has_beforeunload_handlers(); |
orig_rfh->PrepareForCommit(); |
EXPECT_FALSE(contents()->CrossProcessNavigationPending()); |