OLD | NEW |
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" |
11 #include "content/browser/frame_host/navigator.h" | 11 #include "content/browser/frame_host/navigator.h" |
12 #include "content/browser/frame_host/navigator_impl.h" | 12 #include "content/browser/frame_host/navigator_impl.h" |
13 #include "content/browser/frame_host/render_frame_host_delegate.h" | 13 #include "content/browser/frame_host/render_frame_host_delegate.h" |
14 #include "content/browser/web_contents/web_contents_impl.h" | 14 #include "content/browser/web_contents/web_contents_impl.h" |
15 #include "content/common/frame_messages.h" | 15 #include "content/common/frame_messages.h" |
16 #include "content/common/frame_owner_properties.h" | 16 #include "content/common/frame_owner_properties.h" |
17 #include "content/public/browser/navigation_throttle.h" | 17 #include "content/public/browser/navigation_throttle.h" |
18 #include "content/public/browser/stream_handle.h" | 18 #include "content/public/browser/stream_handle.h" |
19 #include "content/public/common/browser_side_navigation_policy.h" | 19 #include "content/public/common/browser_side_navigation_policy.h" |
20 #include "content/public/common/url_constants.h" | 20 #include "content/public/common/url_constants.h" |
21 #include "content/test/browser_side_navigation_test_utils.h" | 21 #include "content/public/test/browser_side_navigation_test_utils.h" |
22 #include "content/test/test_navigation_url_loader.h" | 22 #include "content/test/test_navigation_url_loader.h" |
23 #include "content/test/test_render_view_host.h" | 23 #include "content/test/test_render_view_host.h" |
24 #include "mojo/public/cpp/bindings/interface_request.h" | 24 #include "mojo/public/cpp/bindings/interface_request.h" |
25 #include "net/base/load_flags.h" | 25 #include "net/base/load_flags.h" |
26 #include "third_party/WebKit/public/platform/WebPageVisibilityState.h" | 26 #include "third_party/WebKit/public/platform/WebPageVisibilityState.h" |
27 #include "third_party/WebKit/public/platform/modules/bluetooth/web_bluetooth.moj
om.h" | 27 #include "third_party/WebKit/public/platform/modules/bluetooth/web_bluetooth.moj
om.h" |
28 #include "third_party/WebKit/public/web/WebSandboxFlags.h" | 28 #include "third_party/WebKit/public/web/WebSandboxFlags.h" |
29 #include "third_party/WebKit/public/web/WebTreeScopeType.h" | 29 #include "third_party/WebKit/public/web/WebTreeScopeType.h" |
30 #include "ui/base/page_transition_types.h" | 30 #include "ui/base/page_transition_types.h" |
31 | 31 |
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
443 if (!redirect_url.is_empty()) | 443 if (!redirect_url.is_empty()) |
444 url_loader->SimulateServerRedirect(redirect_url); | 444 url_loader->SimulateServerRedirect(redirect_url); |
445 | 445 |
446 // Simulate the network stack commit. | 446 // Simulate the network stack commit. |
447 scoped_refptr<ResourceResponse> response(new ResourceResponse); | 447 scoped_refptr<ResourceResponse> response(new ResourceResponse); |
448 // TODO(carlosk): ideally with PlzNavigate it should be possible someday to | 448 // TODO(carlosk): ideally with PlzNavigate it should be possible someday to |
449 // fully commit the navigation at this call to CallOnResponseStarted. | 449 // fully commit the navigation at this call to CallOnResponseStarted. |
450 url_loader->CallOnResponseStarted(response, MakeEmptyStream(), nullptr); | 450 url_loader->CallOnResponseStarted(response, MakeEmptyStream(), nullptr); |
451 } | 451 } |
452 | 452 |
| 453 void TestRenderFrameHost::PrepareForCommitIfNecessary() { |
| 454 if (!IsBrowserSideNavigationEnabled() || |
| 455 frame_tree_node()->navigation_request()) { |
| 456 PrepareForCommit(); |
| 457 } |
| 458 } |
| 459 |
453 WebBluetoothServiceImpl* | 460 WebBluetoothServiceImpl* |
454 TestRenderFrameHost::CreateWebBluetoothServiceForTesting() { | 461 TestRenderFrameHost::CreateWebBluetoothServiceForTesting() { |
455 WebBluetoothServiceImpl* service = | 462 WebBluetoothServiceImpl* service = |
456 RenderFrameHostImpl::CreateWebBluetoothService( | 463 RenderFrameHostImpl::CreateWebBluetoothService( |
457 blink::mojom::WebBluetoothServiceRequest()); | 464 blink::mojom::WebBluetoothServiceRequest()); |
458 return service; | 465 return service; |
459 } | 466 } |
460 | 467 |
461 int32_t TestRenderFrameHost::ComputeNextPageID() { | 468 int32_t TestRenderFrameHost::ComputeNextPageID() { |
462 const NavigationEntryImpl* entry = static_cast<NavigationEntryImpl*>( | 469 const NavigationEntryImpl* entry = static_cast<NavigationEntryImpl*>( |
(...skipping 13 matching lines...) Expand all Loading... |
476 void TestRenderFrameHost::SimulateWillStartRequest( | 483 void TestRenderFrameHost::SimulateWillStartRequest( |
477 ui::PageTransition transition) { | 484 ui::PageTransition transition) { |
478 if (!navigation_handle()) | 485 if (!navigation_handle()) |
479 return; | 486 return; |
480 navigation_handle()->CallWillStartRequestForTesting( | 487 navigation_handle()->CallWillStartRequestForTesting( |
481 false /* is_post */, Referrer(GURL(), blink::WebReferrerPolicyDefault), | 488 false /* is_post */, Referrer(GURL(), blink::WebReferrerPolicyDefault), |
482 true /* user_gesture */, transition, false /* is_external_protocol */); | 489 true /* user_gesture */, transition, false /* is_external_protocol */); |
483 } | 490 } |
484 | 491 |
485 } // namespace content | 492 } // namespace content |
OLD | NEW |