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

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

Issue 2669013002: Convert ClientSideDetectionHost to use the new navigation callbacks. (Closed)
Patch Set: nit Created 3 years, 10 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/navigation_handle_impl.h ('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/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"
11 #include "content/browser/frame_host/navigation_request.h" 11 #include "content/browser/frame_host/navigation_request.h"
12 #include "content/browser/frame_host/navigator.h" 12 #include "content/browser/frame_host/navigator.h"
13 #include "content/browser/frame_host/navigator_impl.h" 13 #include "content/browser/frame_host/navigator_impl.h"
14 #include "content/browser/frame_host/render_frame_host_delegate.h" 14 #include "content/browser/frame_host/render_frame_host_delegate.h"
15 #include "content/browser/web_contents/web_contents_impl.h" 15 #include "content/browser/web_contents/web_contents_impl.h"
16 #include "content/common/frame_messages.h" 16 #include "content/common/frame_messages.h"
17 #include "content/common/frame_owner_properties.h" 17 #include "content/common/frame_owner_properties.h"
18 #include "content/public/browser/navigation_throttle.h" 18 #include "content/public/browser/navigation_throttle.h"
19 #include "content/public/browser/stream_handle.h" 19 #include "content/public/browser/stream_handle.h"
20 #include "content/public/common/browser_side_navigation_policy.h" 20 #include "content/public/common/browser_side_navigation_policy.h"
21 #include "content/public/common/url_constants.h" 21 #include "content/public/common/url_constants.h"
22 #include "content/public/test/browser_side_navigation_test_utils.h" 22 #include "content/public/test/browser_side_navigation_test_utils.h"
23 #include "content/test/test_navigation_url_loader.h" 23 #include "content/test/test_navigation_url_loader.h"
24 #include "content/test/test_render_view_host.h" 24 #include "content/test/test_render_view_host.h"
25 #include "mojo/public/cpp/bindings/interface_request.h" 25 #include "mojo/public/cpp/bindings/interface_request.h"
26 #include "net/base/load_flags.h" 26 #include "net/base/load_flags.h"
27 #include "net/http/http_response_headers.h"
27 #include "third_party/WebKit/public/platform/WebMixedContentContextType.h" 28 #include "third_party/WebKit/public/platform/WebMixedContentContextType.h"
28 #include "third_party/WebKit/public/platform/WebPageVisibilityState.h" 29 #include "third_party/WebKit/public/platform/WebPageVisibilityState.h"
29 #include "third_party/WebKit/public/platform/modules/bluetooth/web_bluetooth.moj om.h" 30 #include "third_party/WebKit/public/platform/modules/bluetooth/web_bluetooth.moj om.h"
30 #include "third_party/WebKit/public/web/WebSandboxFlags.h" 31 #include "third_party/WebKit/public/web/WebSandboxFlags.h"
31 #include "third_party/WebKit/public/web/WebTreeScopeType.h" 32 #include "third_party/WebKit/public/web/WebTreeScopeType.h"
32 #include "ui/base/page_transition_types.h" 33 #include "ui/base/page_transition_types.h"
33 34
34 namespace content { 35 namespace content {
35 36
36 TestRenderFrameHostCreationObserver::TestRenderFrameHostCreationObserver( 37 TestRenderFrameHostCreationObserver::TestRenderFrameHostCreationObserver(
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 params.document_sequence_number); 393 params.document_sequence_number);
393 394
394 if (!callback.is_null()) 395 if (!callback.is_null())
395 callback.Run(&params); 396 callback.Run(&params);
396 397
397 SendNavigateWithParams(&params); 398 SendNavigateWithParams(&params);
398 } 399 }
399 400
400 void TestRenderFrameHost::SendNavigateWithParams( 401 void TestRenderFrameHost::SendNavigateWithParams(
401 FrameHostMsg_DidCommitProvisionalLoad_Params* params) { 402 FrameHostMsg_DidCommitProvisionalLoad_Params* params) {
403 if (navigation_handle()) {
404 scoped_refptr<net::HttpResponseHeaders> response_headers =
405 new net::HttpResponseHeaders(std::string());
406 response_headers->AddHeader(
407 std::string("Content-Type: ") + contents_mime_type_);
408 navigation_handle()->set_response_headers_for_testing(response_headers);
409 }
402 FrameHostMsg_DidCommitProvisionalLoad msg(GetRoutingID(), *params); 410 FrameHostMsg_DidCommitProvisionalLoad msg(GetRoutingID(), *params);
403 OnDidCommitProvisionalLoad(msg); 411 OnDidCommitProvisionalLoad(msg);
404 last_commit_was_error_page_ = params->url_is_unreachable; 412 last_commit_was_error_page_ = params->url_is_unreachable;
405 } 413 }
406 414
407 void TestRenderFrameHost::SendRendererInitiatedNavigationRequest( 415 void TestRenderFrameHost::SendRendererInitiatedNavigationRequest(
408 const GURL& url, 416 const GURL& url,
409 bool has_user_gesture) { 417 bool has_user_gesture) {
410 // Since this is renderer-initiated navigation, the RenderFrame must be 418 // Since this is renderer-initiated navigation, the RenderFrame must be
411 // initialized. Do it if it hasn't happened yet. 419 // initialized. Do it if it hasn't happened yet.
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 // PlzNavigate: NavigationHandle::WillStartRequest has already been called at 515 // PlzNavigate: NavigationHandle::WillStartRequest has already been called at
508 // this point. 516 // this point.
509 if (!navigation_handle() || IsBrowserSideNavigationEnabled()) 517 if (!navigation_handle() || IsBrowserSideNavigationEnabled())
510 return; 518 return;
511 navigation_handle()->CallWillStartRequestForTesting( 519 navigation_handle()->CallWillStartRequestForTesting(
512 false /* is_post */, Referrer(GURL(), blink::WebReferrerPolicyDefault), 520 false /* is_post */, Referrer(GURL(), blink::WebReferrerPolicyDefault),
513 true /* user_gesture */, transition, false /* is_external_protocol */); 521 true /* user_gesture */, transition, false /* is_external_protocol */);
514 } 522 }
515 523
516 } // namespace content 524 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/navigation_handle_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698