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 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 ui::MaterialDesignController::Initialize(); | 197 ui::MaterialDesignController::Initialize(); |
197 thread_bundle_.reset(new TestBrowserThreadBundle(thread_bundle_options_)); | 198 thread_bundle_.reset(new TestBrowserThreadBundle(thread_bundle_options_)); |
198 | 199 |
199 #if defined(OS_WIN) | 200 #if defined(OS_WIN) |
200 ole_initializer_.reset(new ui::ScopedOleInitializer()); | 201 ole_initializer_.reset(new ui::ScopedOleInitializer()); |
201 #endif | 202 #endif |
202 #if !defined(OS_ANDROID) | 203 #if !defined(OS_ANDROID) |
203 ImageTransportFactory::InitializeForUnitTests( | 204 ImageTransportFactory::InitializeForUnitTests( |
204 base::WrapUnique(new NoTransportImageTransportFactory)); | 205 base::WrapUnique(new NoTransportImageTransportFactory)); |
205 #else | 206 #else |
| 207 gpu_channel_factory_ = base::MakeUnique<MockGpuChannelEstablishFactory>(); |
| 208 ContextProviderFactoryImpl::Initialize(gpu_channel_factory_.get()); |
206 ui::ContextProviderFactory::SetInstance( | 209 ui::ContextProviderFactory::SetInstance( |
207 ContextProviderFactoryImpl::GetInstance()); | 210 ContextProviderFactoryImpl::GetInstance()); |
208 #endif | 211 #endif |
209 #if defined(USE_AURA) | 212 #if defined(USE_AURA) |
210 ui::ContextFactory* context_factory = | 213 ui::ContextFactory* context_factory = |
211 ImageTransportFactory::GetInstance()->GetContextFactory(); | 214 ImageTransportFactory::GetInstance()->GetContextFactory(); |
212 | 215 |
213 aura_test_helper_.reset( | 216 aura_test_helper_.reset( |
214 new aura::test::AuraTestHelper(base::MessageLoopForUI::current())); | 217 new aura::test::AuraTestHelper(base::MessageLoopForUI::current())); |
215 aura_test_helper_->SetUp(context_factory); | 218 aura_test_helper_->SetUp(context_factory); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 FROM_HERE, | 268 FROM_HERE, |
266 browser_context_.release()); | 269 browser_context_.release()); |
267 thread_bundle_.reset(); | 270 thread_bundle_.reset(); |
268 | 271 |
269 #if !defined(OS_ANDROID) | 272 #if !defined(OS_ANDROID) |
270 // RenderWidgetHostView holds on to a reference to SurfaceManager, so it | 273 // RenderWidgetHostView holds on to a reference to SurfaceManager, so it |
271 // must be shut down before the ImageTransportFactory. | 274 // must be shut down before the ImageTransportFactory. |
272 ImageTransportFactory::Terminate(); | 275 ImageTransportFactory::Terminate(); |
273 #else | 276 #else |
274 ui::ContextProviderFactory::SetInstance(nullptr); | 277 ui::ContextProviderFactory::SetInstance(nullptr); |
| 278 ContextProviderFactoryImpl::Terminate(); |
| 279 gpu_channel_factory_.reset(); |
275 #endif | 280 #endif |
276 } | 281 } |
277 | 282 |
278 BrowserContext* RenderViewHostTestHarness::CreateBrowserContext() { | 283 BrowserContext* RenderViewHostTestHarness::CreateBrowserContext() { |
279 return new TestBrowserContext(); | 284 return new TestBrowserContext(); |
280 } | 285 } |
281 | 286 |
282 void RenderViewHostTestHarness::SetRenderProcessHostFactory( | 287 void RenderViewHostTestHarness::SetRenderProcessHostFactory( |
283 RenderProcessHostFactory* factory) { | 288 RenderProcessHostFactory* factory) { |
284 rvh_test_enabler_.rvh_factory_->set_render_process_host_factory(factory); | 289 rvh_test_enabler_.rvh_factory_->set_render_process_host_factory(factory); |
285 } | 290 } |
286 | 291 |
287 } // namespace content | 292 } // namespace content |
OLD | NEW |