diff options
author | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-29 23:24:05 +0000 |
---|---|---|
committer | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-29 23:24:05 +0000 |
commit | 85db5f48d0c6ede729572b2bcf325e0c74c8fa0f (patch) | |
tree | 35baaef8114c848d68d30367ec8d9f16ceed8b58 /ui/test/test_suite.cc | |
parent | 9e75e878f03f8d07f3ac72b5b2205337a7d23436 (diff) | |
download | chromium_src-85db5f48d0c6ede729572b2bcf325e0c74c8fa0f.zip chromium_src-85db5f48d0c6ede729572b2bcf325e0c74c8fa0f.tar.gz chromium_src-85db5f48d0c6ede729572b2bcf325e0c74c8fa0f.tar.bz2 |
ui: Move gfx test suite to ui/test/.
Currently we are using this test suite to run tests from ui/base, so it makes
sense to move it up to a place that can be shared by both base/ and gfx/.
TEST=ui_unittests
R=sky@chromium.org
Review URL: https://chromiumcodereview.appspot.com/9918016
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@129717 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/test/test_suite.cc')
-rw-r--r-- | ui/test/test_suite.cc | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/ui/test/test_suite.cc b/ui/test/test_suite.cc new file mode 100644 index 0000000..bd4e325 --- /dev/null +++ b/ui/test/test_suite.cc @@ -0,0 +1,68 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "ui/test/test_suite.h" + +#include "base/file_path.h" +#include "base/path_service.h" +#include "build/build_config.h" +#include "ui/base/resource/resource_bundle.h" +#include "ui/base/ui_base_paths.h" +#include "ui/gfx/gfx_paths.h" + +#if defined(OS_MACOSX) +#include "base/mac/bundle_locations.h" +#endif + +namespace ui { +namespace test { + +UITestSuite::UITestSuite(int argc, char** argv) : base::TestSuite(argc, argv) {} + +void UITestSuite::Initialize() { + base::TestSuite::Initialize(); + + ui::RegisterPathProvider(); + gfx::RegisterPathProvider(); + +#if defined(OS_MACOSX) + // Look in the framework bundle for resources. + // TODO(port): make a resource bundle for non-app exes. What's done here + // isn't really right because this code needs to depend on chrome_dll + // being built. This is inappropriate in app. + FilePath path; + PathService::Get(base::DIR_EXE, &path); +#if defined(GOOGLE_CHROME_BUILD) + path = path.AppendASCII("Google Chrome Framework.framework"); +#elif defined(CHROMIUM_BUILD) + path = path.AppendASCII("Chromium Framework.framework"); +#else +#error Unknown branding +#endif + base::mac::SetOverrideFrameworkBundlePath(path); +#elif defined(OS_POSIX) + FilePath pak_dir; + PathService::Get(base::DIR_MODULE, &pak_dir); + pak_dir = pak_dir.AppendASCII("ui_unittests_strings"); + PathService::Override(ui::DIR_LOCALES, pak_dir); + PathService::Override(ui::FILE_RESOURCES_PAK, + pak_dir.AppendASCII("ui_resources.pak")); +#endif // defined(OS_MACOSX) + + // Force unittests to run using en-US so if we test against string + // output, it'll pass regardless of the system language. + ui::ResourceBundle::InitSharedInstanceWithLocale("en-US"); +} + +void UITestSuite::Shutdown() { + ui::ResourceBundle::CleanupSharedInstance(); + +#if defined(OS_MACOSX) + base::mac::SetOverrideFrameworkBundle(NULL); +#endif + base::TestSuite::Shutdown(); +} + +} // namespace test +} // namespace ui |