| 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/command_line.h" | 7 #include "base/command_line.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_request.h" | 9 #include "content/browser/frame_host/navigation_request.h" |
| 10 #include "content/browser/frame_host/navigator.h" | 10 #include "content/browser/frame_host/navigator.h" |
| 11 #include "content/browser/frame_host/navigator_impl.h" | 11 #include "content/browser/frame_host/navigator_impl.h" |
| 12 #include "content/browser/frame_host/render_frame_host_delegate.h" | 12 #include "content/browser/frame_host/render_frame_host_delegate.h" |
| 13 #include "content/common/frame_messages.h" | 13 #include "content/common/frame_messages.h" |
| 14 #include "content/public/browser/stream_handle.h" | 14 #include "content/public/browser/stream_handle.h" |
| 15 #include "content/public/common/content_switches.h" | 15 #include "content/public/common/content_switches.h" |
| 16 #include "content/test/browser_side_navigation_test_utils.h" | 16 #include "content/test/browser_side_navigation_test_utils.h" |
| 17 #include "content/test/test_navigation_url_loader.h" | 17 #include "content/test/test_navigation_url_loader.h" |
| 18 #include "content/test/test_render_view_host.h" | 18 #include "content/test/test_render_view_host.h" |
| 19 #include "net/base/load_flags.h" | 19 #include "net/base/load_flags.h" |
| 20 #include "third_party/WebKit/public/platform/WebPageVisibilityState.h" | 20 #include "third_party/WebKit/public/platform/WebPageVisibilityState.h" |
| 21 #include "third_party/WebKit/public/web/WebTreeScopeType.h" |
| 21 #include "ui/base/page_transition_types.h" | 22 #include "ui/base/page_transition_types.h" |
| 22 | 23 |
| 23 namespace content { | 24 namespace content { |
| 24 | 25 |
| 25 TestRenderFrameHostCreationObserver::TestRenderFrameHostCreationObserver( | 26 TestRenderFrameHostCreationObserver::TestRenderFrameHostCreationObserver( |
| 26 WebContents* web_contents) | 27 WebContents* web_contents) |
| 27 : WebContentsObserver(web_contents), last_created_frame_(NULL) { | 28 : WebContentsObserver(web_contents), last_created_frame_(NULL) { |
| 28 } | 29 } |
| 29 | 30 |
| 30 TestRenderFrameHostCreationObserver::~TestRenderFrameHostCreationObserver() { | 31 TestRenderFrameHostCreationObserver::~TestRenderFrameHostCreationObserver() { |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 return static_cast<TestRenderViewHost*>( | 67 return static_cast<TestRenderViewHost*>( |
| 67 RenderFrameHostImpl::GetRenderViewHost()); | 68 RenderFrameHostImpl::GetRenderViewHost()); |
| 68 } | 69 } |
| 69 | 70 |
| 70 MockRenderProcessHost* TestRenderFrameHost::GetProcess() { | 71 MockRenderProcessHost* TestRenderFrameHost::GetProcess() { |
| 71 return static_cast<MockRenderProcessHost*>(RenderFrameHostImpl::GetProcess()); | 72 return static_cast<MockRenderProcessHost*>(RenderFrameHostImpl::GetProcess()); |
| 72 } | 73 } |
| 73 | 74 |
| 74 TestRenderFrameHost* TestRenderFrameHost::AppendChild( | 75 TestRenderFrameHost* TestRenderFrameHost::AppendChild( |
| 75 const std::string& frame_name) { | 76 const std::string& frame_name) { |
| 76 OnCreateChildFrame(GetProcess()->GetNextRoutingID(), frame_name, | 77 OnCreateChildFrame(GetProcess()->GetNextRoutingID(), |
| 78 blink::WebTreeScopeType::Document, frame_name, |
| 77 SandboxFlags::NONE); | 79 SandboxFlags::NONE); |
| 78 return static_cast<TestRenderFrameHost*>( | 80 return static_cast<TestRenderFrameHost*>( |
| 79 child_creation_observer_.last_created_frame()); | 81 child_creation_observer_.last_created_frame()); |
| 80 } | 82 } |
| 81 | 83 |
| 82 void TestRenderFrameHost::SetContentsMimeType(const std::string& mime_type) { | 84 void TestRenderFrameHost::SetContentsMimeType(const std::string& mime_type) { |
| 83 contents_mime_type_ = mime_type; | 85 contents_mime_type_ = mime_type; |
| 84 } | 86 } |
| 85 | 87 |
| 86 void TestRenderFrameHost::SendBeforeUnloadACK(bool proceed) { | 88 void TestRenderFrameHost::SendBeforeUnloadACK(bool proceed) { |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 url_loader->SimulateServerRedirect(redirect_url); | 303 url_loader->SimulateServerRedirect(redirect_url); |
| 302 | 304 |
| 303 // Simulate the network stack commit. | 305 // Simulate the network stack commit. |
| 304 scoped_refptr<ResourceResponse> response(new ResourceResponse); | 306 scoped_refptr<ResourceResponse> response(new ResourceResponse); |
| 305 // TODO(carlosk): ideally with PlzNavigate it should be possible someday to | 307 // TODO(carlosk): ideally with PlzNavigate it should be possible someday to |
| 306 // fully commit the navigation at this call to CallOnResponseStarted. | 308 // fully commit the navigation at this call to CallOnResponseStarted. |
| 307 url_loader->CallOnResponseStarted(response, MakeEmptyStream()); | 309 url_loader->CallOnResponseStarted(response, MakeEmptyStream()); |
| 308 } | 310 } |
| 309 | 311 |
| 310 } // namespace content | 312 } // namespace content |
| OLD | NEW |