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

Side by Side Diff: content/test/test_render_frame_host.cc

Issue 1092973002: Revert of PlzNavigate: move ownership of the NavigationRequest to the FrameTreeNode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 months 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
« no previous file with comments | « content/browser/frame_host/navigator_impl_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "content/test/test_render_frame_host.h" 5 #include "content/test/test_render_frame_host.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "content/browser/frame_host/frame_tree.h" 8 #include "content/browser/frame_host/frame_tree.h"
9 #include "content/browser/frame_host/navigation_request.h" 9 #include "content/browser/frame_host/navigation_request.h"
10 #include "content/browser/frame_host/navigator.h" 10 #include "content/browser/frame_host/navigator.h"
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 void TestRenderFrameHost::PrepareForCommitWithServerRedirect( 227 void TestRenderFrameHost::PrepareForCommitWithServerRedirect(
228 const GURL& redirect_url) { 228 const GURL& redirect_url) {
229 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( 229 if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
230 switches::kEnableBrowserSideNavigation)) { 230 switches::kEnableBrowserSideNavigation)) {
231 // Non PlzNavigate 231 // Non PlzNavigate
232 SendBeforeUnloadACK(true); 232 SendBeforeUnloadACK(true);
233 return; 233 return;
234 } 234 }
235 235
236 // PlzNavigate 236 // PlzNavigate
237 NavigationRequest* request = frame_tree_node_->navigation_request(); 237 NavigationRequest* request =
238 static_cast<NavigatorImpl*>(frame_tree_node_->navigator())
239 ->GetNavigationRequestForNodeForTesting(frame_tree_node_);
238 CHECK(request); 240 CHECK(request);
239 241
240 // Simulate a beforeUnload ACK from the renderer if the browser is waiting for 242 // Simulate a beforeUnload ACK from the renderer if the browser is waiting for
241 // it. If it runs it will update the request state. 243 // it. If it runs it will update the request state.
242 if (request->state() == NavigationRequest::WAITING_FOR_RENDERER_RESPONSE) 244 if (request->state() == NavigationRequest::WAITING_FOR_RENDERER_RESPONSE)
243 SendBeforeUnloadACK(true); 245 SendBeforeUnloadACK(true);
244 246
245 // If a network request is not needed for this URL, just check the request is 247 // If a network request is not needed for this URL, just check the request is
246 // in the correct state and return. 248 // in the correct state and return.
247 if (!request->ShouldMakeNetworkRequest(request->common_params().url)) { 249 if (!request->ShouldMakeNetworkRequest(request->common_params().url)) {
(...skipping 12 matching lines...) Expand all
260 url_loader->SimulateServerRedirect(redirect_url); 262 url_loader->SimulateServerRedirect(redirect_url);
261 263
262 // Simulate the network stack commit. 264 // Simulate the network stack commit.
263 scoped_refptr<ResourceResponse> response(new ResourceResponse); 265 scoped_refptr<ResourceResponse> response(new ResourceResponse);
264 // TODO(carlosk): ideally with PlzNavigate it should be possible someday to 266 // TODO(carlosk): ideally with PlzNavigate it should be possible someday to
265 // fully commit the navigation at this call to CallOnResponseStarted. 267 // fully commit the navigation at this call to CallOnResponseStarted.
266 url_loader->CallOnResponseStarted(response, MakeEmptyStream()); 268 url_loader->CallOnResponseStarted(response, MakeEmptyStream());
267 } 269 }
268 270
269 } // namespace content 271 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/navigator_impl_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698