Chromium Code Reviews| 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/test/gl_surface_test_support.h" | 31 #include "ui/gl/test/gl_surface_test_support.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/native_pixmap_manager.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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 82 ContentTestSuiteBase::Initialize(); | 86 ContentTestSuiteBase::Initialize(); |
| 83 { | 87 { |
| 84 ContentClient client; | 88 ContentClient client; |
| 85 ContentTestSuiteBase::RegisterContentSchemes(&client); | 89 ContentTestSuiteBase::RegisterContentSchemes(&client); |
| 86 } | 90 } |
| 87 RegisterPathProvider(); | 91 RegisterPathProvider(); |
| 88 #if !defined(OS_IOS) | 92 #if !defined(OS_IOS) |
| 89 media::InitializeMediaLibrary(); | 93 media::InitializeMediaLibrary(); |
| 90 // When running in a child process for Mac sandbox tests, the sandbox exists | 94 // When running in a child process for Mac sandbox tests, the sandbox exists |
| 91 // to initialize GL, so don't do it here. | 95 // to initialize GL, so don't do it here. |
| 92 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( | 96 bool is_child_process = base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 93 switches::kTestChildProcess)) { | 97 switches::kTestChildProcess); |
| 98 if (!is_child_process) { | |
| 94 gfx::GLSurfaceTestSupport::InitializeOneOff(); | 99 gfx::GLSurfaceTestSupport::InitializeOneOff(); |
| 95 gpu::ApplyGpuDriverBugWorkarounds(base::CommandLine::ForCurrentProcess()); | 100 gpu::ApplyGpuDriverBugWorkarounds(base::CommandLine::ForCurrentProcess()); |
| 96 } | 101 } |
| 97 #endif | 102 #endif |
| 98 testing::TestEventListeners& listeners = | 103 testing::TestEventListeners& listeners = |
| 99 testing::UnitTest::GetInstance()->listeners(); | 104 testing::UnitTest::GetInstance()->listeners(); |
| 100 listeners.Append(new TestInitializationListener); | 105 listeners.Append(new TestInitializationListener); |
| 101 #if defined(OS_ANDROID) | 106 #if defined(OS_ANDROID) |
| 102 SurfaceTextureManager::SetInstance( | 107 SurfaceTextureManager::SetInstance( |
| 103 InProcessSurfaceTextureManager::GetInstance()); | 108 InProcessSurfaceTextureManager::GetInstance()); |
| 104 #endif | 109 #endif |
| 105 #if defined(OS_MACOSX) && !defined(OS_IOS) | 110 #if defined(OS_MACOSX) && !defined(OS_IOS) |
| 106 IOSurfaceManager::SetInstance(InProcessIOSurfaceManager::GetInstance()); | 111 IOSurfaceManager::SetInstance(InProcessIOSurfaceManager::GetInstance()); |
| 107 #endif | 112 #endif |
| 113 #if defined(USE_OZONE) | |
| 114 if (!is_child_process) { | |
| 115 ui::NativePixmapManager::SetInstance( | |
| 116 ui::NativePixmapManager::Create().release()); | |
|
reveman
2015/07/23 18:25:23
Don't leak the manager instance here as well.
dshwang
2015/07/24 12:19:00
Done.
| |
| 117 } | |
| 118 #endif | |
| 108 } | 119 } |
| 109 | 120 |
| 110 } // namespace content | 121 } // namespace content |
| OLD | NEW |