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/macros.h" | 6 #include "base/macros.h" |
7 #include "base/test/launcher/unit_test_launcher.h" | 7 #include "base/test/launcher/unit_test_launcher.h" |
8 #include "base/test/test_suite.h" | 8 #include "base/test/test_suite.h" |
9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
10 | 10 |
11 #if defined(OS_MACOSX) && !defined(OS_IOS) | 11 #if defined(OS_MACOSX) && !defined(OS_IOS) |
12 #include "base/test/mock_chrome_application_mac.h" | 12 #include "base/test/mock_chrome_application_mac.h" |
13 #endif | 13 #endif |
14 #if defined(USE_OZONE) | 14 #if defined(USE_OZONE) |
15 #include "base/message_loop/message_loop.h" | 15 #include "base/message_loop/message_loop.h" |
16 #include "ui/ozone/public/client_native_pixmap_factory.h" | 16 #include "ui/ozone/public/client_native_pixmap_factory.h" |
| 17 #include "ui/ozone/public/ozone_gpu_test_helper.h" |
17 #endif | 18 #endif |
18 | 19 |
19 namespace { | 20 namespace { |
20 | 21 |
21 class GlTestSuite : public base::TestSuite { | 22 class GlTestSuite : public base::TestSuite { |
22 public: | 23 public: |
23 GlTestSuite(int argc, char** argv) : base::TestSuite(argc, argv) { | 24 GlTestSuite(int argc, char** argv) : base::TestSuite(argc, argv) { |
24 } | 25 } |
25 | 26 |
26 protected: | 27 protected: |
27 void Initialize() override { | 28 void Initialize() override { |
28 base::TestSuite::Initialize(); | 29 base::TestSuite::Initialize(); |
29 | 30 |
30 #if defined(OS_MACOSX) && !defined(OS_IOS) | 31 #if defined(OS_MACOSX) && !defined(OS_IOS) |
31 mock_cr_app::RegisterMockCrApp(); | 32 mock_cr_app::RegisterMockCrApp(); |
32 #endif | 33 #endif |
33 #if defined(USE_OZONE) | 34 #if defined(USE_OZONE) |
34 // On Ozone, the backend initializes the event system using a UI thread. | 35 // On Ozone, the backend initializes the event system using a UI thread. |
35 message_loop_.reset(new base::MessageLoopForUI); | 36 message_loop_.reset(new base::MessageLoopForUI); |
| 37 ozone_test_ = ui::OzoneInitializerForTest::Create(); |
36 client_native_pixmap_factory_ = ui::ClientNativePixmapFactory::Create(); | 38 client_native_pixmap_factory_ = ui::ClientNativePixmapFactory::Create(); |
37 ui::ClientNativePixmapFactory::SetInstance( | 39 ui::ClientNativePixmapFactory::SetInstance( |
38 client_native_pixmap_factory_.get()); | 40 client_native_pixmap_factory_.get()); |
39 #endif | 41 #endif |
40 } | 42 } |
41 | 43 |
42 void Shutdown() override { | 44 void Shutdown() override { |
43 base::TestSuite::Shutdown(); | 45 base::TestSuite::Shutdown(); |
44 } | 46 } |
45 | 47 |
46 private: | 48 private: |
47 #if defined(USE_OZONE) | 49 #if defined(USE_OZONE) |
48 std::unique_ptr<base::MessageLoop> message_loop_; | 50 std::unique_ptr<base::MessageLoop> message_loop_; |
| 51 std::unique_ptr<ui::OzoneInitializerForTest> ozone_test_; |
49 std::unique_ptr<ui::ClientNativePixmapFactory> client_native_pixmap_factory_; | 52 std::unique_ptr<ui::ClientNativePixmapFactory> client_native_pixmap_factory_; |
50 #endif | 53 #endif |
51 DISALLOW_COPY_AND_ASSIGN(GlTestSuite); | 54 DISALLOW_COPY_AND_ASSIGN(GlTestSuite); |
52 }; | 55 }; |
53 | 56 |
54 } // namespace | 57 } // namespace |
55 | 58 |
56 int main(int argc, char** argv) { | 59 int main(int argc, char** argv) { |
57 GlTestSuite test_suite(argc, argv); | 60 GlTestSuite test_suite(argc, argv); |
58 | 61 |
59 return base::LaunchUnitTests( | 62 return base::LaunchUnitTests( |
60 argc, | 63 argc, |
61 argv, | 64 argv, |
62 base::Bind(&GlTestSuite::Run, base::Unretained(&test_suite))); | 65 base::Bind(&GlTestSuite::Run, base::Unretained(&test_suite))); |
63 } | 66 } |
OLD | NEW |