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/test/content_test_suite.h" | 5 #include "content/test/content_test_suite.h" |
6 | 6 |
7 #include "base/base_paths.h" | 7 #include "base/base_paths.h" |
8 #include "base/base_switches.h" | 8 #include "base/base_switches.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "content/public/common/content_client.h" | 10 #include "content/public/common/content_client.h" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 #if defined(OS_MACOSX) | 77 #if defined(OS_MACOSX) |
78 base::mac::ScopedNSAutoreleasePool autorelease_pool; | 78 base::mac::ScopedNSAutoreleasePool autorelease_pool; |
79 #if !defined(OS_IOS) | 79 #if !defined(OS_IOS) |
80 mock_cr_app::RegisterMockCrApp(); | 80 mock_cr_app::RegisterMockCrApp(); |
81 #endif | 81 #endif |
82 #endif | 82 #endif |
83 | 83 |
84 #if defined(OS_WIN) | 84 #if defined(OS_WIN) |
85 gfx::InitDeviceScaleFactor(1.0f); | 85 gfx::InitDeviceScaleFactor(1.0f); |
86 #endif | 86 #endif |
| 87 #if !defined(OS_IOS) |
| 88 bool is_child_process = base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 89 switches::kTestChildProcess); |
| 90 #endif |
| 91 #if defined(USE_OZONE) |
| 92 if (!is_child_process) { |
| 93 ozone_ = ui::OzoneInitializerForTest::Create(); |
| 94 DCHECK(ozone_); |
| 95 } |
| 96 #endif |
87 | 97 |
88 ContentTestSuiteBase::Initialize(); | 98 ContentTestSuiteBase::Initialize(); |
89 { | 99 { |
90 ContentClient client; | 100 ContentClient client; |
91 ContentTestSuiteBase::RegisterContentSchemes(&client); | 101 ContentTestSuiteBase::RegisterContentSchemes(&client); |
92 } | 102 } |
93 RegisterPathProvider(); | 103 RegisterPathProvider(); |
94 #if !defined(OS_IOS) | 104 #if !defined(OS_IOS) |
95 media::InitializeMediaLibrary(); | 105 media::InitializeMediaLibrary(); |
96 // When running in a child process for Mac sandbox tests, the sandbox exists | 106 // When running in a child process for Mac sandbox tests, the sandbox exists |
97 // to initialize GL, so don't do it here. | 107 // to initialize GL, so don't do it here. |
98 bool is_child_process = base::CommandLine::ForCurrentProcess()->HasSwitch( | |
99 switches::kTestChildProcess); | |
100 if (!is_child_process) { | 108 if (!is_child_process) { |
101 gfx::GLSurfaceTestSupport::InitializeOneOff(); | 109 gfx::GLSurfaceTestSupport::InitializeOneOff(); |
102 gpu::ApplyGpuDriverBugWorkarounds(base::CommandLine::ForCurrentProcess()); | 110 gpu::ApplyGpuDriverBugWorkarounds(base::CommandLine::ForCurrentProcess()); |
103 } | 111 } |
104 #endif | 112 #endif |
105 testing::TestEventListeners& listeners = | 113 testing::TestEventListeners& listeners = |
106 testing::UnitTest::GetInstance()->listeners(); | 114 testing::UnitTest::GetInstance()->listeners(); |
107 listeners.Append(new TestInitializationListener); | 115 listeners.Append(new TestInitializationListener); |
108 #if defined(OS_ANDROID) | 116 #if defined(OS_ANDROID) |
109 SurfaceTextureManager::SetInstance( | 117 SurfaceTextureManager::SetInstance( |
110 InProcessSurfaceTextureManager::GetInstance()); | 118 InProcessSurfaceTextureManager::GetInstance()); |
111 #endif | 119 #endif |
112 #if defined(OS_MACOSX) && !defined(OS_IOS) | 120 #if defined(OS_MACOSX) && !defined(OS_IOS) |
113 gfx::IOSurfaceManager::SetInstance(InProcessIOSurfaceManager::GetInstance()); | 121 gfx::IOSurfaceManager::SetInstance(InProcessIOSurfaceManager::GetInstance()); |
114 #endif | 122 #endif |
115 #if defined(USE_OZONE) | 123 #if defined(USE_OZONE) |
116 if (!is_child_process) { | 124 if (!is_child_process) { |
117 client_native_pixmap_factory_ = ui::ClientNativePixmapFactory::Create(); | 125 client_native_pixmap_factory_ = ui::ClientNativePixmapFactory::Create(); |
118 ui::ClientNativePixmapFactory::SetInstance( | 126 ui::ClientNativePixmapFactory::SetInstance( |
119 client_native_pixmap_factory_.get()); | 127 client_native_pixmap_factory_.get()); |
120 ui::ClientNativePixmapFactory::GetInstance()->Initialize( | 128 ui::ClientNativePixmapFactory::GetInstance()->Initialize( |
121 ui::OzonePlatform::GetInstance()->OpenClientNativePixmapDevice()); | 129 ui::OzonePlatform::GetInstance()->OpenClientNativePixmapDevice()); |
122 } | 130 } |
123 #endif | 131 #endif |
124 } | 132 } |
125 | 133 |
126 } // namespace content | 134 } // namespace content |
OLD | NEW |