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