OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/browser/frame_host/render_frame_host_manager.h" | 5 #include "content/browser/frame_host/render_frame_host_manager.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <tuple> | 9 #include <tuple> |
10 #include <utility> | 10 #include <utility> |
(...skipping 1246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1257 rfh1->GetSiteInstance()->IncrementActiveFrameCount(); | 1257 rfh1->GetSiteInstance()->IncrementActiveFrameCount(); |
1258 | 1258 |
1259 contents()->NavigateAndCommit(kUrl2); | 1259 contents()->NavigateAndCommit(kUrl2); |
1260 TestRenderFrameHost* rfh2 = main_test_rfh(); | 1260 TestRenderFrameHost* rfh2 = main_test_rfh(); |
1261 rfh2->GetSiteInstance()->IncrementActiveFrameCount(); | 1261 rfh2->GetSiteInstance()->IncrementActiveFrameCount(); |
1262 | 1262 |
1263 // Now go back, but suppose the SwapOut_ACK isn't received. This shouldn't | 1263 // Now go back, but suppose the SwapOut_ACK isn't received. This shouldn't |
1264 // happen, but we have seen it when going back quickly across many entries | 1264 // happen, but we have seen it when going back quickly across many entries |
1265 // (http://crbug.com/93427). | 1265 // (http://crbug.com/93427). |
1266 contents()->GetController().GoBack(); | 1266 contents()->GetController().GoBack(); |
| 1267 EXPECT_TRUE(rfh2->is_waiting_for_beforeunload_ack()); |
1267 contents()->GetMainFrame()->PrepareForCommit(); | 1268 contents()->GetMainFrame()->PrepareForCommit(); |
| 1269 EXPECT_FALSE(rfh2->is_waiting_for_beforeunload_ack()); |
1268 | 1270 |
1269 // The back navigation commits. | 1271 // The back navigation commits. |
1270 const NavigationEntry* entry1 = contents()->GetController().GetPendingEntry(); | 1272 const NavigationEntry* entry1 = contents()->GetController().GetPendingEntry(); |
1271 contents()->GetPendingMainFrame()->SendNavigate( | 1273 contents()->GetPendingMainFrame()->SendNavigate( |
1272 entry1->GetUniqueID(), false, entry1->GetURL()); | 1274 entry1->GetUniqueID(), false, entry1->GetURL()); |
1273 EXPECT_TRUE(rfh2->IsWaitingForUnloadACK()); | 1275 EXPECT_TRUE(rfh2->IsWaitingForUnloadACK()); |
1274 EXPECT_FALSE(rfh2->is_active()); | 1276 EXPECT_FALSE(rfh2->is_active()); |
1275 | 1277 |
1276 // We should be able to navigate forward. | 1278 // We should be able to navigate forward. |
1277 contents()->GetController().GoForward(); | 1279 contents()->GetController().GoForward(); |
(...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1875 CancelPendingProperlyDeletesOrSwaps) { | 1877 CancelPendingProperlyDeletesOrSwaps) { |
1876 const GURL kUrl1("http://www.google.com/"); | 1878 const GURL kUrl1("http://www.google.com/"); |
1877 const GURL kUrl2("http://www.chromium.org/"); | 1879 const GURL kUrl2("http://www.chromium.org/"); |
1878 RenderFrameHostImpl* pending_rfh = NULL; | 1880 RenderFrameHostImpl* pending_rfh = NULL; |
1879 base::TimeTicks now = base::TimeTicks::Now(); | 1881 base::TimeTicks now = base::TimeTicks::Now(); |
1880 | 1882 |
1881 // Navigate to the first page. | 1883 // Navigate to the first page. |
1882 contents()->NavigateAndCommit(kUrl1); | 1884 contents()->NavigateAndCommit(kUrl1); |
1883 TestRenderFrameHost* rfh1 = main_test_rfh(); | 1885 TestRenderFrameHost* rfh1 = main_test_rfh(); |
1884 EXPECT_TRUE(rfh1->is_active()); | 1886 EXPECT_TRUE(rfh1->is_active()); |
1885 rfh1->set_has_beforeunload_handlers(); | |
1886 | 1887 |
1887 // Navigate to a new site, starting a cross-site navigation. | 1888 // Navigate to a new site, starting a cross-site navigation. |
1888 controller().LoadURL( | 1889 controller().LoadURL( |
1889 kUrl2, Referrer(), ui::PAGE_TRANSITION_LINK, std::string()); | 1890 kUrl2, Referrer(), ui::PAGE_TRANSITION_LINK, std::string()); |
1890 { | 1891 { |
1891 pending_rfh = contents()->GetPendingMainFrame(); | 1892 pending_rfh = contents()->GetPendingMainFrame(); |
1892 RenderFrameDeletedObserver rfh_deleted_observer(pending_rfh); | 1893 RenderFrameDeletedObserver rfh_deleted_observer(pending_rfh); |
1893 | 1894 |
1894 // Cancel the navigation by simulating a declined beforeunload dialog. | 1895 // Cancel the navigation by simulating a declined beforeunload dialog. |
1895 contents()->GetMainFrame()->OnMessageReceived( | 1896 contents()->GetMainFrame()->OnMessageReceived( |
(...skipping 1255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3151 ASSERT_FALSE(delete_observer.deleted()); | 3152 ASSERT_FALSE(delete_observer.deleted()); |
3152 EXPECT_FALSE(initial_rfh->is_active()); | 3153 EXPECT_FALSE(initial_rfh->is_active()); |
3153 | 3154 |
3154 // The initial RFH receives a DidStartProvisionalLoad IPC. It should not | 3155 // The initial RFH receives a DidStartProvisionalLoad IPC. It should not |
3155 // create a NavigationHandle. | 3156 // create a NavigationHandle. |
3156 initial_rfh->SimulateNavigationStart(kUrl3); | 3157 initial_rfh->SimulateNavigationStart(kUrl3); |
3157 EXPECT_FALSE(initial_rfh->navigation_handle()); | 3158 EXPECT_FALSE(initial_rfh->navigation_handle()); |
3158 } | 3159 } |
3159 | 3160 |
3160 } // namespace content | 3161 } // namespace content |
OLD | NEW |