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

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

Issue 2584513003: PlzNavigate: identify same-page browser-initiated navigation. (Closed)
Patch Set: Fix 2 WebContentsImplTest by assigning a document_sequence_number. 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 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 if (!IsBrowserSideNavigationEnabled()) { 439 if (!IsBrowserSideNavigationEnabled()) {
440 // Non PlzNavigate 440 // Non PlzNavigate
441 if (is_waiting_for_beforeunload_ack()) 441 if (is_waiting_for_beforeunload_ack())
442 SendBeforeUnloadACK(true); 442 SendBeforeUnloadACK(true);
443 return; 443 return;
444 } 444 }
445 445
446 // PlzNavigate 446 // PlzNavigate
447 NavigationRequest* request = frame_tree_node_->navigation_request(); 447 NavigationRequest* request = frame_tree_node_->navigation_request();
448 CHECK(request); 448 CHECK(request);
449 bool have_to_make_network_request = ShouldMakeNetworkRequestForURL( 449 bool have_to_make_network_request =
450 request->common_params().url); 450 ShouldMakeNetworkRequestForURL(request->common_params().url) &&
451 !request->request_params().is_same_document_fragment_change &&
452 !request->request_params().is_same_document_history_load;
451 453
452 // Simulate a beforeUnload ACK from the renderer if the browser is waiting for 454 // Simulate a beforeUnload ACK from the renderer if the browser is waiting for
453 // it. If it runs it will update the request state. 455 // it. If it runs it will update the request state.
454 if (request->state() == NavigationRequest::WAITING_FOR_RENDERER_RESPONSE) { 456 if (request->state() == NavigationRequest::WAITING_FOR_RENDERER_RESPONSE) {
455 static_cast<TestRenderFrameHost*>(frame_tree_node()->current_frame_host()) 457 static_cast<TestRenderFrameHost*>(frame_tree_node()->current_frame_host())
456 ->SendBeforeUnloadACK(true); 458 ->SendBeforeUnloadACK(true);
457 } 459 }
458 460
459 if (!have_to_make_network_request) 461 if (!have_to_make_network_request)
460 return; // |request| is destructed by now. 462 return; // |request| is destructed by now.
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 // PlzNavigate: NavigationHandle::WillStartRequest has already been called at 505 // PlzNavigate: NavigationHandle::WillStartRequest has already been called at
504 // this point. 506 // this point.
505 if (!navigation_handle() || IsBrowserSideNavigationEnabled()) 507 if (!navigation_handle() || IsBrowserSideNavigationEnabled())
506 return; 508 return;
507 navigation_handle()->CallWillStartRequestForTesting( 509 navigation_handle()->CallWillStartRequestForTesting(
508 false /* is_post */, Referrer(GURL(), blink::WebReferrerPolicyDefault), 510 false /* is_post */, Referrer(GURL(), blink::WebReferrerPolicyDefault),
509 true /* user_gesture */, transition, false /* is_external_protocol */); 511 true /* user_gesture */, transition, false /* is_external_protocol */);
510 } 512 }
511 513
512 } // namespace content 514 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698