OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/test/launcher/unit_test_launcher.h" | 6 #include "base/test/launcher/unit_test_launcher.h" |
7 #include "base/test/test_suite.h" | 7 #include "base/test/test_suite.h" |
8 | 8 |
9 #if defined(OS_MACOSX) && !defined(OS_IOS) | 9 #if defined(OS_MACOSX) && !defined(OS_IOS) |
10 #include "base/test/mock_chrome_application_mac.h" | 10 #include "base/test/mock_chrome_application_mac.h" |
11 #endif | 11 #endif |
12 | 12 |
| 13 #if defined(USE_OZONE) |
| 14 #include "ui/ozone/public/client_native_pixmap_factory.h" |
| 15 #include "ui/ozone/public/ozone_gpu_test_helper.h" |
| 16 #include "ui/ozone/public/ozone_platform.h" |
| 17 #endif |
| 18 |
13 namespace { | 19 namespace { |
14 | 20 |
15 class GlTestSuite : public base::TestSuite { | 21 class GlTestSuite : public base::TestSuite { |
16 public: | 22 public: |
17 GlTestSuite(int argc, char** argv) : base::TestSuite(argc, argv) { | 23 GlTestSuite(int argc, char** argv) : base::TestSuite(argc, argv) { |
18 } | 24 } |
19 | 25 |
20 protected: | 26 protected: |
21 void Initialize() override { | 27 void Initialize() override { |
22 base::TestSuite::Initialize(); | 28 base::TestSuite::Initialize(); |
23 | 29 |
| 30 #if defined(USE_OZONE) |
| 31 ozone_ = ui::OzoneInitializerForTest::Create(); |
| 32 DCHECK(ozone_); |
| 33 |
| 34 client_native_pixmap_factory_ = ui::ClientNativePixmapFactory::Create(); |
| 35 ui::ClientNativePixmapFactory::SetInstance( |
| 36 client_native_pixmap_factory_.get()); |
| 37 ui::ClientNativePixmapFactory::GetInstance()->Initialize( |
| 38 ui::OzonePlatform::GetInstance()->OpenClientNativePixmapDevice()); |
| 39 #endif |
| 40 // TODO(reveman): initialize SurfaceTextureManager or IOSurfaceManager |
24 #if defined(OS_MACOSX) && !defined(OS_IOS) | 41 #if defined(OS_MACOSX) && !defined(OS_IOS) |
25 mock_cr_app::RegisterMockCrApp(); | 42 mock_cr_app::RegisterMockCrApp(); |
26 #endif | 43 #endif |
27 } | 44 } |
28 | 45 |
29 void Shutdown() override { | 46 void Shutdown() override { |
30 base::TestSuite::Shutdown(); | 47 base::TestSuite::Shutdown(); |
31 } | 48 } |
32 | 49 |
33 private: | 50 private: |
| 51 #if defined(USE_OZONE) |
| 52 scoped_ptr<ui::OzoneInitializerForTest> ozone_; |
| 53 scoped_ptr<ui::ClientNativePixmapFactory> client_native_pixmap_factory_; |
| 54 #endif |
34 DISALLOW_COPY_AND_ASSIGN(GlTestSuite); | 55 DISALLOW_COPY_AND_ASSIGN(GlTestSuite); |
35 }; | 56 }; |
36 | 57 |
37 } // namespace | 58 } // namespace |
38 | 59 |
39 int main(int argc, char** argv) { | 60 int main(int argc, char** argv) { |
40 GlTestSuite test_suite(argc, argv); | 61 GlTestSuite test_suite(argc, argv); |
41 | 62 |
42 return base::LaunchUnitTests( | 63 return base::LaunchUnitTests( |
43 argc, | 64 argc, |
44 argv, | 65 argv, |
45 base::Bind(&GlTestSuite::Run, base::Unretained(&test_suite))); | 66 base::Bind(&GlTestSuite::Run, base::Unretained(&test_suite))); |
46 } | 67 } |
OLD | NEW |