| 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 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 void TestRenderFrameHost::SimulateNavigationStop() { | 211 void TestRenderFrameHost::SimulateNavigationStop() { |
| 212 if (is_loading()) { | 212 if (is_loading()) { |
| 213 OnDidStopLoading(); | 213 OnDidStopLoading(); |
| 214 } else if (IsBrowserSideNavigationEnabled()) { | 214 } else if (IsBrowserSideNavigationEnabled()) { |
| 215 // Even if the RenderFrameHost is not loading, there may still be an | 215 // Even if the RenderFrameHost is not loading, there may still be an |
| 216 // ongoing navigation in the FrameTreeNode. Cancel this one as well. | 216 // ongoing navigation in the FrameTreeNode. Cancel this one as well. |
| 217 frame_tree_node()->ResetNavigationRequest(false); | 217 frame_tree_node()->ResetNavigationRequest(false); |
| 218 } | 218 } |
| 219 } | 219 } |
| 220 | 220 |
| 221 void TestRenderFrameHost::SimulateUnloading() { |
| 222 if (!IsBrowserSideNavigationEnabled() || |
| 223 frame_tree_node()->navigation_request()) { |
| 224 PrepareForCommit(); |
| 225 } |
| 226 } |
| 227 |
| 221 void TestRenderFrameHost::SetContentsMimeType(const std::string& mime_type) { | 228 void TestRenderFrameHost::SetContentsMimeType(const std::string& mime_type) { |
| 222 contents_mime_type_ = mime_type; | 229 contents_mime_type_ = mime_type; |
| 223 } | 230 } |
| 224 | 231 |
| 225 void TestRenderFrameHost::SendBeforeUnloadACK(bool proceed) { | 232 void TestRenderFrameHost::SendBeforeUnloadACK(bool proceed) { |
| 226 base::TimeTicks now = base::TimeTicks::Now(); | 233 base::TimeTicks now = base::TimeTicks::Now(); |
| 227 OnBeforeUnloadACK(proceed, now, now); | 234 OnBeforeUnloadACK(proceed, now, now); |
| 228 } | 235 } |
| 229 | 236 |
| 230 void TestRenderFrameHost::SimulateSwapOutACK() { | 237 void TestRenderFrameHost::SimulateSwapOutACK() { |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after 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 |