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 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
356 // Use an observer to avoid accessing a deleted renderer later on when the | 356 // Use an observer to avoid accessing a deleted renderer later on when the |
357 // state is being checked. | 357 // state is being checked. |
358 RenderFrameDeletedObserver rfh_observer(old_rfh); | 358 RenderFrameDeletedObserver rfh_observer(old_rfh); |
359 RenderViewHostDeletedObserver rvh_observer(old_rfh->GetRenderViewHost()); | 359 RenderViewHostDeletedObserver rvh_observer(old_rfh->GetRenderViewHost()); |
360 active_rfh->SendNavigate(max_page_id + 1, entry_id, true, url); | 360 active_rfh->SendNavigate(max_page_id + 1, entry_id, true, url); |
361 | 361 |
362 // Make sure that we start to run the unload handler at the time of commit. | 362 // Make sure that we start to run the unload handler at the time of commit. |
363 if (old_rfh != active_rfh && !rfh_observer.deleted()) { | 363 if (old_rfh != active_rfh && !rfh_observer.deleted()) { |
364 EXPECT_EQ(RenderFrameHostImpl::STATE_PENDING_SWAP_OUT, | 364 EXPECT_EQ(RenderFrameHostImpl::STATE_PENDING_SWAP_OUT, |
365 old_rfh->rfh_state()); | 365 old_rfh->rfh_state()); |
366 EXPECT_TRUE( | |
367 old_rfh->frame_tree_node()->render_manager()->IsPendingDeletion( | |
368 old_rfh)); | |
369 } | 366 } |
370 | 367 |
371 // Simulate the swap out ACK coming from the pending renderer. This should | 368 // Simulate the swap out ACK coming from the pending renderer. This should |
372 // either shut down the old RFH or leave it in a swapped out state. | 369 // either shut down the old RFH or leave it in a swapped out state. |
373 if (old_rfh != active_rfh) { | 370 if (old_rfh != active_rfh) { |
374 old_rfh->OnSwappedOut(); | 371 old_rfh->OnSwappedOut(); |
375 EXPECT_TRUE(rfh_observer.deleted()); | 372 EXPECT_TRUE(rfh_observer.deleted()); |
376 } | 373 } |
377 EXPECT_EQ(active_rfh, contents()->GetMainFrame()); | 374 EXPECT_EQ(active_rfh, contents()->GetMainFrame()); |
378 EXPECT_EQ(NULL, contents()->GetPendingMainFrame()); | 375 EXPECT_EQ(NULL, contents()->GetPendingMainFrame()); |
(...skipping 1406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1785 EXPECT_EQ(RenderFrameHostImpl::STATE_DEFAULT, rfh1->rfh_state()); | 1782 EXPECT_EQ(RenderFrameHostImpl::STATE_DEFAULT, rfh1->rfh_state()); |
1786 | 1783 |
1787 // The new page commits. | 1784 // The new page commits. |
1788 contents()->TestDidNavigate(rfh2, 1, entry_id, true, kUrl2, | 1785 contents()->TestDidNavigate(rfh2, 1, entry_id, true, kUrl2, |
1789 ui::PAGE_TRANSITION_TYPED); | 1786 ui::PAGE_TRANSITION_TYPED); |
1790 EXPECT_FALSE(contents()->CrossProcessNavigationPending()); | 1787 EXPECT_FALSE(contents()->CrossProcessNavigationPending()); |
1791 EXPECT_EQ(rfh2, contents()->GetMainFrame()); | 1788 EXPECT_EQ(rfh2, contents()->GetMainFrame()); |
1792 EXPECT_TRUE(contents()->GetPendingMainFrame() == NULL); | 1789 EXPECT_TRUE(contents()->GetPendingMainFrame() == NULL); |
1793 EXPECT_EQ(RenderFrameHostImpl::STATE_DEFAULT, rfh2->rfh_state()); | 1790 EXPECT_EQ(RenderFrameHostImpl::STATE_DEFAULT, rfh2->rfh_state()); |
1794 EXPECT_EQ(RenderFrameHostImpl::STATE_PENDING_SWAP_OUT, rfh1->rfh_state()); | 1791 EXPECT_EQ(RenderFrameHostImpl::STATE_PENDING_SWAP_OUT, rfh1->rfh_state()); |
1795 EXPECT_TRUE( | |
1796 rfh1->frame_tree_node()->render_manager()->IsPendingDeletion(rfh1)); | |
1797 | 1792 |
1798 // Simulate the swap out ack. | 1793 // Simulate the swap out ack. |
1799 rfh1->OnSwappedOut(); | 1794 rfh1->OnSwappedOut(); |
1800 | 1795 |
1801 // rfh1 should have been deleted. | 1796 // rfh1 should have been deleted. |
1802 EXPECT_TRUE(rfh_deleted_observer.deleted()); | 1797 EXPECT_TRUE(rfh_deleted_observer.deleted()); |
1803 rfh1 = NULL; | 1798 rfh1 = NULL; |
1804 } | 1799 } |
1805 | 1800 |
1806 // Tests that the RenderFrameHost is properly swapped out when the SwapOut ACK | 1801 // Tests that the RenderFrameHost is properly swapped out when the SwapOut ACK |
(...skipping 1300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3107 commit_params.should_enforce_strict_mixed_content_checking = false; | 3102 commit_params.should_enforce_strict_mixed_content_checking = false; |
3108 child_host->SendNavigateWithParams(&commit_params); | 3103 child_host->SendNavigateWithParams(&commit_params); |
3109 EXPECT_NO_FATAL_FAILURE(CheckMixedContentIPC( | 3104 EXPECT_NO_FATAL_FAILURE(CheckMixedContentIPC( |
3110 main_test_rfh(), false, proxy_to_parent->GetRoutingID())); | 3105 main_test_rfh(), false, proxy_to_parent->GetRoutingID())); |
3111 EXPECT_FALSE(root->child_at(0) | 3106 EXPECT_FALSE(root->child_at(0) |
3112 ->current_replication_state() | 3107 ->current_replication_state() |
3113 .should_enforce_strict_mixed_content_checking); | 3108 .should_enforce_strict_mixed_content_checking); |
3114 } | 3109 } |
3115 | 3110 |
3116 } // namespace content | 3111 } // namespace content |
OLD | NEW |