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 "base/files/file_path.h" | 5 #include "base/files/file_path.h" |
6 #include "base/strings/utf_string_conversions.h" | 6 #include "base/strings/utf_string_conversions.h" |
7 #include "content/browser/frame_host/cross_site_transferring_request.h" | 7 #include "content/browser/frame_host/cross_site_transferring_request.h" |
8 #include "content/browser/frame_host/navigation_controller_impl.h" | 8 #include "content/browser/frame_host/navigation_controller_impl.h" |
9 #include "content/browser/frame_host/navigation_entry_impl.h" | 9 #include "content/browser/frame_host/navigation_entry_impl.h" |
10 #include "content/browser/frame_host/navigator.h" | 10 #include "content/browser/frame_host/navigator.h" |
(...skipping 1073 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1084 // Create a blank tab. | 1084 // Create a blank tab. |
1085 scoped_ptr<TestWebContents> web_contents1( | 1085 scoped_ptr<TestWebContents> web_contents1( |
1086 TestWebContents::Create(browser_context(), blank_instance)); | 1086 TestWebContents::Create(browser_context(), blank_instance)); |
1087 FrameTree tree1(web_contents1->GetFrameTree()->root()->navigator(), | 1087 FrameTree tree1(web_contents1->GetFrameTree()->root()->navigator(), |
1088 web_contents1.get(), web_contents1.get(), | 1088 web_contents1.get(), web_contents1.get(), |
1089 web_contents1.get(), web_contents1.get()); | 1089 web_contents1.get(), web_contents1.get()); |
1090 RenderFrameHostManager* manager1 = tree1.root()->render_manager(); | 1090 RenderFrameHostManager* manager1 = tree1.root()->render_manager(); |
1091 manager1->Init( | 1091 manager1->Init( |
1092 browser_context(), blank_instance, MSG_ROUTING_NONE, MSG_ROUTING_NONE); | 1092 browser_context(), blank_instance, MSG_ROUTING_NONE, MSG_ROUTING_NONE); |
1093 // Test the case that new RVH is considered live. | 1093 // Test the case that new RVH is considered live. |
1094 manager1->current_host()->CreateRenderView(base::string16(), -1, -1); | 1094 manager1->current_host()->CreateRenderView(base::string16(), -1, -1, false); |
1095 | 1095 |
1096 // Navigate to a WebUI page. | 1096 // Navigate to a WebUI page. |
1097 const GURL kUrl1("chrome://foo"); | 1097 const GURL kUrl1("chrome://foo"); |
1098 NavigationEntryImpl entry1(NULL /* instance */, -1 /* page_id */, kUrl1, | 1098 NavigationEntryImpl entry1(NULL /* instance */, -1 /* page_id */, kUrl1, |
1099 Referrer(), base::string16() /* title */, | 1099 Referrer(), base::string16() /* title */, |
1100 PAGE_TRANSITION_TYPED, | 1100 PAGE_TRANSITION_TYPED, |
1101 false /* is_renderer_init */); | 1101 false /* is_renderer_init */); |
1102 RenderFrameHostImpl* host1 = manager1->Navigate(entry1); | 1102 RenderFrameHostImpl* host1 = manager1->Navigate(entry1); |
1103 | 1103 |
1104 // We should have a pending navigation to the WebUI RenderViewHost. | 1104 // We should have a pending navigation to the WebUI RenderViewHost. |
(...skipping 14 matching lines...) Expand all Loading... |
1119 scoped_ptr<TestWebContents> web_contents2( | 1119 scoped_ptr<TestWebContents> web_contents2( |
1120 TestWebContents::Create(browser_context(), webui_instance)); | 1120 TestWebContents::Create(browser_context(), webui_instance)); |
1121 FrameTree tree2(web_contents2->GetFrameTree()->root()->navigator(), | 1121 FrameTree tree2(web_contents2->GetFrameTree()->root()->navigator(), |
1122 web_contents2.get(), web_contents2.get(), | 1122 web_contents2.get(), web_contents2.get(), |
1123 web_contents2.get(), web_contents2.get()); | 1123 web_contents2.get(), web_contents2.get()); |
1124 RenderFrameHostManager* manager2 = tree2.root()->render_manager(); | 1124 RenderFrameHostManager* manager2 = tree2.root()->render_manager(); |
1125 manager2->Init( | 1125 manager2->Init( |
1126 browser_context(), webui_instance, MSG_ROUTING_NONE, MSG_ROUTING_NONE); | 1126 browser_context(), webui_instance, MSG_ROUTING_NONE, MSG_ROUTING_NONE); |
1127 // Make sure the new RVH is considered live. This is usually done in | 1127 // Make sure the new RVH is considered live. This is usually done in |
1128 // RenderWidgetHost::Init when opening a new tab from a link. | 1128 // RenderWidgetHost::Init when opening a new tab from a link. |
1129 manager2->current_host()->CreateRenderView(base::string16(), -1, -1); | 1129 manager2->current_host()->CreateRenderView(base::string16(), -1, -1, false); |
1130 | 1130 |
1131 const GURL kUrl2("chrome://foo/bar"); | 1131 const GURL kUrl2("chrome://foo/bar"); |
1132 NavigationEntryImpl entry2(NULL /* instance */, -1 /* page_id */, kUrl2, | 1132 NavigationEntryImpl entry2(NULL /* instance */, -1 /* page_id */, kUrl2, |
1133 Referrer(), base::string16() /* title */, | 1133 Referrer(), base::string16() /* title */, |
1134 PAGE_TRANSITION_LINK, | 1134 PAGE_TRANSITION_LINK, |
1135 true /* is_renderer_init */); | 1135 true /* is_renderer_init */); |
1136 RenderFrameHostImpl* host2 = manager2->Navigate(entry2); | 1136 RenderFrameHostImpl* host2 = manager2->Navigate(entry2); |
1137 | 1137 |
1138 // No cross-process transition happens because we are already in the right | 1138 // No cross-process transition happens because we are already in the right |
1139 // SiteInstance. We should grant bindings immediately. | 1139 // SiteInstance. We should grant bindings immediately. |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1321 TestRenderViewHost* rvh1 = test_rvh(); | 1321 TestRenderViewHost* rvh1 = test_rvh(); |
1322 | 1322 |
1323 // Create a new tab as an opener for the main tab. | 1323 // Create a new tab as an opener for the main tab. |
1324 scoped_ptr<TestWebContents> opener1( | 1324 scoped_ptr<TestWebContents> opener1( |
1325 TestWebContents::Create(browser_context(), rvh1->GetSiteInstance())); | 1325 TestWebContents::Create(browser_context(), rvh1->GetSiteInstance())); |
1326 RenderFrameHostManager* opener1_manager = | 1326 RenderFrameHostManager* opener1_manager = |
1327 opener1->GetRenderManagerForTesting(); | 1327 opener1->GetRenderManagerForTesting(); |
1328 contents()->SetOpener(opener1.get()); | 1328 contents()->SetOpener(opener1.get()); |
1329 | 1329 |
1330 // Make sure the new opener RVH is considered live. | 1330 // Make sure the new opener RVH is considered live. |
1331 opener1_manager->current_host()->CreateRenderView(base::string16(), -1, -1); | 1331 opener1_manager->current_host()->CreateRenderView( |
| 1332 base::string16(), -1, -1, false); |
1332 | 1333 |
1333 // Use a cross-process navigation in the opener to swap out the old RVH. | 1334 // Use a cross-process navigation in the opener to swap out the old RVH. |
1334 EXPECT_FALSE(opener1_manager->GetSwappedOutRenderViewHost( | 1335 EXPECT_FALSE(opener1_manager->GetSwappedOutRenderViewHost( |
1335 rvh1->GetSiteInstance())); | 1336 rvh1->GetSiteInstance())); |
1336 opener1->NavigateAndCommit(kUrl2); | 1337 opener1->NavigateAndCommit(kUrl2); |
1337 EXPECT_TRUE(opener1_manager->GetSwappedOutRenderViewHost( | 1338 EXPECT_TRUE(opener1_manager->GetSwappedOutRenderViewHost( |
1338 rvh1->GetSiteInstance())); | 1339 rvh1->GetSiteInstance())); |
1339 | 1340 |
1340 // Fake a process crash. | 1341 // Fake a process crash. |
1341 RenderProcessHost::RendererClosedDetails details( | 1342 RenderProcessHost::RendererClosedDetails details( |
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1840 pending_rfh->GetSiteInstance())->increment_active_view_count(); | 1841 pending_rfh->GetSiteInstance())->increment_active_view_count(); |
1841 | 1842 |
1842 main_test_rfh()->OnMessageReceived( | 1843 main_test_rfh()->OnMessageReceived( |
1843 FrameHostMsg_BeforeUnload_ACK(0, false, now, now)); | 1844 FrameHostMsg_BeforeUnload_ACK(0, false, now, now)); |
1844 EXPECT_FALSE(contents()->cross_navigation_pending()); | 1845 EXPECT_FALSE(contents()->cross_navigation_pending()); |
1845 EXPECT_FALSE(rvh_deleted_observer.deleted()); | 1846 EXPECT_FALSE(rvh_deleted_observer.deleted()); |
1846 } | 1847 } |
1847 } | 1848 } |
1848 | 1849 |
1849 } // namespace content | 1850 } // namespace content |
OLD | NEW |