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/message_loop/message_loop.h" | |
10 #include "content/public/common/content_client.h" | 11 #include "content/public/common/content_client.h" |
11 #include "content/public/common/content_paths.h" | 12 #include "content/public/common/content_paths.h" |
12 #include "content/public/test/test_content_client_initializer.h" | 13 #include "content/public/test/test_content_client_initializer.h" |
13 #include "gpu/config/gpu_util.h" | 14 #include "gpu/config/gpu_util.h" |
14 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
15 | 16 |
16 #if defined(OS_WIN) | 17 #if defined(OS_WIN) |
17 #include "ui/gfx/win/dpi.h" | 18 #include "ui/gfx/win/dpi.h" |
18 #endif | 19 #endif |
19 | 20 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
67 } // namespace | 68 } // namespace |
68 | 69 |
69 ContentTestSuite::ContentTestSuite(int argc, char** argv) | 70 ContentTestSuite::ContentTestSuite(int argc, char** argv) |
70 : ContentTestSuiteBase(argc, argv) { | 71 : ContentTestSuiteBase(argc, argv) { |
71 } | 72 } |
72 | 73 |
73 ContentTestSuite::~ContentTestSuite() { | 74 ContentTestSuite::~ContentTestSuite() { |
74 } | 75 } |
75 | 76 |
76 void ContentTestSuite::Initialize() { | 77 void ContentTestSuite::Initialize() { |
78 // Especially Ozone needs MessageLoopForUI. | |
79 scoped_ptr<base::MessageLoop> message_loop(new base::MessageLoopForUI); | |
80 | |
77 #if defined(OS_MACOSX) | 81 #if defined(OS_MACOSX) |
78 base::mac::ScopedNSAutoreleasePool autorelease_pool; | 82 base::mac::ScopedNSAutoreleasePool autorelease_pool; |
79 #if !defined(OS_IOS) | 83 #if !defined(OS_IOS) |
80 mock_cr_app::RegisterMockCrApp(); | 84 mock_cr_app::RegisterMockCrApp(); |
81 #endif | 85 #endif |
82 #endif | 86 #endif |
83 | 87 |
84 #if defined(OS_WIN) | 88 #if defined(OS_WIN) |
85 gfx::InitDeviceScaleFactor(1.0f); | 89 gfx::InitDeviceScaleFactor(1.0f); |
86 #endif | 90 #endif |
91 #if defined(USE_OZONE) | |
92 ozone_ = ui::OzoneInitializerForTest::Create(); | |
spang
2015/12/14 17:51:37
Can you just call ui::OzonePlatform::InitializeFor
dshwang
2015/12/15 03:44:00
What OzoneInitializerForTest is doing is to initia
| |
93 DCHECK(ozone_); | |
94 #endif | |
87 | 95 |
88 ContentTestSuiteBase::Initialize(); | 96 ContentTestSuiteBase::Initialize(); |
89 { | 97 { |
90 ContentClient client; | 98 ContentClient client; |
91 ContentTestSuiteBase::RegisterContentSchemes(&client); | 99 ContentTestSuiteBase::RegisterContentSchemes(&client); |
92 } | 100 } |
93 RegisterPathProvider(); | 101 RegisterPathProvider(); |
94 #if !defined(OS_IOS) | 102 #if !defined(OS_IOS) |
95 media::InitializeMediaLibrary(); | 103 media::InitializeMediaLibrary(); |
96 // When running in a child process for Mac sandbox tests, the sandbox exists | 104 // When running in a child process for Mac sandbox tests, the sandbox exists |
(...skipping 20 matching lines...) Expand all Loading... | |
117 client_native_pixmap_factory_ = ui::ClientNativePixmapFactory::Create(); | 125 client_native_pixmap_factory_ = ui::ClientNativePixmapFactory::Create(); |
118 ui::ClientNativePixmapFactory::SetInstance( | 126 ui::ClientNativePixmapFactory::SetInstance( |
119 client_native_pixmap_factory_.get()); | 127 client_native_pixmap_factory_.get()); |
120 ui::ClientNativePixmapFactory::GetInstance()->Initialize( | 128 ui::ClientNativePixmapFactory::GetInstance()->Initialize( |
121 ui::OzonePlatform::GetInstance()->OpenClientNativePixmapDevice()); | 129 ui::OzonePlatform::GetInstance()->OpenClientNativePixmapDevice()); |
122 } | 130 } |
123 #endif | 131 #endif |
124 } | 132 } |
125 | 133 |
126 } // namespace content | 134 } // namespace content |
OLD | NEW |