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 997 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1008 // Create a blank tab. | 1008 // Create a blank tab. |
1009 scoped_ptr<TestWebContents> web_contents1( | 1009 scoped_ptr<TestWebContents> web_contents1( |
1010 TestWebContents::Create(browser_context(), blank_instance)); | 1010 TestWebContents::Create(browser_context(), blank_instance)); |
1011 FrameTree tree1(web_contents1->GetFrameTree()->root()->navigator(), | 1011 FrameTree tree1(web_contents1->GetFrameTree()->root()->navigator(), |
1012 web_contents1.get(), web_contents1.get(), | 1012 web_contents1.get(), web_contents1.get(), |
1013 web_contents1.get(), web_contents1.get()); | 1013 web_contents1.get(), web_contents1.get()); |
1014 RenderFrameHostManager* manager1 = tree1.root()->render_manager(); | 1014 RenderFrameHostManager* manager1 = tree1.root()->render_manager(); |
1015 manager1->Init( | 1015 manager1->Init( |
1016 browser_context(), blank_instance, MSG_ROUTING_NONE, MSG_ROUTING_NONE); | 1016 browser_context(), blank_instance, MSG_ROUTING_NONE, MSG_ROUTING_NONE); |
1017 // Test the case that new RVH is considered live. | 1017 // Test the case that new RVH is considered live. |
1018 manager1->current_host()->CreateRenderView(base::string16(), -1, -1); | 1018 manager1->current_host()->CreateRenderView(base::string16(), -1, -1, false); |
1019 | 1019 |
1020 // Navigate to a WebUI page. | 1020 // Navigate to a WebUI page. |
1021 const GURL kUrl1("chrome://foo"); | 1021 const GURL kUrl1("chrome://foo"); |
1022 NavigationEntryImpl entry1(NULL /* instance */, -1 /* page_id */, kUrl1, | 1022 NavigationEntryImpl entry1(NULL /* instance */, -1 /* page_id */, kUrl1, |
1023 Referrer(), base::string16() /* title */, | 1023 Referrer(), base::string16() /* title */, |
1024 PAGE_TRANSITION_TYPED, | 1024 PAGE_TRANSITION_TYPED, |
1025 false /* is_renderer_init */); | 1025 false /* is_renderer_init */); |
1026 RenderFrameHostImpl* host1 = manager1->Navigate(entry1); | 1026 RenderFrameHostImpl* host1 = manager1->Navigate(entry1); |
1027 | 1027 |
1028 // We should have a pending navigation to the WebUI RenderViewHost. | 1028 // We should have a pending navigation to the WebUI RenderViewHost. |
(...skipping 14 matching lines...) Expand all Loading... |
1043 scoped_ptr<TestWebContents> web_contents2( | 1043 scoped_ptr<TestWebContents> web_contents2( |
1044 TestWebContents::Create(browser_context(), webui_instance)); | 1044 TestWebContents::Create(browser_context(), webui_instance)); |
1045 FrameTree tree2(web_contents2->GetFrameTree()->root()->navigator(), | 1045 FrameTree tree2(web_contents2->GetFrameTree()->root()->navigator(), |
1046 web_contents2.get(), web_contents2.get(), | 1046 web_contents2.get(), web_contents2.get(), |
1047 web_contents2.get(), web_contents2.get()); | 1047 web_contents2.get(), web_contents2.get()); |
1048 RenderFrameHostManager* manager2 = tree2.root()->render_manager(); | 1048 RenderFrameHostManager* manager2 = tree2.root()->render_manager(); |
1049 manager2->Init( | 1049 manager2->Init( |
1050 browser_context(), webui_instance, MSG_ROUTING_NONE, MSG_ROUTING_NONE); | 1050 browser_context(), webui_instance, MSG_ROUTING_NONE, MSG_ROUTING_NONE); |
1051 // Make sure the new RVH is considered live. This is usually done in | 1051 // Make sure the new RVH is considered live. This is usually done in |
1052 // RenderWidgetHost::Init when opening a new tab from a link. | 1052 // RenderWidgetHost::Init when opening a new tab from a link. |
1053 manager2->current_host()->CreateRenderView(base::string16(), -1, -1); | 1053 manager2->current_host()->CreateRenderView(base::string16(), -1, -1, false); |
1054 | 1054 |
1055 const GURL kUrl2("chrome://foo/bar"); | 1055 const GURL kUrl2("chrome://foo/bar"); |
1056 NavigationEntryImpl entry2(NULL /* instance */, -1 /* page_id */, kUrl2, | 1056 NavigationEntryImpl entry2(NULL /* instance */, -1 /* page_id */, kUrl2, |
1057 Referrer(), base::string16() /* title */, | 1057 Referrer(), base::string16() /* title */, |
1058 PAGE_TRANSITION_LINK, | 1058 PAGE_TRANSITION_LINK, |
1059 true /* is_renderer_init */); | 1059 true /* is_renderer_init */); |
1060 RenderFrameHostImpl* host2 = manager2->Navigate(entry2); | 1060 RenderFrameHostImpl* host2 = manager2->Navigate(entry2); |
1061 | 1061 |
1062 // No cross-process transition happens because we are already in the right | 1062 // No cross-process transition happens because we are already in the right |
1063 // SiteInstance. We should grant bindings immediately. | 1063 // SiteInstance. We should grant bindings immediately. |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1245 TestRenderViewHost* rvh1 = test_rvh(); | 1245 TestRenderViewHost* rvh1 = test_rvh(); |
1246 | 1246 |
1247 // Create a new tab as an opener for the main tab. | 1247 // Create a new tab as an opener for the main tab. |
1248 scoped_ptr<TestWebContents> opener1( | 1248 scoped_ptr<TestWebContents> opener1( |
1249 TestWebContents::Create(browser_context(), rvh1->GetSiteInstance())); | 1249 TestWebContents::Create(browser_context(), rvh1->GetSiteInstance())); |
1250 RenderFrameHostManager* opener1_manager = | 1250 RenderFrameHostManager* opener1_manager = |
1251 opener1->GetRenderManagerForTesting(); | 1251 opener1->GetRenderManagerForTesting(); |
1252 contents()->SetOpener(opener1.get()); | 1252 contents()->SetOpener(opener1.get()); |
1253 | 1253 |
1254 // Make sure the new opener RVH is considered live. | 1254 // Make sure the new opener RVH is considered live. |
1255 opener1_manager->current_host()->CreateRenderView(base::string16(), -1, -1); | 1255 opener1_manager->current_host()->CreateRenderView( |
| 1256 base::string16(), -1, -1, false); |
1256 | 1257 |
1257 // Use a cross-process navigation in the opener to swap out the old RVH. | 1258 // Use a cross-process navigation in the opener to swap out the old RVH. |
1258 EXPECT_FALSE(opener1_manager->GetSwappedOutRenderViewHost( | 1259 EXPECT_FALSE(opener1_manager->GetSwappedOutRenderViewHost( |
1259 rvh1->GetSiteInstance())); | 1260 rvh1->GetSiteInstance())); |
1260 opener1->NavigateAndCommit(kUrl2); | 1261 opener1->NavigateAndCommit(kUrl2); |
1261 EXPECT_TRUE(opener1_manager->GetSwappedOutRenderViewHost( | 1262 EXPECT_TRUE(opener1_manager->GetSwappedOutRenderViewHost( |
1262 rvh1->GetSiteInstance())); | 1263 rvh1->GetSiteInstance())); |
1263 | 1264 |
1264 // Fake a process crash. | 1265 // Fake a process crash. |
1265 RenderProcessHost::RendererClosedDetails details( | 1266 RenderProcessHost::RendererClosedDetails details( |
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1714 | 1715 |
1715 // Simulate the swap out ack. | 1716 // Simulate the swap out ack. |
1716 rvh1->OnSwappedOut(false); | 1717 rvh1->OnSwappedOut(false); |
1717 | 1718 |
1718 // rvh1 should be swapped out. | 1719 // rvh1 should be swapped out. |
1719 EXPECT_FALSE(rvh_deleted_observer.deleted()); | 1720 EXPECT_FALSE(rvh_deleted_observer.deleted()); |
1720 EXPECT_TRUE(rvh1->IsSwappedOut()); | 1721 EXPECT_TRUE(rvh1->IsSwappedOut()); |
1721 } | 1722 } |
1722 | 1723 |
1723 } // namespace content | 1724 } // namespace content |
OLD | NEW |