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 = static_cast<WebContentsImpl*>( | 115 WebContentsImpl* web_contents = |
116 this->web_contents()); | 116 static_cast<WebContentsImpl*>(this->web_contents()); |
117 return web_contents->GetFrameTree()->GetMainFrame(); | 117 RenderFrameHostManager* main_frame_render_manager = |
| 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(); |
118 } | 128 } |
119 | 129 |
120 BrowserContext* RenderViewHostTestHarness::browser_context() { | 130 BrowserContext* RenderViewHostTestHarness::browser_context() { |
121 return browser_context_.get(); | 131 return browser_context_.get(); |
122 } | 132 } |
123 | 133 |
124 MockRenderProcessHost* RenderViewHostTestHarness::process() { | 134 MockRenderProcessHost* RenderViewHostTestHarness::process() { |
125 return static_cast<MockRenderProcessHost*>(active_rvh()->GetProcess()); | 135 return static_cast<MockRenderProcessHost*>(active_rvh()->GetProcess()); |
126 } | 136 } |
127 | 137 |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 BrowserContext* RenderViewHostTestHarness::CreateBrowserContext() { | 234 BrowserContext* RenderViewHostTestHarness::CreateBrowserContext() { |
225 return new TestBrowserContext(); | 235 return new TestBrowserContext(); |
226 } | 236 } |
227 | 237 |
228 void RenderViewHostTestHarness::SetRenderProcessHostFactory( | 238 void RenderViewHostTestHarness::SetRenderProcessHostFactory( |
229 RenderProcessHostFactory* factory) { | 239 RenderProcessHostFactory* factory) { |
230 rvh_test_enabler_.rvh_factory_->set_render_process_host_factory(factory); | 240 rvh_test_enabler_.rvh_factory_->set_render_process_host_factory(factory); |
231 } | 241 } |
232 | 242 |
233 } // namespace content | 243 } // namespace content |
OLD | NEW |