| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "ui/gfx/test_suite.h" | 5 #include "ui/gfx/test_suite.h" |
| 6 | 6 |
| 7 #include "base/file_path.h" | 7 #include "base/file_path.h" |
| 8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
| 9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
| 10 #include "ui/base/resource/resource_bundle.h" | 10 #include "ui/base/resource/resource_bundle.h" |
| 11 #include "ui/base/ui_base_paths.h" | 11 #include "ui/base/ui_base_paths.h" |
| 12 #include "ui/gfx/gfx_paths.h" | 12 #include "ui/gfx/gfx_paths.h" |
| 13 | 13 |
| 14 #if defined(OS_MACOSX) | 14 #if defined(OS_MACOSX) |
| 15 #include "base/mac/foundation_util.h" | 15 #include "base/mac/bundle_locations.h" |
| 16 #endif | 16 #endif |
| 17 | 17 |
| 18 GfxTestSuite::GfxTestSuite(int argc, char** argv) : TestSuite(argc, argv) {} | 18 GfxTestSuite::GfxTestSuite(int argc, char** argv) : TestSuite(argc, argv) {} |
| 19 | 19 |
| 20 void GfxTestSuite::Initialize() { | 20 void GfxTestSuite::Initialize() { |
| 21 base::TestSuite::Initialize(); | 21 base::TestSuite::Initialize(); |
| 22 | 22 |
| 23 gfx::RegisterPathProvider(); | 23 gfx::RegisterPathProvider(); |
| 24 ui::RegisterPathProvider(); | 24 ui::RegisterPathProvider(); |
| 25 | 25 |
| 26 #if defined(OS_MACOSX) | 26 #if defined(OS_MACOSX) |
| 27 // Look in the framework bundle for resources. | 27 // Look in the framework bundle for resources. |
| 28 // TODO(port): make a resource bundle for non-app exes. What's done here | 28 // TODO(port): make a resource bundle for non-app exes. What's done here |
| 29 // isn't really right because this code needs to depend on chrome_dll | 29 // isn't really right because this code needs to depend on chrome_dll |
| 30 // being built. This is inappropriate in app. | 30 // being built. This is inappropriate in app. |
| 31 FilePath path; | 31 FilePath path; |
| 32 PathService::Get(base::DIR_EXE, &path); | 32 PathService::Get(base::DIR_EXE, &path); |
| 33 #if defined(GOOGLE_CHROME_BUILD) | 33 #if defined(GOOGLE_CHROME_BUILD) |
| 34 path = path.AppendASCII("Google Chrome Framework.framework"); | 34 path = path.AppendASCII("Google Chrome Framework.framework"); |
| 35 #elif defined(CHROMIUM_BUILD) | 35 #elif defined(CHROMIUM_BUILD) |
| 36 path = path.AppendASCII("Chromium Framework.framework"); | 36 path = path.AppendASCII("Chromium Framework.framework"); |
| 37 #else | 37 #else |
| 38 #error Unknown branding | 38 #error Unknown branding |
| 39 #endif | 39 #endif |
| 40 base::mac::SetOverrideAppBundlePath(path); | 40 base::mac::SetOverrideFrameworkBundlePath(path); |
| 41 #elif defined(OS_POSIX) | 41 #elif defined(OS_POSIX) |
| 42 FilePath pak_dir; | 42 FilePath pak_dir; |
| 43 PathService::Get(base::DIR_MODULE, &pak_dir); | 43 PathService::Get(base::DIR_MODULE, &pak_dir); |
| 44 pak_dir = pak_dir.AppendASCII("ui_unittests_strings"); | 44 pak_dir = pak_dir.AppendASCII("ui_unittests_strings"); |
| 45 PathService::Override(ui::DIR_LOCALES, pak_dir); | 45 PathService::Override(ui::DIR_LOCALES, pak_dir); |
| 46 PathService::Override(ui::FILE_RESOURCES_PAK, | 46 PathService::Override(ui::FILE_RESOURCES_PAK, |
| 47 pak_dir.AppendASCII("ui_resources.pak")); | 47 pak_dir.AppendASCII("ui_resources.pak")); |
| 48 #endif // defined(OS_MACOSX) | 48 #endif // defined(OS_MACOSX) |
| 49 | 49 |
| 50 // Force unittests to run using en-US so if we test against string | 50 // Force unittests to run using en-US so if we test against string |
| 51 // output, it'll pass regardless of the system language. | 51 // output, it'll pass regardless of the system language. |
| 52 ui::ResourceBundle::InitSharedInstance("en-US"); | 52 ui::ResourceBundle::InitSharedInstance("en-US"); |
| 53 } | 53 } |
| 54 | 54 |
| 55 void GfxTestSuite::Shutdown() { | 55 void GfxTestSuite::Shutdown() { |
| 56 ui::ResourceBundle::CleanupSharedInstance(); | 56 ui::ResourceBundle::CleanupSharedInstance(); |
| 57 | 57 |
| 58 #if defined(OS_MACOSX) | 58 #if defined(OS_MACOSX) |
| 59 base::mac::SetOverrideAppBundle(NULL); | 59 base::mac::SetOverrideFrameworkBundle(NULL); |
| 60 #endif | 60 #endif |
| 61 base::TestSuite::Shutdown(); | 61 base::TestSuite::Shutdown(); |
| 62 } | 62 } |
| OLD | NEW |