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 "base/macros.h" | 10 #include "base/macros.h" |
11 #include "build/build_config.h" | 11 #include "build/build_config.h" |
12 #include "content/public/common/content_client.h" | 12 #include "content/public/common/content_client.h" |
13 #include "content/public/common/content_paths.h" | 13 #include "content/public/common/content_paths.h" |
14 #include "content/public/test/test_content_client_initializer.h" | 14 #include "content/public/test/test_content_client_initializer.h" |
15 #include "gpu/config/gpu_util.h" | 15 #include "gpu/config/gpu_util.h" |
| 16 #include "mojo/edk/embedder/embedder.h" |
16 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
17 | 18 |
18 #if defined(OS_WIN) | 19 #if defined(OS_WIN) |
19 #include "ui/gfx/win/dpi.h" | 20 #include "ui/gfx/win/dpi.h" |
20 #endif | 21 #endif |
21 | 22 |
22 #if defined(OS_MACOSX) | 23 #if defined(OS_MACOSX) |
23 #include "base/mac/scoped_nsautorelease_pool.h" | 24 #include "base/mac/scoped_nsautorelease_pool.h" |
24 #if !defined(OS_IOS) | 25 #if !defined(OS_IOS) |
25 #include "base/test/mock_chrome_application_mac.h" | 26 #include "base/test/mock_chrome_application_mac.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 | 62 |
62 private: | 63 private: |
63 content::TestContentClientInitializer* test_content_client_initializer_; | 64 content::TestContentClientInitializer* test_content_client_initializer_; |
64 | 65 |
65 DISALLOW_COPY_AND_ASSIGN(TestInitializationListener); | 66 DISALLOW_COPY_AND_ASSIGN(TestInitializationListener); |
66 }; | 67 }; |
67 | 68 |
68 } // namespace | 69 } // namespace |
69 | 70 |
70 ContentTestSuite::ContentTestSuite(int argc, char** argv) | 71 ContentTestSuite::ContentTestSuite(int argc, char** argv) |
71 : ContentTestSuiteBase(argc, argv) { | 72 : ContentTestSuiteBase(argc, argv), |
| 73 test_io_thread_(base::TestIOThread::kAutoStart) { |
72 } | 74 } |
73 | 75 |
74 ContentTestSuite::~ContentTestSuite() { | 76 ContentTestSuite::~ContentTestSuite() { |
75 } | 77 } |
76 | 78 |
77 void ContentTestSuite::Initialize() { | 79 void ContentTestSuite::Initialize() { |
78 #if defined(OS_MACOSX) | 80 #if defined(OS_MACOSX) |
79 base::mac::ScopedNSAutoreleasePool autorelease_pool; | 81 base::mac::ScopedNSAutoreleasePool autorelease_pool; |
80 #if !defined(OS_IOS) | 82 #if !defined(OS_IOS) |
81 mock_cr_app::RegisterMockCrApp(); | 83 mock_cr_app::RegisterMockCrApp(); |
82 #endif | 84 #endif |
83 #endif | 85 #endif |
84 | 86 |
85 #if defined(OS_WIN) | 87 #if defined(OS_WIN) |
86 gfx::SetDefaultDeviceScaleFactor(1.0f); | 88 gfx::SetDefaultDeviceScaleFactor(1.0f); |
87 #endif | 89 #endif |
88 | 90 |
89 ContentTestSuiteBase::Initialize(); | 91 ContentTestSuiteBase::Initialize(); |
90 { | 92 { |
91 ContentClient client; | 93 ContentClient client; |
92 ContentTestSuiteBase::RegisterContentSchemes(&client); | 94 ContentTestSuiteBase::RegisterContentSchemes(&client); |
93 } | 95 } |
94 RegisterPathProvider(); | 96 RegisterPathProvider(); |
| 97 mojo::edk::Init(test_io_thread_.task_runner()); |
95 #if !defined(OS_IOS) | 98 #if !defined(OS_IOS) |
96 media::InitializeMediaLibrary(); | 99 media::InitializeMediaLibrary(); |
97 // When running in a child process for Mac sandbox tests, the sandbox exists | 100 // When running in a child process for Mac sandbox tests, the sandbox exists |
98 // to initialize GL, so don't do it here. | 101 // to initialize GL, so don't do it here. |
99 bool is_child_process = base::CommandLine::ForCurrentProcess()->HasSwitch( | 102 bool is_child_process = base::CommandLine::ForCurrentProcess()->HasSwitch( |
100 switches::kTestChildProcess); | 103 switches::kTestChildProcess); |
101 if (!is_child_process) { | 104 if (!is_child_process) { |
102 gfx::GLSurfaceTestSupport::InitializeOneOff(); | 105 gfx::GLSurfaceTestSupport::InitializeOneOff(); |
103 gpu::ApplyGpuDriverBugWorkarounds(base::CommandLine::ForCurrentProcess()); | 106 gpu::ApplyGpuDriverBugWorkarounds(base::CommandLine::ForCurrentProcess()); |
104 } | 107 } |
(...skipping 10 matching lines...) Expand all Loading... |
115 client_native_pixmap_factory_ = ui::ClientNativePixmapFactory::Create(); | 118 client_native_pixmap_factory_ = ui::ClientNativePixmapFactory::Create(); |
116 ui::ClientNativePixmapFactory::SetInstance( | 119 ui::ClientNativePixmapFactory::SetInstance( |
117 client_native_pixmap_factory_.get()); | 120 client_native_pixmap_factory_.get()); |
118 ui::ClientNativePixmapFactory::GetInstance()->Initialize( | 121 ui::ClientNativePixmapFactory::GetInstance()->Initialize( |
119 ui::OzonePlatform::GetInstance()->OpenClientNativePixmapDevice()); | 122 ui::OzonePlatform::GetInstance()->OpenClientNativePixmapDevice()); |
120 } | 123 } |
121 #endif | 124 #endif |
122 } | 125 } |
123 | 126 |
124 } // namespace content | 127 } // namespace content |
OLD | NEW |