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/test/test_renderer_host.h" | 5 #include "content/test/test_renderer_host.h" |
6 | 6 |
7 #include "content/browser/renderer_host/render_view_host_factory.h" | 7 #include "content/browser/renderer_host/render_view_host_factory.h" |
8 #include "content/browser/renderer_host/test_render_view_host.h" | 8 #include "content/browser/renderer_host/test_render_view_host.h" |
9 #include "content/browser/site_instance_impl.h" | 9 #include "content/browser/site_instance_impl.h" |
10 #include "content/browser/web_contents/navigation_entry_impl.h" | 10 #include "content/browser/web_contents/navigation_entry_impl.h" |
11 #include "content/browser/web_contents/test_web_contents.h" | 11 #include "content/browser/web_contents/test_web_contents.h" |
12 #include "content/public/browser/web_contents.h" | 12 #include "content/public/browser/web_contents.h" |
13 #include "content/test/mock_render_process_host.h" | 13 #include "content/test/mock_render_process_host.h" |
14 #include "content/test/test_browser_context.h" | 14 #include "content/test/test_browser_context.h" |
15 | 15 |
16 #if defined(USE_ASH) | 16 #if defined(USE_ASH) |
17 #include "ui/aura/test/test_screen.h" | 17 #include "ui/aura/test/test_screen.h" |
18 #endif | 18 #endif |
19 | 19 |
20 #if defined(USE_AURA) | 20 #if defined(USE_AURA) |
21 #include "ui/aura/env.h" | 21 #include "ui/aura/env.h" |
22 #include "ui/aura/monitor_manager.h" | 22 #include "ui/aura/monitor_manager.h" |
23 #include "ui/aura/root_window.h" | 23 #include "ui/aura/root_window.h" |
24 #include "ui/aura/test/single_monitor_manager.h" | 24 #include "ui/aura/single_monitor_manager.h" |
25 #include "ui/aura/test/test_stacking_client.h" | 25 #include "ui/aura/test/test_stacking_client.h" |
26 #endif | 26 #endif |
27 | 27 |
28 namespace content { | 28 namespace content { |
29 | 29 |
30 // Manages creation of the RenderViewHosts using our special subclass. This | 30 // Manages creation of the RenderViewHosts using our special subclass. This |
31 // automatically registers itself when it goes in scope, and unregisters itself | 31 // automatically registers itself when it goes in scope, and unregisters itself |
32 // when it goes out of scope. Since you can't have more than one factory | 32 // when it goes out of scope. Since you can't have more than one factory |
33 // registered at a time, you can only have one of these objects at a time. | 33 // registered at a time, you can only have one of these objects at a time. |
34 // | 34 // |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 void RenderViewHostTestHarness::Reload() { | 188 void RenderViewHostTestHarness::Reload() { |
189 NavigationEntry* entry = controller().GetLastCommittedEntry(); | 189 NavigationEntry* entry = controller().GetLastCommittedEntry(); |
190 DCHECK(entry); | 190 DCHECK(entry); |
191 controller().Reload(false); | 191 controller().Reload(false); |
192 static_cast<TestRenderViewHost*>( | 192 static_cast<TestRenderViewHost*>( |
193 rvh())->SendNavigate(entry->GetPageID(), entry->GetURL()); | 193 rvh())->SendNavigate(entry->GetPageID(), entry->GetURL()); |
194 } | 194 } |
195 | 195 |
196 void RenderViewHostTestHarness::SetUp() { | 196 void RenderViewHostTestHarness::SetUp() { |
197 #if defined(USE_AURA) | 197 #if defined(USE_AURA) |
198 aura::Env::GetInstance()->SetMonitorManager( | 198 aura::Env::GetInstance()->SetMonitorManager(new aura::SingleMonitorManager); |
199 new aura::test::SingleMonitorManager); | |
200 root_window_.reset(aura::MonitorManager::CreateRootWindowForPrimaryMonitor()); | 199 root_window_.reset(aura::MonitorManager::CreateRootWindowForPrimaryMonitor()); |
201 #if defined(USE_ASH) | 200 #if defined(USE_ASH) |
202 gfx::Screen::SetInstance(new aura::TestScreen(root_window_.get())); | 201 gfx::Screen::SetInstance(new aura::TestScreen(root_window_.get())); |
203 #endif // USE_ASH | 202 #endif // USE_ASH |
204 test_stacking_client_.reset( | 203 test_stacking_client_.reset( |
205 new aura::test::TestStackingClient(root_window_.get())); | 204 new aura::test::TestStackingClient(root_window_.get())); |
206 #endif // USE_AURA | 205 #endif // USE_AURA |
207 SetContents(CreateTestWebContents()); | 206 SetContents(CreateTestWebContents()); |
208 } | 207 } |
209 | 208 |
(...skipping 12 matching lines...) Expand all Loading... |
222 message_loop_.DeleteSoon(FROM_HERE, browser_context_.release()); | 221 message_loop_.DeleteSoon(FROM_HERE, browser_context_.release()); |
223 message_loop_.RunAllPending(); | 222 message_loop_.RunAllPending(); |
224 } | 223 } |
225 | 224 |
226 void RenderViewHostTestHarness::SetRenderProcessHostFactory( | 225 void RenderViewHostTestHarness::SetRenderProcessHostFactory( |
227 RenderProcessHostFactory* factory) { | 226 RenderProcessHostFactory* factory) { |
228 rvh_test_enabler_.rvh_factory_->set_render_process_host_factory(factory); | 227 rvh_test_enabler_.rvh_factory_->set_render_process_host_factory(factory); |
229 } | 228 } |
230 | 229 |
231 } // namespace content | 230 } // namespace content |
OLD | NEW |