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