diff options
author | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-14 23:54:47 +0000 |
---|---|---|
committer | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-14 23:54:47 +0000 |
commit | a5add2c2624eaffd9290ee6b760b504cfc07a2ed (patch) | |
tree | f2a0dd83cbbf771fdf9ed8f01e72a89dfa9d3390 /app | |
parent | 98723c4a32b20c4ba1ed95b0e9056788fb413ce6 (diff) | |
download | chromium_src-a5add2c2624eaffd9290ee6b760b504cfc07a2ed.zip chromium_src-a5add2c2624eaffd9290ee6b760b504cfc07a2ed.tar.gz chromium_src-a5add2c2624eaffd9290ee6b760b504cfc07a2ed.tar.bz2 |
More test out-of-lining.
BUG=none
TEST=compiles
Review URL: http://codereview.chromium.org/6484043
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@74879 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'app')
-rw-r--r-- | app/app.gyp | 1 | ||||
-rw-r--r-- | app/test_suite.cc | 65 | ||||
-rw-r--r-- | app/test_suite.h | 63 |
3 files changed, 70 insertions, 59 deletions
diff --git a/app/app.gyp b/app/app.gyp index 107d4b30..d1b3198 100644 --- a/app/app.gyp +++ b/app/app.gyp @@ -58,6 +58,7 @@ 'sql/connection_unittest.cc', 'sql/statement_unittest.cc', 'sql/transaction_unittest.cc', + 'test_suite.cc', 'test_suite.h', ], 'include_dirs': [ diff --git a/app/test_suite.cc b/app/test_suite.cc new file mode 100644 index 0000000..7eaedd6 --- /dev/null +++ b/app/test_suite.cc @@ -0,0 +1,65 @@ +// Copyright (c) 2011 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 "app/test_suite.h" + +#include "app/app_paths.h" +#include "base/path_service.h" +#include "base/mac/scoped_nsautorelease_pool.h" +#include "build/build_config.h" +#include "ui/base/resource/resource_bundle.h" +#include "ui/base/ui_base_paths.h" + +#if defined(OS_MACOSX) +#include "base/mac/mac_util.h" +#endif + +AppTestSuite::AppTestSuite(int argc, char** argv) : TestSuite(argc, argv) {} + +AppTestSuite::~AppTestSuite() {} + +void AppTestSuite::Initialize() { + base::mac::ScopedNSAutoreleasePool autorelease_pool; + + base::TestSuite::Initialize(); + + app::RegisterPathProvider(); + ui::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::SetOverrideAppBundlePath(path); +#elif defined(OS_POSIX) + FilePath pak_dir; + PathService::Get(base::DIR_MODULE, &pak_dir); + pak_dir = pak_dir.AppendASCII("app_unittests_strings"); + PathService::Override(ui::DIR_LOCALES, pak_dir); + PathService::Override(ui::FILE_RESOURCES_PAK, + pak_dir.AppendASCII("app_resources.pak")); +#endif + + // Force unittests to run using en-US so if we test against string + // output, it'll pass regardless of the system language. + ResourceBundle::InitSharedInstance("en-US"); +} + +void AppTestSuite::Shutdown() { + ResourceBundle::CleanupSharedInstance(); + +#if defined(OS_MACOSX) + base::mac::SetOverrideAppBundle(NULL); +#endif + TestSuite::Shutdown(); +} diff --git a/app/test_suite.h b/app/test_suite.h index 72cc28c..34e784d 100644 --- a/app/test_suite.h +++ b/app/test_suite.h @@ -6,71 +6,16 @@ #define APP_TEST_SUITE_H_ #pragma once -#include "build/build_config.h" - -#include "app/app_paths.h" -#include "base/path_service.h" -#include "base/mac/scoped_nsautorelease_pool.h" #include "base/test/test_suite.h" -#include "build/build_config.h" -#include "ui/base/resource/resource_bundle.h" -#include "ui/base/ui_base_paths.h" - -#if defined(OS_MACOSX) -#include "base/mac/mac_util.h" -#endif class AppTestSuite : public base::TestSuite { public: - AppTestSuite(int argc, char** argv) : TestSuite(argc, argv) { - } + AppTestSuite(int argc, char** argv); + virtual ~AppTestSuite(); protected: - - virtual void Initialize() { - base::mac::ScopedNSAutoreleasePool autorelease_pool; - - base::TestSuite::Initialize(); - - app::RegisterPathProvider(); - ui::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::SetOverrideAppBundlePath(path); -#elif defined(OS_POSIX) - FilePath pak_dir; - PathService::Get(base::DIR_MODULE, &pak_dir); - pak_dir = pak_dir.AppendASCII("app_unittests_strings"); - PathService::Override(ui::DIR_LOCALES, pak_dir); - PathService::Override(ui::FILE_RESOURCES_PAK, - pak_dir.AppendASCII("app_resources.pak")); -#endif - - // Force unittests to run using en-US so if we test against string - // output, it'll pass regardless of the system language. - ResourceBundle::InitSharedInstance("en-US"); - } - - virtual void Shutdown() { - ResourceBundle::CleanupSharedInstance(); - -#if defined(OS_MACOSX) - base::mac::SetOverrideAppBundle(NULL); -#endif - TestSuite::Shutdown(); - } + virtual void Initialize(); + virtual void Shutdown(); }; #endif // APP_TEST_SUITE_H_ |