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

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

Issue 2099243002: PlzNavigate: properly set the initiator of the navigation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed issue in SW preload Created 4 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
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/guid.h" 7 #include "base/guid.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_handle_impl.h" 9 #include "content/browser/frame_host/navigation_handle_impl.h"
10 #include "content/browser/frame_host/navigation_request.h" 10 #include "content/browser/frame_host/navigation_request.h"
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 } 391 }
392 392
393 void TestRenderFrameHost::SendRendererInitiatedNavigationRequest( 393 void TestRenderFrameHost::SendRendererInitiatedNavigationRequest(
394 const GURL& url, 394 const GURL& url,
395 bool has_user_gesture) { 395 bool has_user_gesture) {
396 // Since this is renderer-initiated navigation, the RenderFrame must be 396 // Since this is renderer-initiated navigation, the RenderFrame must be
397 // initialized. Do it if it hasn't happened yet. 397 // initialized. Do it if it hasn't happened yet.
398 InitializeRenderFrameIfNeeded(); 398 InitializeRenderFrameIfNeeded();
399 399
400 if (IsBrowserSideNavigationEnabled()) { 400 if (IsBrowserSideNavigationEnabled()) {
401 // TODO(mkwst): The initiator origin here is incorrect.
401 BeginNavigationParams begin_params(std::string(), net::LOAD_NORMAL, false, 402 BeginNavigationParams begin_params(std::string(), net::LOAD_NORMAL, false,
402 REQUEST_CONTEXT_TYPE_HYPERLINK); 403 REQUEST_CONTEXT_TYPE_HYPERLINK,
404 url::Origin());
403 CommonNavigationParams common_params; 405 CommonNavigationParams common_params;
404 common_params.url = url; 406 common_params.url = url;
405 common_params.referrer = Referrer(GURL(), blink::WebReferrerPolicyDefault); 407 common_params.referrer = Referrer(GURL(), blink::WebReferrerPolicyDefault);
406 common_params.transition = ui::PAGE_TRANSITION_LINK; 408 common_params.transition = ui::PAGE_TRANSITION_LINK;
407 common_params.gesture = 409 common_params.gesture =
408 has_user_gesture ? NavigationGestureUser : NavigationGestureAuto; 410 has_user_gesture ? NavigationGestureUser : NavigationGestureAuto;
409 OnBeginNavigation(common_params, begin_params); 411 OnBeginNavigation(common_params, begin_params);
410 } 412 }
411 } 413 }
412 414
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 // PlzNavigate: NavigationHandle::WillStartRequest has already been called at 487 // PlzNavigate: NavigationHandle::WillStartRequest has already been called at
486 // this point. 488 // this point.
487 if (!navigation_handle() || IsBrowserSideNavigationEnabled()) 489 if (!navigation_handle() || IsBrowserSideNavigationEnabled())
488 return; 490 return;
489 navigation_handle()->CallWillStartRequestForTesting( 491 navigation_handle()->CallWillStartRequestForTesting(
490 false /* is_post */, Referrer(GURL(), blink::WebReferrerPolicyDefault), 492 false /* is_post */, Referrer(GURL(), blink::WebReferrerPolicyDefault),
491 transition, false /* is_external_protocol */); 493 transition, false /* is_external_protocol */);
492 } 494 }
493 495
494 } // namespace content 496 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698