Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(243)

Side by Side Diff: ui/base/test/run_all_unittests.cc

Issue 853033002: More delete + gfx_unittests (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Fix android trybots Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/base/android/ui_base_jni_registrar.cc ('k') | ui/base/touch/OWNERS » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
12 #include "ui/base/ui_base_paths.h"
13 11
14 #if defined(OS_ANDROID) 12 #if defined(OS_ANDROID)
15 #include "base/android/jni_android.h" 13 #include "base/android/jni_android.h"
16 #include "ui/base/android/ui_base_jni_registrar.h" 14 #include "ui/base/android/ui_base_jni_registrar.h"
17 #include "ui/gfx/android/gfx_jni_registrar.h" 15 #include "ui/gfx/android/gfx_jni_registrar.h"
18 #endif 16 #endif
19 17
20 #if defined(OS_MACOSX) && !defined(OS_IOS) 18 #if defined(OS_MACOSX) && !defined(OS_IOS)
21 #include "base/mac/bundle_locations.h" 19 #include "base/mac/bundle_locations.h"
22 #include "base/test/mock_chrome_application_mac.h" 20 #include "base/test/mock_chrome_application_mac.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 ui::android::RegisterJni(base::android::AttachCurrentThread()); 55 ui::android::RegisterJni(base::android::AttachCurrentThread());
58 #endif 56 #endif
59 57
60 ui::RegisterPathProvider(); 58 ui::RegisterPathProvider();
61 59
62 base::FilePath exe_path; 60 base::FilePath exe_path;
63 PathService::Get(base::DIR_EXE, &exe_path); 61 PathService::Get(base::DIR_EXE, &exe_path);
64 62
65 #if defined(OS_MACOSX) && !defined(OS_IOS) 63 #if defined(OS_MACOSX) && !defined(OS_IOS)
66 mock_cr_app::RegisterMockCrApp(); 64 mock_cr_app::RegisterMockCrApp();
67
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.
70 base::mac::SetOverrideFrameworkBundlePath(
71 exe_path.AppendASCII("ui_unittests Framework.framework"));
72 ui::ResourceBundle::InitSharedInstanceWithLocale(
73 "en-US", NULL, ui::ResourceBundle::LOAD_COMMON_RESOURCES);
74
75 #elif defined(OS_IOS) || defined(OS_ANDROID)
76 // On iOS, the ui_unittests binary is itself a mini bundle, with resources
77 // built in. On Android, ui_unittests_apk provides the necessary framework.
78 ui::ResourceBundle::InitSharedInstanceWithLocale(
79 "en-US", NULL, ui::ResourceBundle::LOAD_COMMON_RESOURCES);
80
81 #else
82 // 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 // load the test .pak files directly.
85 ui::ResourceBundle::InitSharedInstanceWithPakPath(
86 exe_path.AppendASCII("ui_test.pak"));
87
88 // ui_unittests can't depend on the locales folder which Chrome will make
89 // later, so use the path created by ui_test_pak.
90 PathService::Override(ui::DIR_LOCALES, exe_path.AppendASCII("ui"));
91 #endif
92 } 65 }
93 66
94 void UIBaseTestSuite::Shutdown() { 67 void UIBaseTestSuite::Shutdown() {
95 ui::ResourceBundle::CleanupSharedInstance();
96
97 #if defined(OS_MACOSX) && !defined(OS_IOS) 68 #if defined(OS_MACOSX) && !defined(OS_IOS)
98 base::mac::SetOverrideFrameworkBundle(NULL); 69 base::mac::SetOverrideFrameworkBundle(NULL);
99 #endif 70 #endif
100 base::TestSuite::Shutdown(); 71 base::TestSuite::Shutdown();
101 } 72 }
102 73
103 } // namespace 74 } // namespace
104 75
105 int main(int argc, char** argv) { 76 int main(int argc, char** argv) {
106 UIBaseTestSuite test_suite(argc, argv); 77 UIBaseTestSuite test_suite(argc, argv);
107 78
108 return base::LaunchUnitTests(argc, 79 return base::LaunchUnitTests(argc,
109 argv, 80 argv,
110 base::Bind(&UIBaseTestSuite::Run, 81 base::Bind(&UIBaseTestSuite::Run,
111 base::Unretained(&test_suite))); 82 base::Unretained(&test_suite)));
112 } 83 }
OLDNEW
« no previous file with comments | « ui/base/android/ui_base_jni_registrar.cc ('k') | ui/base/touch/OWNERS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698