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/i18n/icu_util.h" |
6 #include "base/macros.h" | 7 #include "base/macros.h" |
7 #include "base/path_service.h" | 8 #include "base/path_service.h" |
8 #include "base/test/launcher/unit_test_launcher.h" | 9 #include "base/test/launcher/unit_test_launcher.h" |
9 #include "base/test/test_suite.h" | 10 #include "base/test/test_suite.h" |
10 #include "services/service_manager/public/cpp/test/common_initialization.h" | 11 #include "services/service_manager/public/cpp/test/common_initialization.h" |
11 #include "ui/base/resource/resource_bundle.h" | 12 #include "ui/base/resource/resource_bundle.h" |
12 #include "ui/base/ui_base_paths.h" | 13 #include "ui/base/ui_base_paths.h" |
13 | 14 |
14 #if defined(USE_OZONE) | 15 #if defined(USE_OZONE) |
15 #include "ui/ozone/public/ozone_platform.h" | 16 #include "ui/ozone/public/ozone_platform.h" |
(...skipping 13 matching lines...) Expand all Loading... |
29 | 30 |
30 base::FilePath ui_test_pak_path; | 31 base::FilePath ui_test_pak_path; |
31 ASSERT_TRUE(PathService::Get(ui::UI_TEST_PAK, &ui_test_pak_path)); | 32 ASSERT_TRUE(PathService::Get(ui::UI_TEST_PAK, &ui_test_pak_path)); |
32 ui::ResourceBundle::InitSharedInstanceWithPakPath(ui_test_pak_path); | 33 ui::ResourceBundle::InitSharedInstanceWithPakPath(ui_test_pak_path); |
33 | 34 |
34 #if defined(USE_OZONE) | 35 #if defined(USE_OZONE) |
35 ui::OzonePlatform::InitParams params; | 36 ui::OzonePlatform::InitParams params; |
36 params.single_process = true; | 37 params.single_process = true; |
37 ui::OzonePlatform::InitializeForGPU(params); | 38 ui::OzonePlatform::InitializeForGPU(params); |
38 #endif | 39 #endif |
| 40 |
| 41 // base::TestSuite and ViewsInit both try to load icu. That's ok for tests. |
| 42 base::i18n::AllowMultipleInitializeCallsForTesting(); |
39 } | 43 } |
40 | 44 |
41 void Shutdown() override { | 45 void Shutdown() override { |
42 ui::ResourceBundle::CleanupSharedInstance(); | 46 ui::ResourceBundle::CleanupSharedInstance(); |
43 base::TestSuite::Shutdown(); | 47 base::TestSuite::Shutdown(); |
44 } | 48 } |
45 | 49 |
46 private: | 50 private: |
47 DISALLOW_COPY_AND_ASSIGN(ServiceTestSuite); | 51 DISALLOW_COPY_AND_ASSIGN(ServiceTestSuite); |
48 }; | 52 }; |
49 | 53 |
50 } // namespace | 54 } // namespace |
51 | 55 |
52 int main(int argc, char** argv) { | 56 int main(int argc, char** argv) { |
53 ServiceTestSuite test_suite(argc, argv); | 57 ServiceTestSuite test_suite(argc, argv); |
54 | 58 |
55 return service_manager::InitializeAndLaunchUnitTests( | 59 return service_manager::InitializeAndLaunchUnitTests( |
56 argc, argv, | 60 argc, argv, |
57 base::Bind(&ServiceTestSuite::Run, base::Unretained(&test_suite))); | 61 base::Bind(&ServiceTestSuite::Run, base::Unretained(&test_suite))); |
58 } | 62 } |
OLD | NEW |