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" |
11 #include "content/browser/site_instance_impl.h" | 11 #include "content/browser/site_instance_impl.h" |
12 #include "content/public/browser/browser_thread.h" | 12 #include "content/public/browser/browser_thread.h" |
13 #include "content/public/browser/web_contents.h" | 13 #include "content/public/browser/web_contents.h" |
14 #include "content/public/test/mock_render_process_host.h" | 14 #include "content/public/test/mock_render_process_host.h" |
15 #include "content/public/test/test_browser_context.h" | 15 #include "content/public/test/test_browser_context.h" |
16 #include "content/test/test_render_frame_host_factory.h" | 16 #include "content/test/test_render_frame_host_factory.h" |
17 #include "content/test/test_render_view_host.h" | 17 #include "content/test/test_render_view_host.h" |
18 #include "content/test/test_render_view_host_factory.h" | 18 #include "content/test/test_render_view_host_factory.h" |
19 #include "content/test/test_web_contents.h" | 19 #include "content/test/test_web_contents.h" |
20 | 20 |
21 #if defined(OS_WIN) | 21 #if defined(OS_WIN) |
22 #include "ui/base/win/scoped_ole_initializer.h" | 22 #include "ui/base/win/scoped_ole_initializer.h" |
23 #endif | 23 #endif |
24 | 24 |
25 #if defined(USE_AURA) | 25 #if defined(USE_AURA) |
26 #include "ui/aura/test/aura_test_helper.h" | 26 #include "ui/aura/test/aura_test_helper.h" |
27 #include "ui/compositor/test/context_factories_for_test.h" | 27 #include "ui/compositor/test/context_factories_for_test.h" |
28 #include "ui/wm/core/default_activation_client.h" | |
29 #endif | 28 #endif |
30 | 29 |
31 namespace content { | 30 namespace content { |
32 | 31 |
33 // RenderViewHostTester ------------------------------------------------------- | 32 // RenderViewHostTester ------------------------------------------------------- |
34 | 33 |
35 // static | 34 // static |
36 RenderViewHostTester* RenderViewHostTester::For(RenderViewHost* host) { | 35 RenderViewHostTester* RenderViewHostTester::For(RenderViewHost* host) { |
37 return static_cast<TestRenderViewHost*>(host); | 36 return static_cast<TestRenderViewHost*>(host); |
38 } | 37 } |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 ole_initializer_.reset(new ui::ScopedOleInitializer()); | 167 ole_initializer_.reset(new ui::ScopedOleInitializer()); |
169 #endif | 168 #endif |
170 #if defined(USE_AURA) | 169 #if defined(USE_AURA) |
171 // The ContextFactory must exist before any Compositors are created. | 170 // The ContextFactory must exist before any Compositors are created. |
172 bool enable_pixel_output = false; | 171 bool enable_pixel_output = false; |
173 ui::InitializeContextFactoryForTests(enable_pixel_output); | 172 ui::InitializeContextFactoryForTests(enable_pixel_output); |
174 | 173 |
175 aura_test_helper_.reset( | 174 aura_test_helper_.reset( |
176 new aura::test::AuraTestHelper(base::MessageLoopForUI::current())); | 175 new aura::test::AuraTestHelper(base::MessageLoopForUI::current())); |
177 aura_test_helper_->SetUp(); | 176 aura_test_helper_->SetUp(); |
178 new wm::DefaultActivationClient(aura_test_helper_->root_window()); | |
179 #endif | 177 #endif |
180 | 178 |
181 DCHECK(!browser_context_); | 179 DCHECK(!browser_context_); |
182 browser_context_.reset(CreateBrowserContext()); | 180 browser_context_.reset(CreateBrowserContext()); |
183 | 181 |
184 SetContents(CreateTestWebContents()); | 182 SetContents(CreateTestWebContents()); |
185 } | 183 } |
186 | 184 |
187 void RenderViewHostTestHarness::TearDown() { | 185 void RenderViewHostTestHarness::TearDown() { |
188 SetContents(NULL); | 186 SetContents(NULL); |
(...skipping 26 matching lines...) Expand all Loading... |
215 BrowserContext* RenderViewHostTestHarness::CreateBrowserContext() { | 213 BrowserContext* RenderViewHostTestHarness::CreateBrowserContext() { |
216 return new TestBrowserContext(); | 214 return new TestBrowserContext(); |
217 } | 215 } |
218 | 216 |
219 void RenderViewHostTestHarness::SetRenderProcessHostFactory( | 217 void RenderViewHostTestHarness::SetRenderProcessHostFactory( |
220 RenderProcessHostFactory* factory) { | 218 RenderProcessHostFactory* factory) { |
221 rvh_test_enabler_.rvh_factory_->set_render_process_host_factory(factory); | 219 rvh_test_enabler_.rvh_factory_->set_render_process_host_factory(factory); |
222 } | 220 } |
223 | 221 |
224 } // namespace content | 222 } // namespace content |
OLD | NEW |