Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1044)

Side by Side Diff: content/browser/frame_host/render_view_host_manager_unittest.cc

Issue 76063007: Clean up RenderViewHostManager swapping logic. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix nits Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/strings/utf_string_conversions.h" 5 #include "base/strings/utf_string_conversions.h"
6 #include "content/browser/frame_host/navigation_controller_impl.h" 6 #include "content/browser/frame_host/navigation_controller_impl.h"
7 #include "content/browser/frame_host/navigation_entry_impl.h" 7 #include "content/browser/frame_host/navigation_entry_impl.h"
8 #include "content/browser/frame_host/render_view_host_manager.h" 8 #include "content/browser/frame_host/render_view_host_manager.h"
9 #include "content/browser/renderer_host/test_render_view_host.h" 9 #include "content/browser/renderer_host/test_render_view_host.h"
10 #include "content/browser/site_instance_impl.h" 10 #include "content/browser/site_instance_impl.h"
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 127
128 // Simulate the SwapOut_ACK that fires if you commit a cross-site 128 // Simulate the SwapOut_ACK that fires if you commit a cross-site
129 // navigation. 129 // navigation.
130 if (old_rvh != active_rvh()) 130 if (old_rvh != active_rvh())
131 old_rvh->OnSwappedOut(false); 131 old_rvh->OnSwappedOut(false);
132 132
133 active_test_rvh()->SendNavigate(max_page_id + 1, url); 133 active_test_rvh()->SendNavigate(max_page_id + 1, url);
134 } 134 }
135 135
136 bool ShouldSwapProcesses(RenderViewHostManager* manager, 136 bool ShouldSwapProcesses(RenderViewHostManager* manager,
137 const NavigationEntryImpl* cur_entry, 137 const NavigationEntryImpl* current_entry,
138 const NavigationEntryImpl* new_entry) const { 138 const NavigationEntryImpl* new_entry) const {
139 return manager->ShouldSwapProcessesForNavigation(cur_entry, new_entry); 139 return manager->ShouldSwapBrowsingInstancesForNavigation(current_entry,
140 new_entry);
140 } 141 }
141 142
142 // Creates a test RenderViewHost that's swapped out. 143 // Creates a test RenderViewHost that's swapped out.
143 TestRenderViewHost* CreateSwappedOutRenderViewHost() { 144 TestRenderViewHost* CreateSwappedOutRenderViewHost() {
144 const GURL kChromeURL("chrome://foo"); 145 const GURL kChromeURL("chrome://foo");
145 const GURL kDestUrl("http://www.google.com/"); 146 const GURL kDestUrl("http://www.google.com/");
146 147
147 // Navigate our first tab to a chrome url and then to the destination. 148 // Navigate our first tab to a chrome url and then to the destination.
148 NavigateActiveAndCommit(kChromeURL); 149 NavigateActiveAndCommit(kChromeURL);
149 TestRenderViewHost* ntp_rvh = static_cast<TestRenderViewHost*>( 150 TestRenderViewHost* ntp_rvh = static_cast<TestRenderViewHost*>(
(...skipping 1159 matching lines...) Expand 10 before | Expand all | Expand 10 after
1309 Source<RenderWidgetHost>(host2)); 1310 Source<RenderWidgetHost>(host2));
1310 manager.ShouldClosePage(false, true, base::TimeTicks()); 1311 manager.ShouldClosePage(false, true, base::TimeTicks());
1311 1312
1312 EXPECT_TRUE( 1313 EXPECT_TRUE(
1313 notifications.Check1AndReset(NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED)); 1314 notifications.Check1AndReset(NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED));
1314 EXPECT_FALSE(manager.pending_render_view_host()); 1315 EXPECT_FALSE(manager.pending_render_view_host());
1315 EXPECT_EQ(host, manager.current_host()); 1316 EXPECT_EQ(host, manager.current_host());
1316 } 1317 }
1317 1318
1318 } // namespace content 1319 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/render_view_host_manager.cc ('k') | content/public/browser/content_browser_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698