| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/public/test/test_renderer_host.h" | 5 #include "content/public/test/test_renderer_host.h" |
| 6 | 6 |
| 7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
| 8 #include "content/browser/frame_host/navigation_entry_impl.h" | 8 #include "content/browser/frame_host/navigation_entry_impl.h" |
| 9 #include "content/browser/renderer_host/render_view_host_factory.h" | 9 #include "content/browser/renderer_host/render_view_host_factory.h" |
| 10 #include "content/browser/renderer_host/render_widget_host_impl.h" | 10 #include "content/browser/renderer_host/render_widget_host_impl.h" |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 RenderViewHost* RenderViewHostTestHarness::pending_rvh() { | 105 RenderViewHost* RenderViewHostTestHarness::pending_rvh() { |
| 106 return static_cast<TestWebContents*>(web_contents())-> | 106 return static_cast<TestWebContents*>(web_contents())-> |
| 107 GetRenderManagerForTesting()->pending_render_view_host(); | 107 GetRenderManagerForTesting()->pending_render_view_host(); |
| 108 } | 108 } |
| 109 | 109 |
| 110 RenderViewHost* RenderViewHostTestHarness::active_rvh() { | 110 RenderViewHost* RenderViewHostTestHarness::active_rvh() { |
| 111 return pending_rvh() ? pending_rvh() : rvh(); | 111 return pending_rvh() ? pending_rvh() : rvh(); |
| 112 } | 112 } |
| 113 | 113 |
| 114 RenderFrameHost* RenderViewHostTestHarness::main_rfh() { | 114 RenderFrameHost* RenderViewHostTestHarness::main_rfh() { |
| 115 WebContentsImpl* web_contents = | 115 WebContentsImpl* web_contents = static_cast<WebContentsImpl*>( |
| 116 static_cast<WebContentsImpl*>(this->web_contents()); | 116 this->web_contents()); |
| 117 RenderFrameHostManager* main_frame_render_manager = | 117 return web_contents->GetFrameTree()->GetMainFrame(); |
| 118 web_contents->GetFrameTree()->root()->render_manager(); | |
| 119 return main_frame_render_manager->current_frame_host(); | |
| 120 } | |
| 121 | |
| 122 RenderFrameHost* RenderViewHostTestHarness::pending_main_rfh() { | |
| 123 WebContentsImpl* web_contents = | |
| 124 static_cast<WebContentsImpl*>(this->web_contents()); | |
| 125 RenderFrameHostManager* main_frame_render_manager = | |
| 126 web_contents->GetFrameTree()->root()->render_manager(); | |
| 127 return main_frame_render_manager->pending_frame_host(); | |
| 128 } | 118 } |
| 129 | 119 |
| 130 BrowserContext* RenderViewHostTestHarness::browser_context() { | 120 BrowserContext* RenderViewHostTestHarness::browser_context() { |
| 131 return browser_context_.get(); | 121 return browser_context_.get(); |
| 132 } | 122 } |
| 133 | 123 |
| 134 MockRenderProcessHost* RenderViewHostTestHarness::process() { | 124 MockRenderProcessHost* RenderViewHostTestHarness::process() { |
| 135 return static_cast<MockRenderProcessHost*>(active_rvh()->GetProcess()); | 125 return static_cast<MockRenderProcessHost*>(active_rvh()->GetProcess()); |
| 136 } | 126 } |
| 137 | 127 |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 BrowserContext* RenderViewHostTestHarness::CreateBrowserContext() { | 224 BrowserContext* RenderViewHostTestHarness::CreateBrowserContext() { |
| 235 return new TestBrowserContext(); | 225 return new TestBrowserContext(); |
| 236 } | 226 } |
| 237 | 227 |
| 238 void RenderViewHostTestHarness::SetRenderProcessHostFactory( | 228 void RenderViewHostTestHarness::SetRenderProcessHostFactory( |
| 239 RenderProcessHostFactory* factory) { | 229 RenderProcessHostFactory* factory) { |
| 240 rvh_test_enabler_.rvh_factory_->set_render_process_host_factory(factory); | 230 rvh_test_enabler_.rvh_factory_->set_render_process_host_factory(factory); |
| 241 } | 231 } |
| 242 | 232 |
| 243 } // namespace content | 233 } // namespace content |
| OLD | NEW |