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/navigation_request.h" | 10 #include "content/browser/frame_host/navigation_request.h" |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 RenderViewHostDeletedObserver rvh_observer(old_rvh); | 316 RenderViewHostDeletedObserver rvh_observer(old_rvh); |
317 active_test_rvh()->SendNavigate(max_page_id + 1, url); | 317 active_test_rvh()->SendNavigate(max_page_id + 1, url); |
318 | 318 |
319 if (old_rvh != active_rvh() && !rvh_observer.deleted()) | 319 if (old_rvh != active_rvh() && !rvh_observer.deleted()) |
320 EXPECT_TRUE(old_rvh->IsSwappedOut()); | 320 EXPECT_TRUE(old_rvh->IsSwappedOut()); |
321 } | 321 } |
322 | 322 |
323 bool ShouldSwapProcesses(RenderFrameHostManager* manager, | 323 bool ShouldSwapProcesses(RenderFrameHostManager* manager, |
324 const NavigationEntryImpl* current_entry, | 324 const NavigationEntryImpl* current_entry, |
325 const NavigationEntryImpl* new_entry) const { | 325 const NavigationEntryImpl* new_entry) const { |
326 return manager->ShouldSwapBrowsingInstancesForNavigation(current_entry, | 326 CHECK(new_entry); |
327 new_entry); | 327 BrowserContext* browser_context = |
| 328 manager->delegate_->GetControllerForRenderManager().GetBrowserContext(); |
| 329 return manager->ShouldSwapBrowsingInstancesForNavigation( |
| 330 current_entry, |
| 331 new_entry->site_instance(), |
| 332 SiteInstanceImpl::GetEffectiveURL(browser_context, new_entry->GetURL()), |
| 333 new_entry->IsViewSourceMode()); |
328 } | 334 } |
329 | 335 |
330 // Creates a test RenderViewHost that's swapped out. | 336 // Creates a test RenderViewHost that's swapped out. |
331 TestRenderViewHost* CreateSwappedOutRenderViewHost() { | 337 TestRenderViewHost* CreateSwappedOutRenderViewHost() { |
332 const GURL kChromeURL("chrome://foo"); | 338 const GURL kChromeURL("chrome://foo"); |
333 const GURL kDestUrl("http://www.google.com/"); | 339 const GURL kDestUrl("http://www.google.com/"); |
334 | 340 |
335 // Navigate our first tab to a chrome url and then to the destination. | 341 // Navigate our first tab to a chrome url and then to the destination. |
336 NavigateActiveAndCommit(kChromeURL); | 342 NavigateActiveAndCommit(kChromeURL); |
337 TestRenderViewHost* ntp_rvh = static_cast<TestRenderViewHost*>( | 343 TestRenderViewHost* ntp_rvh = static_cast<TestRenderViewHost*>( |
(...skipping 1547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1885 NavigationRequestForRenderFrameManager( | 1891 NavigationRequestForRenderFrameManager( |
1886 main_test_rfh()->frame_tree_node()->render_manager()); | 1892 main_test_rfh()->frame_tree_node()->render_manager()); |
1887 ASSERT_TRUE(main_request); | 1893 ASSERT_TRUE(main_request); |
1888 EXPECT_EQ(kUrl3, main_request->info_for_testing().navigation_params.url); | 1894 EXPECT_EQ(kUrl3, main_request->info_for_testing().navigation_params.url); |
1889 EXPECT_EQ(kUrl3, main_request->info_for_testing().first_party_for_cookies); | 1895 EXPECT_EQ(kUrl3, main_request->info_for_testing().first_party_for_cookies); |
1890 EXPECT_TRUE(main_request->info_for_testing().is_main_frame); | 1896 EXPECT_TRUE(main_request->info_for_testing().is_main_frame); |
1891 EXPECT_FALSE(main_request->info_for_testing().parent_is_main_frame); | 1897 EXPECT_FALSE(main_request->info_for_testing().parent_is_main_frame); |
1892 } | 1898 } |
1893 | 1899 |
1894 } // namespace content | 1900 } // namespace content |
OLD | NEW |