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