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/command_line.h" |
9 #include "base/logging.h" | 10 #include "base/logging.h" |
10 #include "base/macros.h" | 11 #include "base/macros.h" |
11 #include "build/build_config.h" | 12 #include "build/build_config.h" |
12 #include "content/public/common/content_client.h" | 13 #include "content/public/common/content_client.h" |
13 #include "content/public/common/content_paths.h" | 14 #include "content/public/common/content_paths.h" |
14 #include "content/public/test/test_content_client_initializer.h" | 15 #include "content/public/test/test_content_client_initializer.h" |
15 #include "gpu/config/gpu_info_collector.h" | 16 #include "gpu/config/gpu_info_collector.h" |
16 #include "gpu/config/gpu_util.h" | 17 #include "gpu/config/gpu_util.h" |
| 18 #include "media/base/media.h" |
17 #include "testing/gtest/include/gtest/gtest.h" | 19 #include "testing/gtest/include/gtest/gtest.h" |
| 20 #include "ui/gl/test/gl_surface_test_support.h" |
18 | 21 |
19 #if defined(OS_WIN) | 22 #if defined(OS_WIN) |
20 #include "ui/gfx/win/dpi.h" | 23 #include "ui/gfx/win/dpi.h" |
21 #endif | 24 #endif |
22 | 25 |
23 #if defined(OS_MACOSX) | 26 #if defined(OS_MACOSX) |
24 #include "base/mac/scoped_nsautorelease_pool.h" | 27 #include "base/mac/scoped_nsautorelease_pool.h" |
25 #if !defined(OS_IOS) | |
26 #include "base/test/mock_chrome_application_mac.h" | 28 #include "base/test/mock_chrome_application_mac.h" |
27 #endif | 29 #endif |
28 #endif | |
29 | |
30 #if !defined(OS_IOS) | |
31 #include "base/base_switches.h" | |
32 #include "base/command_line.h" | |
33 #include "media/base/media.h" | |
34 #include "ui/gl/test/gl_surface_test_support.h" | |
35 #endif | |
36 | 30 |
37 #if defined(OS_ANDROID) | 31 #if defined(OS_ANDROID) |
38 #include "content/browser/android/in_process_surface_texture_manager.h" | 32 #include "content/browser/android/in_process_surface_texture_manager.h" |
39 #endif | 33 #endif |
40 | 34 |
41 #if defined(USE_OZONE) | 35 #if defined(USE_OZONE) |
42 #include "ui/ozone/public/client_native_pixmap_factory.h" | 36 #include "ui/ozone/public/client_native_pixmap_factory.h" |
43 #include "ui/ozone/public/ozone_platform.h" | 37 #include "ui/ozone/public/ozone_platform.h" |
44 #endif | 38 #endif |
45 | 39 |
(...skipping 25 matching lines...) Expand all Loading... |
71 ContentTestSuite::ContentTestSuite(int argc, char** argv) | 65 ContentTestSuite::ContentTestSuite(int argc, char** argv) |
72 : ContentTestSuiteBase(argc, argv) { | 66 : ContentTestSuiteBase(argc, argv) { |
73 } | 67 } |
74 | 68 |
75 ContentTestSuite::~ContentTestSuite() { | 69 ContentTestSuite::~ContentTestSuite() { |
76 } | 70 } |
77 | 71 |
78 void ContentTestSuite::Initialize() { | 72 void ContentTestSuite::Initialize() { |
79 #if defined(OS_MACOSX) | 73 #if defined(OS_MACOSX) |
80 base::mac::ScopedNSAutoreleasePool autorelease_pool; | 74 base::mac::ScopedNSAutoreleasePool autorelease_pool; |
81 #if !defined(OS_IOS) | |
82 mock_cr_app::RegisterMockCrApp(); | 75 mock_cr_app::RegisterMockCrApp(); |
83 #endif | 76 #endif |
84 #endif | |
85 | 77 |
86 #if defined(OS_WIN) | 78 #if defined(OS_WIN) |
87 gfx::SetDefaultDeviceScaleFactor(1.0f); | 79 gfx::SetDefaultDeviceScaleFactor(1.0f); |
88 #endif | 80 #endif |
89 | 81 |
90 ContentTestSuiteBase::Initialize(); | 82 ContentTestSuiteBase::Initialize(); |
91 { | 83 { |
92 ContentClient client; | 84 ContentClient client; |
93 ContentTestSuiteBase::RegisterContentSchemes(&client); | 85 ContentTestSuiteBase::RegisterContentSchemes(&client); |
94 } | 86 } |
95 RegisterPathProvider(); | 87 RegisterPathProvider(); |
96 #if !defined(OS_IOS) | |
97 media::InitializeMediaLibrary(); | 88 media::InitializeMediaLibrary(); |
98 // When running in a child process for Mac sandbox tests, the sandbox exists | 89 // When running in a child process for Mac sandbox tests, the sandbox exists |
99 // to initialize GL, so don't do it here. | 90 // to initialize GL, so don't do it here. |
100 bool is_child_process = base::CommandLine::ForCurrentProcess()->HasSwitch( | 91 bool is_child_process = base::CommandLine::ForCurrentProcess()->HasSwitch( |
101 switches::kTestChildProcess); | 92 switches::kTestChildProcess); |
102 if (!is_child_process) { | 93 if (!is_child_process) { |
103 gpu::GPUInfo gpu_info; | 94 gpu::GPUInfo gpu_info; |
104 gpu::CollectBasicGraphicsInfo(&gpu_info); | 95 gpu::CollectBasicGraphicsInfo(&gpu_info); |
105 gpu::ApplyGpuDriverBugWorkarounds(gpu_info, | 96 gpu::ApplyGpuDriverBugWorkarounds(gpu_info, |
106 base::CommandLine::ForCurrentProcess()); | 97 base::CommandLine::ForCurrentProcess()); |
107 gfx::GLSurfaceTestSupport::InitializeOneOff(); | 98 gfx::GLSurfaceTestSupport::InitializeOneOff(); |
108 } | 99 } |
109 #endif | |
110 testing::TestEventListeners& listeners = | 100 testing::TestEventListeners& listeners = |
111 testing::UnitTest::GetInstance()->listeners(); | 101 testing::UnitTest::GetInstance()->listeners(); |
112 listeners.Append(new TestInitializationListener); | 102 listeners.Append(new TestInitializationListener); |
113 #if defined(OS_ANDROID) | 103 #if defined(OS_ANDROID) |
114 gpu::SurfaceTextureManager::SetInstance( | 104 gpu::SurfaceTextureManager::SetInstance( |
115 InProcessSurfaceTextureManager::GetInstance()); | 105 InProcessSurfaceTextureManager::GetInstance()); |
116 #endif | 106 #endif |
117 #if defined(USE_OZONE) | 107 #if defined(USE_OZONE) |
118 if (!is_child_process) { | 108 if (!is_child_process) { |
119 client_native_pixmap_factory_ = ui::ClientNativePixmapFactory::Create(); | 109 client_native_pixmap_factory_ = ui::ClientNativePixmapFactory::Create(); |
120 ui::ClientNativePixmapFactory::SetInstance( | 110 ui::ClientNativePixmapFactory::SetInstance( |
121 client_native_pixmap_factory_.get()); | 111 client_native_pixmap_factory_.get()); |
122 ui::ClientNativePixmapFactory::GetInstance()->Initialize( | 112 ui::ClientNativePixmapFactory::GetInstance()->Initialize( |
123 ui::OzonePlatform::GetInstance()->OpenClientNativePixmapDevice()); | 113 ui::OzonePlatform::GetInstance()->OpenClientNativePixmapDevice()); |
124 } | 114 } |
125 #endif | 115 #endif |
126 } | 116 } |
127 | 117 |
128 } // namespace content | 118 } // namespace content |
OLD | NEW |