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" |
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(OS_ANDROID) | 14 #if defined(OS_ANDROID) |
15 #include "base/android/jni_android.h" | 15 #include "base/android/jni_android.h" |
16 #include "ui/base/android/ui_base_jni_registrar.h" | 16 #include "ui/base/android/ui_base_jni_registrar.h" |
17 #include "ui/gfx/android/gfx_jni_registrar.h" | 17 #include "ui/gfx/android/gfx_jni_registrar.h" |
18 #endif | 18 #endif |
19 | 19 |
20 #if defined(OS_MACOSX) && !defined(OS_IOS) | 20 #if defined(OS_MACOSX) && !defined(OS_IOS) |
21 #include "base/mac/bundle_locations.h" | 21 #include "base/mac/bundle_locations.h" |
| 22 #include "base/test/mock_chrome_application_mac.h" |
22 #endif | 23 #endif |
23 | 24 |
24 #if defined(OS_WIN) | 25 #if defined(OS_WIN) |
25 #include "ui/gfx/win/dpi.h" | 26 #include "ui/gfx/win/dpi.h" |
26 #endif | 27 #endif |
27 | 28 |
28 namespace { | 29 namespace { |
29 | 30 |
30 class UIBaseTestSuite : public base::TestSuite { | 31 class UIBaseTestSuite : public base::TestSuite { |
31 public: | 32 public: |
(...skipping 23 matching lines...) Expand all Loading... |
55 gfx::android::RegisterJni(base::android::AttachCurrentThread()); | 56 gfx::android::RegisterJni(base::android::AttachCurrentThread()); |
56 ui::android::RegisterJni(base::android::AttachCurrentThread()); | 57 ui::android::RegisterJni(base::android::AttachCurrentThread()); |
57 #endif | 58 #endif |
58 | 59 |
59 ui::RegisterPathProvider(); | 60 ui::RegisterPathProvider(); |
60 | 61 |
61 base::FilePath exe_path; | 62 base::FilePath exe_path; |
62 PathService::Get(base::DIR_EXE, &exe_path); | 63 PathService::Get(base::DIR_EXE, &exe_path); |
63 | 64 |
64 #if defined(OS_MACOSX) && !defined(OS_IOS) | 65 #if defined(OS_MACOSX) && !defined(OS_IOS) |
| 66 mock_cr_app::RegisterMockCrApp(); |
| 67 |
65 // 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 |
66 // 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. |
67 base::mac::SetOverrideFrameworkBundlePath( | 70 base::mac::SetOverrideFrameworkBundlePath( |
68 exe_path.AppendASCII("ui_unittests Framework.framework")); | 71 exe_path.AppendASCII("ui_unittests Framework.framework")); |
69 ui::ResourceBundle::InitSharedInstanceWithLocale( | 72 ui::ResourceBundle::InitSharedInstanceWithLocale( |
70 "en-US", NULL, ui::ResourceBundle::LOAD_COMMON_RESOURCES); | 73 "en-US", NULL, ui::ResourceBundle::LOAD_COMMON_RESOURCES); |
71 | 74 |
72 #elif defined(OS_IOS) || defined(OS_ANDROID) | 75 #elif defined(OS_IOS) || defined(OS_ANDROID) |
73 // On iOS, the ui_unittests binary is itself a mini bundle, with resources | 76 // On iOS, the ui_unittests binary is itself a mini bundle, with resources |
74 // built in. On Android, ui_unittests_apk provides the necessary framework. | 77 // built in. On Android, ui_unittests_apk provides the necessary framework. |
(...skipping 25 matching lines...) Expand all Loading... |
100 } // namespace | 103 } // namespace |
101 | 104 |
102 int main(int argc, char** argv) { | 105 int main(int argc, char** argv) { |
103 UIBaseTestSuite test_suite(argc, argv); | 106 UIBaseTestSuite test_suite(argc, argv); |
104 | 107 |
105 return base::LaunchUnitTests(argc, | 108 return base::LaunchUnitTests(argc, |
106 argv, | 109 argv, |
107 base::Bind(&UIBaseTestSuite::Run, | 110 base::Bind(&UIBaseTestSuite::Run, |
108 base::Unretained(&test_suite))); | 111 base::Unretained(&test_suite))); |
109 } | 112 } |
OLD | NEW |