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 <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
10 #include "base/threading/thread_task_runner_handle.h" | 10 #include "base/threading/thread_task_runner_handle.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 #include "content/test/test_render_frame_host_factory.h" | 25 #include "content/test/test_render_frame_host_factory.h" |
26 #include "content/test/test_render_view_host.h" | 26 #include "content/test/test_render_view_host.h" |
27 #include "content/test/test_render_view_host_factory.h" | 27 #include "content/test/test_render_view_host_factory.h" |
28 #include "content/test/test_web_contents.h" | 28 #include "content/test/test_web_contents.h" |
29 #include "ui/base/material_design/material_design_controller.h" | 29 #include "ui/base/material_design/material_design_controller.h" |
30 #include "ui/base/test/material_design_controller_test_api.h" | 30 #include "ui/base/test/material_design_controller_test_api.h" |
31 | 31 |
32 #if defined(OS_ANDROID) | 32 #if defined(OS_ANDROID) |
33 #include "content/browser/renderer_host/context_provider_factory_impl_android.h" | 33 #include "content/browser/renderer_host/context_provider_factory_impl_android.h" |
34 #include "content/test/mock_gpu_channel_establish_factory.h" | 34 #include "content/test/mock_gpu_channel_establish_factory.h" |
| 35 #include "ui/android/dummy_screen_android.h" |
| 36 #include "ui/display/screen.h" |
35 #endif | 37 #endif |
36 | 38 |
37 #if defined(OS_WIN) | 39 #if defined(OS_WIN) |
38 #include "ui/base/win/scoped_ole_initializer.h" | 40 #include "ui/base/win/scoped_ole_initializer.h" |
39 #endif | 41 #endif |
40 | 42 |
41 #if defined(USE_AURA) | 43 #if defined(USE_AURA) |
42 #include "ui/aura/test/aura_test_helper.h" | 44 #include "ui/aura/test/aura_test_helper.h" |
43 #include "ui/compositor/test/context_factories_for_test.h" | 45 #include "ui/compositor/test/context_factories_for_test.h" |
44 #include "ui/wm/core/default_activation_client.h" | 46 #include "ui/wm/core/default_activation_client.h" |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 ole_initializer_.reset(new ui::ScopedOleInitializer()); | 238 ole_initializer_.reset(new ui::ScopedOleInitializer()); |
237 #endif | 239 #endif |
238 #if !defined(OS_ANDROID) | 240 #if !defined(OS_ANDROID) |
239 ImageTransportFactory::InitializeForUnitTests( | 241 ImageTransportFactory::InitializeForUnitTests( |
240 base::WrapUnique(new NoTransportImageTransportFactory)); | 242 base::WrapUnique(new NoTransportImageTransportFactory)); |
241 #else | 243 #else |
242 gpu_channel_factory_ = base::MakeUnique<MockGpuChannelEstablishFactory>(); | 244 gpu_channel_factory_ = base::MakeUnique<MockGpuChannelEstablishFactory>(); |
243 ContextProviderFactoryImpl::Initialize(gpu_channel_factory_.get()); | 245 ContextProviderFactoryImpl::Initialize(gpu_channel_factory_.get()); |
244 ui::ContextProviderFactory::SetInstance( | 246 ui::ContextProviderFactory::SetInstance( |
245 ContextProviderFactoryImpl::GetInstance()); | 247 ContextProviderFactoryImpl::GetInstance()); |
| 248 if (!screen_) |
| 249 screen_.reset(ui::CreateDummyScreenAndroid()); |
| 250 display::Screen::SetScreenInstance(screen_.get()); |
246 #endif | 251 #endif |
247 #if defined(USE_AURA) | 252 #if defined(USE_AURA) |
248 ui::ContextFactory* context_factory = | 253 ui::ContextFactory* context_factory = |
249 ImageTransportFactory::GetInstance()->GetContextFactory(); | 254 ImageTransportFactory::GetInstance()->GetContextFactory(); |
250 | 255 |
251 aura_test_helper_.reset( | 256 aura_test_helper_.reset( |
252 new aura::test::AuraTestHelper(base::MessageLoopForUI::current())); | 257 new aura::test::AuraTestHelper(base::MessageLoopForUI::current())); |
253 aura_test_helper_->SetUp(context_factory); | 258 aura_test_helper_->SetUp(context_factory); |
254 new wm::DefaultActivationClient(aura_test_helper_->root_window()); | 259 new wm::DefaultActivationClient(aura_test_helper_->root_window()); |
255 #endif | 260 #endif |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 BrowserThread::DeleteSoon(content::BrowserThread::UI, | 306 BrowserThread::DeleteSoon(content::BrowserThread::UI, |
302 FROM_HERE, | 307 FROM_HERE, |
303 browser_context_.release()); | 308 browser_context_.release()); |
304 thread_bundle_.reset(); | 309 thread_bundle_.reset(); |
305 | 310 |
306 #if !defined(OS_ANDROID) | 311 #if !defined(OS_ANDROID) |
307 // RenderWidgetHostView holds on to a reference to SurfaceManager, so it | 312 // RenderWidgetHostView holds on to a reference to SurfaceManager, so it |
308 // must be shut down before the ImageTransportFactory. | 313 // must be shut down before the ImageTransportFactory. |
309 ImageTransportFactory::Terminate(); | 314 ImageTransportFactory::Terminate(); |
310 #else | 315 #else |
| 316 display::Screen::SetScreenInstance(nullptr); |
311 ui::ContextProviderFactory::SetInstance(nullptr); | 317 ui::ContextProviderFactory::SetInstance(nullptr); |
312 ContextProviderFactoryImpl::Terminate(); | 318 ContextProviderFactoryImpl::Terminate(); |
313 gpu_channel_factory_.reset(); | 319 gpu_channel_factory_.reset(); |
314 #endif | 320 #endif |
315 } | 321 } |
316 | 322 |
317 BrowserContext* RenderViewHostTestHarness::CreateBrowserContext() { | 323 BrowserContext* RenderViewHostTestHarness::CreateBrowserContext() { |
318 return new TestBrowserContext(); | 324 return new TestBrowserContext(); |
319 } | 325 } |
320 | 326 |
321 void RenderViewHostTestHarness::SetRenderProcessHostFactory( | 327 void RenderViewHostTestHarness::SetRenderProcessHostFactory( |
322 RenderProcessHostFactory* factory) { | 328 RenderProcessHostFactory* factory) { |
323 rvh_test_enabler_.rvh_factory_->set_render_process_host_factory(factory); | 329 rvh_test_enabler_.rvh_factory_->set_render_process_host_factory(factory); |
324 } | 330 } |
325 | 331 |
326 } // namespace content | 332 } // namespace content |
OLD | NEW |