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 #if defined(OS_ANDROID) | 7 #if defined(OS_ANDROID) |
| 8 #include <android/native_window.h> | 8 #include <android/native_window.h> |
| 9 #include <android/native_window_jni.h> | 9 #include <android/native_window_jni.h> |
| 10 #include <map> | 10 #include <map> |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 37 #endif | 37 #endif |
| 38 | 38 |
| 39 #if defined(OS_ANDROID) | 39 #if defined(OS_ANDROID) |
| 40 #include "base/android/jni_android.h" | 40 #include "base/android/jni_android.h" |
| 41 #include "base/memory/linked_ptr.h" | 41 #include "base/memory/linked_ptr.h" |
| 42 #include "content/common/android/surface_texture_manager.h" | 42 #include "content/common/android/surface_texture_manager.h" |
| 43 #include "ui/gl/android/scoped_java_surface.h" | 43 #include "ui/gl/android/scoped_java_surface.h" |
| 44 #include "ui/gl/android/surface_texture.h" | 44 #include "ui/gl/android/surface_texture.h" |
| 45 #endif | 45 #endif |
| 46 | 46 |
| 47 #if defined (USE_OZONE) | |
| 48 #include "base/message_loop/message_loop.h" | |
| 49 #endif | |
| 50 | |
| 47 namespace content { | 51 namespace content { |
| 48 namespace { | 52 namespace { |
| 49 | 53 |
| 50 class TestInitializationListener : public testing::EmptyTestEventListener { | 54 class TestInitializationListener : public testing::EmptyTestEventListener { |
| 51 public: | 55 public: |
| 52 TestInitializationListener() : test_content_client_initializer_(NULL) { | 56 TestInitializationListener() : test_content_client_initializer_(NULL) { |
| 53 } | 57 } |
| 54 | 58 |
| 55 virtual void OnTestStart(const testing::TestInfo& test_info) override { | 59 virtual void OnTestStart(const testing::TestInfo& test_info) override { |
| 56 test_content_client_initializer_ = | 60 test_content_client_initializer_ = |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 103 ContentTestSuite::~ContentTestSuite() { | 107 ContentTestSuite::~ContentTestSuite() { |
| 104 } | 108 } |
| 105 | 109 |
| 106 void ContentTestSuite::Initialize() { | 110 void ContentTestSuite::Initialize() { |
| 107 #if defined(OS_MACOSX) | 111 #if defined(OS_MACOSX) |
| 108 base::mac::ScopedNSAutoreleasePool autorelease_pool; | 112 base::mac::ScopedNSAutoreleasePool autorelease_pool; |
| 109 #if !defined(OS_IOS) | 113 #if !defined(OS_IOS) |
| 110 mock_cr_app::RegisterMockCrApp(); | 114 mock_cr_app::RegisterMockCrApp(); |
| 111 #endif | 115 #endif |
| 112 #endif | 116 #endif |
| 113 | 117 #if defined(USE_OZONE) |
| 118 base::MessageLoopForUI main_loop; | |
|
sky
2015/03/30 14:46:38
None of the other platforms initialize the message
vignatti (out of this project)
2015/03/30 15:01:50
A few Ozone implementations like the GBM requires
| |
| 119 #endif | |
| 114 #if defined(OS_WIN) | 120 #if defined(OS_WIN) |
| 115 gfx::InitDeviceScaleFactor(1.0f); | 121 gfx::InitDeviceScaleFactor(1.0f); |
| 116 #endif | 122 #endif |
| 117 | 123 |
| 118 ContentTestSuiteBase::Initialize(); | 124 ContentTestSuiteBase::Initialize(); |
| 119 { | 125 { |
| 120 ContentClient client; | 126 ContentClient client; |
| 121 ContentTestSuiteBase::RegisterContentSchemes(&client); | 127 ContentTestSuiteBase::RegisterContentSchemes(&client); |
| 122 } | 128 } |
| 123 RegisterPathProvider(); | 129 RegisterPathProvider(); |
| 124 #if !defined(OS_IOS) | 130 #if !defined(OS_IOS) |
| 125 media::InitializeMediaLibraryForTesting(); | 131 media::InitializeMediaLibraryForTesting(); |
| 126 // When running in a child process for Mac sandbox tests, the sandbox exists | 132 // When running in a child process for Mac sandbox tests, the sandbox exists |
| 127 // to initialize GL, so don't do it here. | 133 // to initialize GL, so don't do it here. |
| 128 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( | 134 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 129 switches::kTestChildProcess)) { | 135 switches::kTestChildProcess)) { |
| 130 gfx::GLSurface::InitializeOneOffForTests(); | 136 gfx::GLSurface::InitializeOneOffForTests(); |
| 131 gpu::ApplyGpuDriverBugWorkarounds(base::CommandLine::ForCurrentProcess()); | 137 gpu::ApplyGpuDriverBugWorkarounds(base::CommandLine::ForCurrentProcess()); |
| 132 } | 138 } |
| 133 #endif | 139 #endif |
| 134 testing::TestEventListeners& listeners = | 140 testing::TestEventListeners& listeners = |
| 135 testing::UnitTest::GetInstance()->listeners(); | 141 testing::UnitTest::GetInstance()->listeners(); |
| 136 listeners.Append(new TestInitializationListener); | 142 listeners.Append(new TestInitializationListener); |
| 137 #if defined(OS_ANDROID) | 143 #if defined(OS_ANDROID) |
| 138 SurfaceTextureManager::InitInstance(new SurfaceTextureManagerImpl); | 144 SurfaceTextureManager::InitInstance(new SurfaceTextureManagerImpl); |
| 139 #endif | 145 #endif |
| 140 } | 146 } |
| 141 | 147 |
| 142 } // namespace content | 148 } // namespace content |
| OLD | NEW |