| 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 1515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1526 | 1526 |
| 1527 // Expect the swapped out RVH to exist but not be live. | 1527 // Expect the swapped out RVH to exist but not be live. |
| 1528 EXPECT_TRUE( | 1528 EXPECT_TRUE( |
| 1529 opener1_manager->GetSwappedOutRenderViewHost(rfh1->GetSiteInstance())); | 1529 opener1_manager->GetSwappedOutRenderViewHost(rfh1->GetSiteInstance())); |
| 1530 EXPECT_FALSE( | 1530 EXPECT_FALSE( |
| 1531 opener1_manager->GetSwappedOutRenderViewHost(rfh1->GetSiteInstance()) | 1531 opener1_manager->GetSwappedOutRenderViewHost(rfh1->GetSiteInstance()) |
| 1532 ->IsRenderViewLive()); | 1532 ->IsRenderViewLive()); |
| 1533 | 1533 |
| 1534 // Reload the initial tab. This should recreate the opener's swapped out RVH | 1534 // Reload the initial tab. This should recreate the opener's swapped out RVH |
| 1535 // in the original SiteInstance. | 1535 // in the original SiteInstance. |
| 1536 contents()->GetController().Reload(true); | 1536 contents()->GetController().Reload(ReloadType::NORMAL, true); |
| 1537 contents()->GetMainFrame()->PrepareForCommit(); | 1537 contents()->GetMainFrame()->PrepareForCommit(); |
| 1538 EXPECT_TRUE( | 1538 EXPECT_TRUE( |
| 1539 opener1_manager->GetSwappedOutRenderViewHost(rfh1->GetSiteInstance()) | 1539 opener1_manager->GetSwappedOutRenderViewHost(rfh1->GetSiteInstance()) |
| 1540 ->IsRenderViewLive()); | 1540 ->IsRenderViewLive()); |
| 1541 EXPECT_EQ( | 1541 EXPECT_EQ( |
| 1542 opener1_manager->GetRoutingIdForSiteInstance(rfh1->GetSiteInstance()), | 1542 opener1_manager->GetRoutingIdForSiteInstance(rfh1->GetSiteInstance()), |
| 1543 contents()->GetMainFrame()->GetRenderViewHost()->opener_frame_route_id()); | 1543 contents()->GetMainFrame()->GetRenderViewHost()->opener_frame_route_id()); |
| 1544 } | 1544 } |
| 1545 | 1545 |
| 1546 // Test that RenderViewHosts created for WebUI navigations are properly | 1546 // Test that RenderViewHosts created for WebUI navigations are properly |
| (...skipping 1026 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2573 set_should_create_webui(true); | 2573 set_should_create_webui(true); |
| 2574 NavigateActiveAndCommit(GURL("chrome://foo/")); | 2574 NavigateActiveAndCommit(GURL("chrome://foo/")); |
| 2575 | 2575 |
| 2576 RenderFrameHostManager* manager = contents()->GetRenderManagerForTesting(); | 2576 RenderFrameHostManager* manager = contents()->GetRenderManagerForTesting(); |
| 2577 RenderFrameHostImpl* host1 = manager->current_frame_host(); | 2577 RenderFrameHostImpl* host1 = manager->current_frame_host(); |
| 2578 EXPECT_TRUE(host1->IsRenderFrameLive()); | 2578 EXPECT_TRUE(host1->IsRenderFrameLive()); |
| 2579 WebUIImpl* web_ui = host1->web_ui(); | 2579 WebUIImpl* web_ui = host1->web_ui(); |
| 2580 EXPECT_TRUE(web_ui); | 2580 EXPECT_TRUE(web_ui); |
| 2581 | 2581 |
| 2582 // Starts a reload of the WebUI page. | 2582 // Starts a reload of the WebUI page. |
| 2583 contents()->GetController().Reload(true); | 2583 contents()->GetController().Reload(ReloadType::NORMAL, true); |
| 2584 main_test_rfh()->PrepareForCommit(); | 2584 main_test_rfh()->PrepareForCommit(); |
| 2585 | 2585 |
| 2586 // It should be a same-site navigation reusing the same WebUI. | 2586 // It should be a same-site navigation reusing the same WebUI. |
| 2587 EXPECT_EQ(web_ui, manager->GetNavigatingWebUI()); | 2587 EXPECT_EQ(web_ui, manager->GetNavigatingWebUI()); |
| 2588 EXPECT_EQ(web_ui, host1->web_ui()); | 2588 EXPECT_EQ(web_ui, host1->web_ui()); |
| 2589 EXPECT_EQ(web_ui, host1->pending_web_ui()); | 2589 EXPECT_EQ(web_ui, host1->pending_web_ui()); |
| 2590 EXPECT_FALSE(GetPendingFrameHost(manager)); | 2590 EXPECT_FALSE(GetPendingFrameHost(manager)); |
| 2591 | 2591 |
| 2592 // Navigation request to a non-WebUI page. | 2592 // Navigation request to a non-WebUI page. |
| 2593 const GURL kUrl("http://google.com"); | 2593 const GURL kUrl("http://google.com"); |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2665 set_webui_type(1); | 2665 set_webui_type(1); |
| 2666 NavigateActiveAndCommit(GURL("chrome://foo/")); | 2666 NavigateActiveAndCommit(GURL("chrome://foo/")); |
| 2667 | 2667 |
| 2668 RenderFrameHostManager* manager = contents()->GetRenderManagerForTesting(); | 2668 RenderFrameHostManager* manager = contents()->GetRenderManagerForTesting(); |
| 2669 RenderFrameHostImpl* host1 = manager->current_frame_host(); | 2669 RenderFrameHostImpl* host1 = manager->current_frame_host(); |
| 2670 EXPECT_TRUE(host1->IsRenderFrameLive()); | 2670 EXPECT_TRUE(host1->IsRenderFrameLive()); |
| 2671 WebUIImpl* web_ui1 = host1->web_ui(); | 2671 WebUIImpl* web_ui1 = host1->web_ui(); |
| 2672 EXPECT_TRUE(web_ui1); | 2672 EXPECT_TRUE(web_ui1); |
| 2673 | 2673 |
| 2674 // Starts a reload of the WebUI page. | 2674 // Starts a reload of the WebUI page. |
| 2675 contents()->GetController().Reload(true); | 2675 contents()->GetController().Reload(ReloadType::NORMAL, true); |
| 2676 | 2676 |
| 2677 // It should be a same-site navigation reusing the same WebUI. | 2677 // It should be a same-site navigation reusing the same WebUI. |
| 2678 EXPECT_EQ(web_ui1, manager->GetNavigatingWebUI()); | 2678 EXPECT_EQ(web_ui1, manager->GetNavigatingWebUI()); |
| 2679 EXPECT_EQ(web_ui1, host1->web_ui()); | 2679 EXPECT_EQ(web_ui1, host1->web_ui()); |
| 2680 EXPECT_EQ(web_ui1, host1->pending_web_ui()); | 2680 EXPECT_EQ(web_ui1, host1->pending_web_ui()); |
| 2681 EXPECT_FALSE(GetPendingFrameHost(manager)); | 2681 EXPECT_FALSE(GetPendingFrameHost(manager)); |
| 2682 | 2682 |
| 2683 // Navigation another WebUI page, with a different type. | 2683 // Navigation another WebUI page, with a different type. |
| 2684 set_webui_type(2); | 2684 set_webui_type(2); |
| 2685 const GURL kUrl("chrome://bar/"); | 2685 const GURL kUrl("chrome://bar/"); |
| (...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3148 ASSERT_FALSE(delete_observer.deleted()); | 3148 ASSERT_FALSE(delete_observer.deleted()); |
| 3149 EXPECT_FALSE(initial_rfh->is_active()); | 3149 EXPECT_FALSE(initial_rfh->is_active()); |
| 3150 | 3150 |
| 3151 // The initial RFH receives a DidStartProvisionalLoad IPC. It should not | 3151 // The initial RFH receives a DidStartProvisionalLoad IPC. It should not |
| 3152 // create a NavigationHandle. | 3152 // create a NavigationHandle. |
| 3153 initial_rfh->SimulateNavigationStart(kUrl3); | 3153 initial_rfh->SimulateNavigationStart(kUrl3); |
| 3154 EXPECT_FALSE(initial_rfh->navigation_handle()); | 3154 EXPECT_FALSE(initial_rfh->navigation_handle()); |
| 3155 } | 3155 } |
| 3156 | 3156 |
| 3157 } // namespace content | 3157 } // namespace content |
| OLD | NEW |