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

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

Issue 2584513003: PlzNavigate: identify same-page browser-initiated navigation. (Closed)
Patch Set: Adding a DCHECK to probably make a lot of tests fail. Created 3 years, 11 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
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 "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "content/browser/frame_host/frame_tree.h" 9 #include "content/browser/frame_host/frame_tree.h"
10 #include "content/browser/frame_host/navigation_handle_impl.h" 10 #include "content/browser/frame_host/navigation_handle_impl.h"
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 if (!IsBrowserSideNavigationEnabled()) { 441 if (!IsBrowserSideNavigationEnabled()) {
442 // Non PlzNavigate 442 // Non PlzNavigate
443 if (is_waiting_for_beforeunload_ack()) 443 if (is_waiting_for_beforeunload_ack())
444 SendBeforeUnloadACK(true); 444 SendBeforeUnloadACK(true);
445 return; 445 return;
446 } 446 }
447 447
448 // PlzNavigate 448 // PlzNavigate
449 NavigationRequest* request = frame_tree_node_->navigation_request(); 449 NavigationRequest* request = frame_tree_node_->navigation_request();
450 CHECK(request); 450 CHECK(request);
451 bool have_to_make_network_request = ShouldMakeNetworkRequestForURL( 451 bool have_to_make_network_request =
452 request->common_params().url); 452 ShouldMakeNetworkRequestForURL(request->common_params().url) &&
453 !request->request_params().is_same_document_fragment_change &&
454 !request->request_params().is_same_document_history_load;
453 455
454 // Simulate a beforeUnload ACK from the renderer if the browser is waiting for 456 // Simulate a beforeUnload ACK from the renderer if the browser is waiting for
455 // it. If it runs it will update the request state. 457 // it. If it runs it will update the request state.
456 if (request->state() == NavigationRequest::WAITING_FOR_RENDERER_RESPONSE) { 458 if (request->state() == NavigationRequest::WAITING_FOR_RENDERER_RESPONSE) {
457 static_cast<TestRenderFrameHost*>(frame_tree_node()->current_frame_host()) 459 static_cast<TestRenderFrameHost*>(frame_tree_node()->current_frame_host())
458 ->SendBeforeUnloadACK(true); 460 ->SendBeforeUnloadACK(true);
459 } 461 }
460 462
461 if (!have_to_make_network_request) 463 if (!have_to_make_network_request)
462 return; // |request| is destructed by now. 464 return; // |request| is destructed by now.
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
505 // PlzNavigate: NavigationHandle::WillStartRequest has already been called at 507 // PlzNavigate: NavigationHandle::WillStartRequest has already been called at
506 // this point. 508 // this point.
507 if (!navigation_handle() || IsBrowserSideNavigationEnabled()) 509 if (!navigation_handle() || IsBrowserSideNavigationEnabled())
508 return; 510 return;
509 navigation_handle()->CallWillStartRequestForTesting( 511 navigation_handle()->CallWillStartRequestForTesting(
510 false /* is_post */, Referrer(GURL(), blink::WebReferrerPolicyDefault), 512 false /* is_post */, Referrer(GURL(), blink::WebReferrerPolicyDefault),
511 true /* user_gesture */, transition, false /* is_external_protocol */); 513 true /* user_gesture */, transition, false /* is_external_protocol */);
512 } 514 }
513 515
514 } // namespace content 516 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698