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

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

Issue 1080073004: PlzNavigate: move ownership of the NavigationRequest to the FrameTreeNode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed compilation error 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 = 237 NavigationRequest* request = frame_tree_node_->navigation_request();
238 static_cast<NavigatorImpl*>(frame_tree_node_->navigator())
239 ->GetNavigationRequestForNodeForTesting(frame_tree_node_);
240 CHECK(request); 238 CHECK(request);
241 239
242 // Simulate a beforeUnload ACK from the renderer if the browser is waiting for 240 // Simulate a beforeUnload ACK from the renderer if the browser is waiting for
243 // it. If it runs it will update the request state. 241 // it. If it runs it will update the request state.
244 if (request->state() == NavigationRequest::WAITING_FOR_RENDERER_RESPONSE) 242 if (request->state() == NavigationRequest::WAITING_FOR_RENDERER_RESPONSE)
245 SendBeforeUnloadACK(true); 243 SendBeforeUnloadACK(true);
246 244
247 // If a network request is not needed for this URL, just check the request is 245 // If a network request is not needed for this URL, just check the request is
248 // in the correct state and return. 246 // in the correct state and return.
249 if (!request->ShouldMakeNetworkRequest(request->common_params().url)) { 247 if (!request->ShouldMakeNetworkRequest(request->common_params().url)) {
(...skipping 12 matching lines...) Expand all
262 url_loader->SimulateServerRedirect(redirect_url); 260 url_loader->SimulateServerRedirect(redirect_url);
263 261
264 // Simulate the network stack commit. 262 // Simulate the network stack commit.
265 scoped_refptr<ResourceResponse> response(new ResourceResponse); 263 scoped_refptr<ResourceResponse> response(new ResourceResponse);
266 // TODO(carlosk): ideally with PlzNavigate it should be possible someday to 264 // TODO(carlosk): ideally with PlzNavigate it should be possible someday to
267 // fully commit the navigation at this call to CallOnResponseStarted. 265 // fully commit the navigation at this call to CallOnResponseStarted.
268 url_loader->CallOnResponseStarted(response, MakeEmptyStream()); 266 url_loader->CallOnResponseStarted(response, MakeEmptyStream());
269 } 267 }
270 268
271 } // namespace content 269 } // 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