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 1050 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1061 scoped_refptr<SiteInstance> blank_instance = | 1061 scoped_refptr<SiteInstance> blank_instance = |
1062 SiteInstance::Create(browser_context()); | 1062 SiteInstance::Create(browser_context()); |
1063 blank_instance->GetProcess()->Init(); | 1063 blank_instance->GetProcess()->Init(); |
1064 | 1064 |
1065 // Create a blank tab. | 1065 // Create a blank tab. |
1066 scoped_ptr<TestWebContents> web_contents1( | 1066 scoped_ptr<TestWebContents> web_contents1( |
1067 TestWebContents::Create(browser_context(), blank_instance)); | 1067 TestWebContents::Create(browser_context(), blank_instance)); |
1068 RenderFrameHostManager* manager1 = | 1068 RenderFrameHostManager* manager1 = |
1069 web_contents1->GetRenderManagerForTesting(); | 1069 web_contents1->GetRenderManagerForTesting(); |
1070 // Test the case that new RVH is considered live. | 1070 // Test the case that new RVH is considered live. |
1071 manager1->current_host()->CreateRenderView(-1, MSG_ROUTING_NONE, -1, | 1071 manager1->current_host()->CreateRenderView( |
1072 FrameReplicationState(), false); | 1072 -1, MSG_ROUTING_NONE, -1, FrameReplicationState(), false, 0.0); |
1073 EXPECT_TRUE(manager1->current_host()->IsRenderViewLive()); | 1073 EXPECT_TRUE(manager1->current_host()->IsRenderViewLive()); |
1074 EXPECT_TRUE(manager1->current_frame_host()->IsRenderFrameLive()); | 1074 EXPECT_TRUE(manager1->current_frame_host()->IsRenderFrameLive()); |
1075 | 1075 |
1076 // Navigate to a WebUI page. | 1076 // Navigate to a WebUI page. |
1077 const GURL kUrl1("chrome://foo"); | 1077 const GURL kUrl1("chrome://foo"); |
1078 NavigationEntryImpl entry1(NULL /* instance */, -1 /* page_id */, kUrl1, | 1078 NavigationEntryImpl entry1(NULL /* instance */, -1 /* page_id */, kUrl1, |
1079 Referrer(), base::string16() /* title */, | 1079 Referrer(), base::string16() /* title */, |
1080 ui::PAGE_TRANSITION_TYPED, | 1080 ui::PAGE_TRANSITION_TYPED, |
1081 false /* is_renderer_init */); | 1081 false /* is_renderer_init */); |
1082 RenderFrameHostImpl* host1 = NavigateToEntry(manager1, entry1); | 1082 RenderFrameHostImpl* host1 = NavigateToEntry(manager1, entry1); |
(...skipping 12 matching lines...) Expand all Loading... |
1095 EXPECT_TRUE( | 1095 EXPECT_TRUE( |
1096 host1->render_view_host()->GetEnabledBindings() & BINDINGS_POLICY_WEB_UI); | 1096 host1->render_view_host()->GetEnabledBindings() & BINDINGS_POLICY_WEB_UI); |
1097 | 1097 |
1098 // Now simulate clicking a link that opens in a new tab. | 1098 // Now simulate clicking a link that opens in a new tab. |
1099 scoped_ptr<TestWebContents> web_contents2( | 1099 scoped_ptr<TestWebContents> web_contents2( |
1100 TestWebContents::Create(browser_context(), webui_instance)); | 1100 TestWebContents::Create(browser_context(), webui_instance)); |
1101 RenderFrameHostManager* manager2 = | 1101 RenderFrameHostManager* manager2 = |
1102 web_contents2->GetRenderManagerForTesting(); | 1102 web_contents2->GetRenderManagerForTesting(); |
1103 // Make sure the new RVH is considered live. This is usually done in | 1103 // Make sure the new RVH is considered live. This is usually done in |
1104 // RenderWidgetHost::Init when opening a new tab from a link. | 1104 // RenderWidgetHost::Init when opening a new tab from a link. |
1105 manager2->current_host()->CreateRenderView(-1, MSG_ROUTING_NONE, -1, | 1105 manager2->current_host()->CreateRenderView( |
1106 FrameReplicationState(), false); | 1106 -1, MSG_ROUTING_NONE, -1, FrameReplicationState(), false, 0.0); |
1107 EXPECT_TRUE(manager2->current_host()->IsRenderViewLive()); | 1107 EXPECT_TRUE(manager2->current_host()->IsRenderViewLive()); |
1108 | 1108 |
1109 const GURL kUrl2("chrome://foo/bar"); | 1109 const GURL kUrl2("chrome://foo/bar"); |
1110 NavigationEntryImpl entry2(NULL /* instance */, -1 /* page_id */, kUrl2, | 1110 NavigationEntryImpl entry2(NULL /* instance */, -1 /* page_id */, kUrl2, |
1111 Referrer(), base::string16() /* title */, | 1111 Referrer(), base::string16() /* title */, |
1112 ui::PAGE_TRANSITION_LINK, | 1112 ui::PAGE_TRANSITION_LINK, |
1113 true /* is_renderer_init */); | 1113 true /* is_renderer_init */); |
1114 RenderFrameHostImpl* host2 = NavigateToEntry(manager2, entry2); | 1114 RenderFrameHostImpl* host2 = NavigateToEntry(manager2, entry2); |
1115 | 1115 |
1116 // No cross-process transition happens because we are already in the right | 1116 // No cross-process transition happens because we are already in the right |
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1516 | 1516 |
1517 // Create a new tab as an opener for the main tab. | 1517 // Create a new tab as an opener for the main tab. |
1518 scoped_ptr<TestWebContents> opener1( | 1518 scoped_ptr<TestWebContents> opener1( |
1519 TestWebContents::Create(browser_context(), rfh1->GetSiteInstance())); | 1519 TestWebContents::Create(browser_context(), rfh1->GetSiteInstance())); |
1520 RenderFrameHostManager* opener1_manager = | 1520 RenderFrameHostManager* opener1_manager = |
1521 opener1->GetRenderManagerForTesting(); | 1521 opener1->GetRenderManagerForTesting(); |
1522 contents()->SetOpener(opener1.get()); | 1522 contents()->SetOpener(opener1.get()); |
1523 | 1523 |
1524 // Make sure the new opener RVH is considered live. | 1524 // Make sure the new opener RVH is considered live. |
1525 opener1_manager->current_host()->CreateRenderView( | 1525 opener1_manager->current_host()->CreateRenderView( |
1526 -1, MSG_ROUTING_NONE, -1, FrameReplicationState(), false); | 1526 -1, MSG_ROUTING_NONE, -1, FrameReplicationState(), false, 0.0); |
1527 EXPECT_TRUE(opener1_manager->current_host()->IsRenderViewLive()); | 1527 EXPECT_TRUE(opener1_manager->current_host()->IsRenderViewLive()); |
1528 EXPECT_TRUE(opener1_manager->current_frame_host()->IsRenderFrameLive()); | 1528 EXPECT_TRUE(opener1_manager->current_frame_host()->IsRenderFrameLive()); |
1529 | 1529 |
1530 // Use a cross-process navigation in the opener to swap out the old RVH. | 1530 // Use a cross-process navigation in the opener to swap out the old RVH. |
1531 EXPECT_FALSE( | 1531 EXPECT_FALSE( |
1532 opener1_manager->GetSwappedOutRenderViewHost(rfh1->GetSiteInstance())); | 1532 opener1_manager->GetSwappedOutRenderViewHost(rfh1->GetSiteInstance())); |
1533 opener1->NavigateAndCommit(kUrl2); | 1533 opener1->NavigateAndCommit(kUrl2); |
1534 RenderViewHostImpl* swapped_out_rvh = | 1534 RenderViewHostImpl* swapped_out_rvh = |
1535 opener1_manager->GetSwappedOutRenderViewHost(rfh1->GetSiteInstance()); | 1535 opener1_manager->GetSwappedOutRenderViewHost(rfh1->GetSiteInstance()); |
1536 EXPECT_TRUE(swapped_out_rvh); | 1536 EXPECT_TRUE(swapped_out_rvh); |
(...skipping 1570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3107 commit_params.should_enforce_strict_mixed_content_checking = false; | 3107 commit_params.should_enforce_strict_mixed_content_checking = false; |
3108 child_host->SendNavigateWithParams(&commit_params); | 3108 child_host->SendNavigateWithParams(&commit_params); |
3109 EXPECT_NO_FATAL_FAILURE(CheckMixedContentIPC( | 3109 EXPECT_NO_FATAL_FAILURE(CheckMixedContentIPC( |
3110 main_test_rfh(), false, proxy_to_parent->GetRoutingID())); | 3110 main_test_rfh(), false, proxy_to_parent->GetRoutingID())); |
3111 EXPECT_FALSE(root->child_at(0) | 3111 EXPECT_FALSE(root->child_at(0) |
3112 ->current_replication_state() | 3112 ->current_replication_state() |
3113 .should_enforce_strict_mixed_content_checking); | 3113 .should_enforce_strict_mixed_content_checking); |
3114 } | 3114 } |
3115 | 3115 |
3116 } // namespace content | 3116 } // namespace content |
OLD | NEW |