| 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/logging.h" | 8 #include "base/logging.h" |
| 9 #include "content/public/common/content_client.h" | 9 #include "content/public/common/content_client.h" |
| 10 #include "content/public/common/content_paths.h" | 10 #include "content/public/common/content_paths.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 #include "base/base_switches.h" | 28 #include "base/base_switches.h" |
| 29 #include "base/command_line.h" | 29 #include "base/command_line.h" |
| 30 #include "media/base/media.h" | 30 #include "media/base/media.h" |
| 31 #include "ui/gl/gl_surface.h" | 31 #include "ui/gl/gl_surface.h" |
| 32 #endif | 32 #endif |
| 33 | 33 |
| 34 #if defined(OS_ANDROID) | 34 #if defined(OS_ANDROID) |
| 35 #include "content/browser/android/in_process_surface_texture_manager.h" | 35 #include "content/browser/android/in_process_surface_texture_manager.h" |
| 36 #endif | 36 #endif |
| 37 | 37 |
| 38 #if defined(USE_OZONE) |
| 39 #include "ui/ozone/public/ozone_platform.h" |
| 40 #endif |
| 41 |
| 38 namespace content { | 42 namespace content { |
| 39 namespace { | 43 namespace { |
| 40 | 44 |
| 41 class TestInitializationListener : public testing::EmptyTestEventListener { | 45 class TestInitializationListener : public testing::EmptyTestEventListener { |
| 42 public: | 46 public: |
| 43 TestInitializationListener() : test_content_client_initializer_(NULL) { | 47 TestInitializationListener() : test_content_client_initializer_(NULL) { |
| 44 } | 48 } |
| 45 | 49 |
| 46 void OnTestStart(const testing::TestInfo& test_info) override { | 50 void OnTestStart(const testing::TestInfo& test_info) override { |
| 47 test_content_client_initializer_ = | 51 test_content_client_initializer_ = |
| (...skipping 23 matching lines...) Expand all Loading... |
| 71 #if defined(OS_MACOSX) | 75 #if defined(OS_MACOSX) |
| 72 base::mac::ScopedNSAutoreleasePool autorelease_pool; | 76 base::mac::ScopedNSAutoreleasePool autorelease_pool; |
| 73 #if !defined(OS_IOS) | 77 #if !defined(OS_IOS) |
| 74 mock_cr_app::RegisterMockCrApp(); | 78 mock_cr_app::RegisterMockCrApp(); |
| 75 #endif | 79 #endif |
| 76 #endif | 80 #endif |
| 77 | 81 |
| 78 #if defined(OS_WIN) | 82 #if defined(OS_WIN) |
| 79 gfx::InitDeviceScaleFactor(1.0f); | 83 gfx::InitDeviceScaleFactor(1.0f); |
| 80 #endif | 84 #endif |
| 85 #if !defined(OS_IOS) |
| 86 bool is_child_process = base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 87 switches::kTestChildProcess); |
| 88 #if defined(USE_OZONE) |
| 89 if (!is_child_process) { |
| 90 ui::OzonePlatform::InitializeForTest(); |
| 91 } |
| 92 #endif |
| 93 #endif |
| 81 | 94 |
| 82 ContentTestSuiteBase::Initialize(); | 95 ContentTestSuiteBase::Initialize(); |
| 83 { | 96 { |
| 84 ContentClient client; | 97 ContentClient client; |
| 85 ContentTestSuiteBase::RegisterContentSchemes(&client); | 98 ContentTestSuiteBase::RegisterContentSchemes(&client); |
| 86 } | 99 } |
| 87 RegisterPathProvider(); | 100 RegisterPathProvider(); |
| 88 #if !defined(OS_IOS) | 101 #if !defined(OS_IOS) |
| 89 media::InitializeMediaLibrary(); | 102 media::InitializeMediaLibrary(); |
| 90 // When running in a child process for Mac sandbox tests, the sandbox exists | 103 // When running in a child process for Mac sandbox tests, the sandbox exists |
| 91 // to initialize GL, so don't do it here. | 104 // to initialize GL, so don't do it here. |
| 92 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( | 105 if (!is_child_process) { |
| 93 switches::kTestChildProcess)) { | |
| 94 gfx::GLSurface::InitializeOneOffForTests(); | 106 gfx::GLSurface::InitializeOneOffForTests(); |
| 95 gpu::ApplyGpuDriverBugWorkarounds(base::CommandLine::ForCurrentProcess()); | 107 gpu::ApplyGpuDriverBugWorkarounds(base::CommandLine::ForCurrentProcess()); |
| 96 } | 108 } |
| 97 #endif | 109 #endif |
| 98 testing::TestEventListeners& listeners = | 110 testing::TestEventListeners& listeners = |
| 99 testing::UnitTest::GetInstance()->listeners(); | 111 testing::UnitTest::GetInstance()->listeners(); |
| 100 listeners.Append(new TestInitializationListener); | 112 listeners.Append(new TestInitializationListener); |
| 101 #if defined(OS_ANDROID) | 113 #if defined(OS_ANDROID) |
| 102 SurfaceTextureManager::SetInstance( | 114 SurfaceTextureManager::SetInstance( |
| 103 InProcessSurfaceTextureManager::GetInstance()); | 115 InProcessSurfaceTextureManager::GetInstance()); |
| 104 #endif | 116 #endif |
| 105 #if defined(OS_MACOSX) && !defined(OS_IOS) | 117 #if defined(OS_MACOSX) && !defined(OS_IOS) |
| 106 IOSurfaceManager::SetInstance(InProcessIOSurfaceManager::GetInstance()); | 118 IOSurfaceManager::SetInstance(InProcessIOSurfaceManager::GetInstance()); |
| 107 #endif | 119 #endif |
| 108 } | 120 } |
| 109 | 121 |
| 110 } // namespace content | 122 } // namespace content |
| OLD | NEW |