diff options
author | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-18 21:23:49 +0000 |
---|---|---|
committer | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-18 21:23:49 +0000 |
commit | 3c53cfa23d26b9477e3ca46e141c820e9793a5f2 (patch) | |
tree | 704ac6f5b8b9ebbb0640a853f25002d86ccd0c8e /app | |
parent | 24f57133d4cf6da4c4122a609c6d1fd7262d6f06 (diff) | |
download | chromium_src-3c53cfa23d26b9477e3ca46e141c820e9793a5f2.zip chromium_src-3c53cfa23d26b9477e3ca46e141c820e9793a5f2.tar.gz chromium_src-3c53cfa23d26b9477e3ca46e141c820e9793a5f2.tar.bz2 |
Move app-related unit tests to gyp in app.gyp
http://crbug.com/11387
Review URL: http://codereview.chromium.org/113540
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16326 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'app')
-rw-r--r-- | app/app.gyp | 48 | ||||
-rw-r--r-- | app/l10n_util_unittest.cc | 3 | ||||
-rw-r--r-- | app/run_all_unittests.cc | 9 | ||||
-rw-r--r-- | app/test_suite.h | 59 |
4 files changed, 118 insertions, 1 deletions
diff --git a/app/app.gyp b/app/app.gyp index 19750f7..06c954a 100644 --- a/app/app.gyp +++ b/app/app.gyp @@ -159,5 +159,53 @@ }], ], }, + { + 'target_name': 'app_unittests', + 'type': 'executable', + 'msvs_guid': 'B4D59AE8-8D2F-97E1-A8E9-6D2826729530', + 'dependencies': [ + '../app/app.gyp:app_base', + '../net/net.gyp:net_test_support', + '../skia/skia.gyp:skia', + '../testing/gtest.gyp:gtest', + '../third_party/icu38/icu38.gyp:icui18n', + '../third_party/icu38/icu38.gyp:icuuc', + '../third_party/libxml/libxml.gyp:libxml', + ], + 'sources': [ + 'animation_unittest.cc', + 'gfx/font_unittest.cc', + 'gfx/icon_util_unittest.cc', + 'gfx/text_elider_unittest.cc', + 'l10n_util_unittest.cc', + 'os_exchange_data_win_unittest.cc', + 'run_all_unittests.cc', + 'test_suite.h', + 'tree_node_iterator_unittest.cc', + 'win_util_unittest.cc', + ], + 'include_dirs': [ + '..', + ], + 'conditions': [ + ['OS=="linux"', { + # TODO: Move these dependencies to platform-neutral once these + # projects are generated by GYP. + 'dependencies': [ + '../build/linux/system.gyp:gtk', + '../chrome/chrome.gyp:chrome_resources', + '../chrome/chrome.gyp:chrome_strings', + '../chrome/chrome.gyp:test_support_unit', + ], + }], + ['OS!="win"', { + 'sources!': [ + 'gfx/icon_util_unittest.cc', + 'os_exchange_data_win_unittest.cc', + 'win_util_unittest.cc', + ], + }], + ], + }, ], } diff --git a/app/l10n_util_unittest.cc b/app/l10n_util_unittest.cc index 3503c096..48dc1f0 100644 --- a/app/l10n_util_unittest.cc +++ b/app/l10n_util_unittest.cc @@ -44,7 +44,8 @@ class L10nUtilTest : public PlatformTest { }; #if defined(OS_WIN) -TEST_F(L10nUtilTest, GetString) { +// TODO(beng): disabled until app strings move to app. +TEST_F(L10nUtilTest, DISABLED_GetString) { std::wstring s = l10n_util::GetString(IDS_SIMPLE); EXPECT_EQ(std::wstring(L"Hello World!"), s); diff --git a/app/run_all_unittests.cc b/app/run_all_unittests.cc new file mode 100644 index 0000000..63b8020 --- /dev/null +++ b/app/run_all_unittests.cc @@ -0,0 +1,9 @@ +// Copyright (c) 2006-2008 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" + +int main(int argc, char** argv) { + return AppTestSuite(argc, argv).Run(); +} diff --git a/app/test_suite.h b/app/test_suite.h new file mode 100644 index 0000000..18b07e6 --- /dev/null +++ b/app/test_suite.h @@ -0,0 +1,59 @@ +// Copyright (c) 2009 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. + +#ifndef APP_TEST_SUITE_H_ +#define APP_TEST_SUITE_H_ + +#include "build/build_config.h" + +#include <string> + +#include "app/app_paths.h" +#include "app/resource_bundle.h" +#include "base/path_service.h" +#if defined(OS_MACOSX) +#include "base/mac_util.h" +#endif +#include "base/scoped_nsautorelease_pool.h" +#include "base/test_suite.h" + +class AppTestSuite : public TestSuite { + public: + AppTestSuite(int argc, char** argv) : TestSuite(argc, argv) { + } + + protected: + + virtual void Initialize() { + base::ScopedNSAutoreleasePool autorelease_pool; + + TestSuite::Initialize(); + + app::RegisterPathProvider(); + +#if defined(OS_MACOSX) + FilePath path; + PathService::Get(base::DIR_EXE, &path); + // TODO(port): make a resource bundle for non-app exes. + path = path.AppendASCII("Chromium.app"); + mac_util::SetOverrideAppBundlePath(path); +#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(L"en-us"); + ResourceBundle::GetSharedInstance().LoadThemeResources(); + } + + virtual void Shutdown() { + ResourceBundle::CleanupSharedInstance(); + +#if defined(OS_MACOSX) + mac_util::SetOverrideAppBundle(NULL); +#endif + TestSuite::Shutdown(); + } +}; + +#endif // APP_TEST_SUITE_H_ |