Chromium Code Reviews| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 47 // Register JNI bindings for android. | 47 // Register JNI bindings for android. |
| 48 gfx::android::RegisterJni(base::android::AttachCurrentThread()); | 48 gfx::android::RegisterJni(base::android::AttachCurrentThread()); |
| 49 ui::android::RegisterJni(base::android::AttachCurrentThread()); | 49 ui::android::RegisterJni(base::android::AttachCurrentThread()); |
| 50 #endif | 50 #endif |
| 51 | 51 |
| 52 ui::RegisterPathProvider(); | 52 ui::RegisterPathProvider(); |
| 53 gfx::RegisterPathProvider(); | 53 gfx::RegisterPathProvider(); |
| 54 | 54 |
| 55 #if defined(OS_MACOSX) && !defined(OS_IOS) | 55 #if defined(OS_MACOSX) && !defined(OS_IOS) |
| 56 // Look in the framework bundle for resources. | 56 // Look in the framework bundle for resources. |
| 57 // TODO(port): make a resource bundle for non-app exes. What's done here | |
| 58 // isn't really right because this code needs to depend on chrome_dll | |
| 59 // being built. This is inappropriate in app. | |
| 60 base::FilePath path; | 57 base::FilePath path; |
| 61 PathService::Get(base::DIR_EXE, &path); | 58 PathService::Get(base::DIR_EXE, &path); |
| 62 #if defined(GOOGLE_CHROME_BUILD) | 59 path = path.AppendASCII("ui_unittests Framework.framework"); |
|
tfarina
2014/02/07 01:06:27
Can we get this chunk landed first (and separate)
tfarina
2014/02/07 03:57:24
For reference, content_shell has a clean way to do
tapted
2014/02/28 08:10:56
Since we know it's a test binary running we can si
tapted
2014/02/28 08:10:56
I've added another symlink in the Framework bundle
| |
| 63 path = path.AppendASCII("Google Chrome Framework.framework"); | |
| 64 #elif defined(CHROMIUM_BUILD) | |
| 65 path = path.AppendASCII("Chromium Framework.framework"); | |
| 66 #else | |
| 67 #error Unknown branding | |
| 68 #endif | |
| 69 base::mac::SetOverrideFrameworkBundlePath(path); | 60 base::mac::SetOverrideFrameworkBundlePath(path); |
| 70 #endif // defined(OS_MACOSX) && !defined(OS_IOS) | 61 #endif // defined(OS_MACOSX) && !defined(OS_IOS) |
| 71 | 62 |
| 72 // TODO(tfarina): This loads chrome_100_percent.pak and thus introduces a | |
| 73 // dependency on chrome/, we don't want that here, so change this to | |
| 74 // InitSharedInstanceWithPakPath(). | |
| 75 ui::ResourceBundle::InitSharedInstanceWithLocale("en-US", NULL); | 63 ui::ResourceBundle::InitSharedInstanceWithLocale("en-US", NULL); |
| 64 | |
| 65 base::FilePath pak_dir; | |
| 66 PathService::Get(base::DIR_MODULE, &pak_dir); | |
| 67 base::FilePath pak_file; | |
| 68 pak_file = pak_dir.Append(FILE_PATH_LITERAL("ui_test.pak")); | |
| 69 ui::ResourceBundle::GetSharedInstance().AddDataPackFromPath( | |
| 70 pak_file, ui::SCALE_FACTOR_100P); | |
| 76 } | 71 } |
| 77 | 72 |
| 78 void UIBaseTestSuite::Shutdown() { | 73 void UIBaseTestSuite::Shutdown() { |
| 79 ui::ResourceBundle::CleanupSharedInstance(); | 74 ui::ResourceBundle::CleanupSharedInstance(); |
| 80 | 75 |
| 81 #if defined(OS_MACOSX) && !defined(OS_IOS) | 76 #if defined(OS_MACOSX) && !defined(OS_IOS) |
| 82 base::mac::SetOverrideFrameworkBundle(NULL); | 77 base::mac::SetOverrideFrameworkBundle(NULL); |
| 83 #endif | 78 #endif |
| 84 base::TestSuite::Shutdown(); | 79 base::TestSuite::Shutdown(); |
| 85 } | 80 } |
| 86 | 81 |
| 87 } // namespace | 82 } // namespace |
| 88 | 83 |
| 89 int main(int argc, char** argv) { | 84 int main(int argc, char** argv) { |
| 90 UIBaseTestSuite test_suite(argc, argv); | 85 UIBaseTestSuite test_suite(argc, argv); |
| 91 | 86 |
| 92 return base::LaunchUnitTests(argc, | 87 return base::LaunchUnitTests(argc, |
| 93 argv, | 88 argv, |
| 94 base::Bind(&UIBaseTestSuite::Run, | 89 base::Bind(&UIBaseTestSuite::Run, |
| 95 base::Unretained(&test_suite))); | 90 base::Unretained(&test_suite))); |
| 96 } | 91 } |
| OLD | NEW |