OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/files/file_path.h" | 6 #include "base/files/file_path.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 "build/build_config.h" | 10 #include "build/build_config.h" |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 mock_cr_app::RegisterMockCrApp(); | 66 mock_cr_app::RegisterMockCrApp(); |
67 | 67 |
68 // On Mac, a test Framework bundle is created that links locale.pak and | 68 // On Mac, a test Framework bundle is created that links locale.pak and |
69 // chrome_100_percent.pak at the appropriate places to ui_test.pak. | 69 // chrome_100_percent.pak at the appropriate places to ui_test.pak. |
70 base::mac::SetOverrideFrameworkBundlePath( | 70 base::mac::SetOverrideFrameworkBundlePath( |
71 exe_path.AppendASCII("ui_unittests Framework.framework")); | 71 exe_path.AppendASCII("ui_unittests Framework.framework")); |
72 ui::ResourceBundle::InitSharedInstanceWithLocale( | 72 ui::ResourceBundle::InitSharedInstanceWithLocale( |
73 "en-US", NULL, ui::ResourceBundle::LOAD_COMMON_RESOURCES); | 73 "en-US", NULL, ui::ResourceBundle::LOAD_COMMON_RESOURCES); |
74 | 74 |
75 #elif defined(OS_IOS) || defined(OS_ANDROID) | 75 #elif defined(OS_IOS) || defined(OS_ANDROID) |
76 // On iOS, the ui_unittests binary is itself a mini bundle, with resources | 76 // On iOS, the ui_base_unittests binary is itself a mini bundle, with |
77 // built in. On Android, ui_unittests_apk provides the necessary framework. | 77 // resources built in. On Android, ui_base_unittests_apk provides the |
| 78 // necessary framework. |
78 ui::ResourceBundle::InitSharedInstanceWithLocale( | 79 ui::ResourceBundle::InitSharedInstanceWithLocale( |
79 "en-US", NULL, ui::ResourceBundle::LOAD_COMMON_RESOURCES); | 80 "en-US", NULL, ui::ResourceBundle::LOAD_COMMON_RESOURCES); |
80 | 81 |
81 #else | 82 #else |
82 // On other platforms, the (hardcoded) paths for chrome_100_percent.pak and | 83 // On other platforms, the (hardcoded) paths for chrome_100_percent.pak and |
83 // locale.pak get populated by later build steps. To avoid clobbering them, | 84 // locale.pak get populated by later build steps. To avoid clobbering them, |
84 // load the test .pak files directly. | 85 // load the test .pak files directly. |
85 ui::ResourceBundle::InitSharedInstanceWithPakPath( | 86 ui::ResourceBundle::InitSharedInstanceWithPakPath( |
86 exe_path.AppendASCII("ui_test.pak")); | 87 exe_path.AppendASCII("ui_test.pak")); |
87 | 88 |
88 // ui_unittests can't depend on the locales folder which Chrome will make | 89 // ui_base_unittests can't depend on the locales folder which Chrome will make |
89 // later, so use the path created by ui_test_pak. | 90 // later, so use the path created by ui_test_pak. |
90 PathService::Override(ui::DIR_LOCALES, exe_path.AppendASCII("ui")); | 91 PathService::Override(ui::DIR_LOCALES, exe_path.AppendASCII("ui")); |
91 #endif | 92 #endif |
92 } | 93 } |
93 | 94 |
94 void UIBaseTestSuite::Shutdown() { | 95 void UIBaseTestSuite::Shutdown() { |
95 ui::ResourceBundle::CleanupSharedInstance(); | 96 ui::ResourceBundle::CleanupSharedInstance(); |
96 | 97 |
97 #if defined(OS_MACOSX) && !defined(OS_IOS) | 98 #if defined(OS_MACOSX) && !defined(OS_IOS) |
98 base::mac::SetOverrideFrameworkBundle(NULL); | 99 base::mac::SetOverrideFrameworkBundle(NULL); |
99 #endif | 100 #endif |
100 base::TestSuite::Shutdown(); | 101 base::TestSuite::Shutdown(); |
101 } | 102 } |
102 | 103 |
103 } // namespace | 104 } // namespace |
104 | 105 |
105 int main(int argc, char** argv) { | 106 int main(int argc, char** argv) { |
106 UIBaseTestSuite test_suite(argc, argv); | 107 UIBaseTestSuite test_suite(argc, argv); |
107 | 108 |
108 return base::LaunchUnitTests(argc, | 109 return base::LaunchUnitTests(argc, |
109 argv, | 110 argv, |
110 base::Bind(&UIBaseTestSuite::Run, | 111 base::Bind(&UIBaseTestSuite::Run, |
111 base::Unretained(&test_suite))); | 112 base::Unretained(&test_suite))); |
112 } | 113 } |
OLD | NEW |