OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/path_service.h" | 7 #include "base/path_service.h" |
8 #include "base/test/launcher/unit_test_launcher.h" | 8 #include "base/test/launcher/unit_test_launcher.h" |
9 #include "base/test/test_suite.h" | 9 #include "base/test/test_suite.h" |
10 #include "services/service_manager/public/cpp/test/common_initialization.h" | 10 #include "services/service_manager/public/cpp/test/common_initialization.h" |
11 #include "ui/base/resource/resource_bundle.h" | 11 #include "ui/base/resource/resource_bundle.h" |
12 #include "ui/base/ui_base_paths.h" | 12 #include "ui/base/ui_base_paths.h" |
13 | 13 |
| 14 #if defined(USE_OZONE) |
| 15 #include "ui/ozone/public/ozone_platform.h" |
| 16 #endif |
| 17 |
14 namespace { | 18 namespace { |
15 | 19 |
16 class ServiceTestSuite : public base::TestSuite { | 20 class ServiceTestSuite : public base::TestSuite { |
17 public: | 21 public: |
18 ServiceTestSuite(int argc, char** argv) : base::TestSuite(argc, argv) {} | 22 ServiceTestSuite(int argc, char** argv) : base::TestSuite(argc, argv) {} |
19 ~ServiceTestSuite() override {} | 23 ~ServiceTestSuite() override {} |
20 | 24 |
21 protected: | 25 protected: |
22 void Initialize() override { | 26 void Initialize() override { |
23 base::TestSuite::Initialize(); | 27 base::TestSuite::Initialize(); |
24 ui::RegisterPathProvider(); | 28 ui::RegisterPathProvider(); |
25 | 29 |
26 base::FilePath ui_test_pak_path; | 30 base::FilePath ui_test_pak_path; |
27 ASSERT_TRUE(PathService::Get(ui::UI_TEST_PAK, &ui_test_pak_path)); | 31 ASSERT_TRUE(PathService::Get(ui::UI_TEST_PAK, &ui_test_pak_path)); |
28 ui::ResourceBundle::InitSharedInstanceWithPakPath(ui_test_pak_path); | 32 ui::ResourceBundle::InitSharedInstanceWithPakPath(ui_test_pak_path); |
| 33 |
| 34 #if defined(USE_OZONE) |
| 35 ui::OzonePlatform::InitParams params; |
| 36 params.single_process = true; |
| 37 ui::OzonePlatform::InitializeForGPU(params); |
| 38 #endif |
29 } | 39 } |
30 | 40 |
31 void Shutdown() override { | 41 void Shutdown() override { |
32 ui::ResourceBundle::CleanupSharedInstance(); | 42 ui::ResourceBundle::CleanupSharedInstance(); |
33 base::TestSuite::Shutdown(); | 43 base::TestSuite::Shutdown(); |
34 } | 44 } |
35 | 45 |
36 private: | 46 private: |
37 DISALLOW_COPY_AND_ASSIGN(ServiceTestSuite); | 47 DISALLOW_COPY_AND_ASSIGN(ServiceTestSuite); |
38 }; | 48 }; |
39 | 49 |
40 } // namespace | 50 } // namespace |
41 | 51 |
42 int main(int argc, char** argv) { | 52 int main(int argc, char** argv) { |
43 ServiceTestSuite test_suite(argc, argv); | 53 ServiceTestSuite test_suite(argc, argv); |
44 | 54 |
45 return service_manager::InitializeAndLaunchUnitTests( | 55 return service_manager::InitializeAndLaunchUnitTests( |
46 argc, argv, | 56 argc, argv, |
47 base::Bind(&ServiceTestSuite::Run, base::Unretained(&test_suite))); | 57 base::Bind(&ServiceTestSuite::Run, base::Unretained(&test_suite))); |
48 } | 58 } |
OLD | NEW |