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 | |
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
-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 | ||||
-rw-r--r-- | chrome/chrome.gyp | 10 | ||||
-rw-r--r-- | chrome/chrome.sln | 50 |
6 files changed, 141 insertions, 38 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_ diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp index 7a49688..9cdd7cf 100644 --- a/chrome/chrome.gyp +++ b/chrome/chrome.gyp @@ -2775,35 +2775,27 @@ 'browser/visitedlink_unittest.cc', 'browser/webdata/web_database_unittest.cc', 'browser/window_sizer_unittest.cc', - '../app/animation_unittest.cc', 'common/bzip2_unittest.cc', 'common/chrome_plugin_unittest.cc', 'common/extensions/url_pattern_unittest.cc', 'common/extensions/user_script_unittest.cc', 'common/file_descriptor_set_unittest.cc', - '../app/gfx/font_unittest.cc', 'common/gfx/emf_unittest.cc', - '../app/gfx/icon_util_unittest.cc', - '../app/gfx/text_elider_unittest.cc', 'common/important_file_writer_unittest.cc', 'common/ipc_message_unittest.cc', 'common/ipc_sync_channel_unittest.cc', 'common/ipc_sync_message_unittest.cc', 'common/ipc_sync_message_unittest.h', 'common/json_value_serializer_unittest.cc', - '../app/l10n_util_unittest.cc', 'common/mru_cache_unittest.cc', 'common/net/url_util_unittest.cc', 'common/notification_service_unittest.cc', - '../app/os_exchange_data_unittest.cc', 'common/pref_member_unittest.cc', 'common/pref_service_unittest.cc', 'common/property_bag_unittest.cc', 'common/resource_dispatcher_unittest.cc', - '../app/tree_node_iterator_unittest.cc', 'common/time_format_unittest.cc', 'common/unzip_unittest.cc', - '../app/win_util_unittest.cc', 'common/worker_thread_ticker_unittest.cc', 'renderer/extensions/extension_api_client_unittest.cc', 'renderer/extensions/greasemonkey_api_unittest.cc', @@ -2912,9 +2904,7 @@ 'browser/window_sizer_unittest.cc', 'common/chrome_plugin_unittest.cc', 'common/gfx/emf_unittest.cc', - '../app/gfx/icon_util_unittest.cc', 'common/net/url_util_unittest.cc', - '../app/os_exchange_data_unittest.cc', 'test/browser_with_test_window_test.cc', 'test/browser_with_test_window_test.h', '../views/controls/label_unittest.cc', diff --git a/chrome/chrome.sln b/chrome/chrome.sln index 9c5162c..c6549d5 100644 --- a/chrome/chrome.sln +++ b/chrome/chrome.sln @@ -100,9 +100,6 @@ EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libjpeg", "..\third_party\libjpeg\libjpeg.vcproj", "{238CE175-76CE-4A25-A676-69D115885601}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ffmpeg", "..\third_party\ffmpeg\ffmpeg.vcproj", "{D7A94F58-576A-45D9-A45F-EB87C63ABBB0}" - ProjectSection(ProjectDependencies) = postProject - {D28CF9C7-B857-C11E-B94D-ECA46CDEB3CE} = {D28CF9C7-B857-C11E-B94D-ECA46CDEB3CE} - EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "image_diff", "tools\test\image_diff\image_diff.vcproj", "{50B079C7-CD01-42D3-B8C4-9F8D9322E822}" ProjectSection(ProjectDependencies) = postProject @@ -132,9 +129,6 @@ EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lzma_sdk", "..\third_party\lzma_sdk\7z_C.vcproj", "{B84553C8-5676-427B-B3E4-23DDDC4DBC7B}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "chrome_strings", "app\chrome_strings.vcproj", "{D9DDAF60-663F-49CC-90DC-3D08CC3D1B28}" - ProjectSection(ProjectDependencies) = postProject - {D28CF9C7-B857-C11E-B94D-ECA46CDEB3CE} = {D28CF9C7-B857-C11E-B94D-ECA46CDEB3CE} - EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "chrome_dll", "app\chrome_dll.vcproj", "{C0A7EE2C-2A6D-45BE-BA78-6D006FDF52D9}" ProjectSection(ProjectDependencies) = postProject @@ -510,9 +504,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_shell_tests", "..\webk EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "config", "..\webkit\config.vcproj", "{2E2D3301-2EC4-4C0F-B889-87073B30F673}" - ProjectSection(ProjectDependencies) = postProject - {D28CF9C7-B857-C11E-B94D-ECA46CDEB3CE} = {D28CF9C7-B857-C11E-B94D-ECA46CDEB3CE} - EndProjectSection EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "stats_viewer", "..\tools\stats_viewer\stats_viewer.csproj", "{41735CD9-3E35-47F7-9FD1-4A9950B6B131}" EndProject @@ -529,16 +520,12 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "locales", "locales", "{2325 EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "chrome_resources", "app\chrome_resources.vcproj", "{B95AB527-F7DB-41E9-AD91-EB51EE0F56BE}" - ProjectSection(ProjectDependencies) = postProject - {D28CF9C7-B857-C11E-B94D-ECA46CDEB3CE} = {D28CF9C7-B857-C11E-B94D-ECA46CDEB3CE} - EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "webkit_strings", "..\webkit\webkit_strings.vcproj", "{60B43839-95E6-4526-A661-209F16335E0E}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "theme_dll", "app\theme\theme_dll.vcproj", "{FD683DD6-D9BF-4B1B-AB6D-A3AC03EDAA4D}" ProjectSection(ProjectDependencies) = postProject {B95AB527-F7DB-41E9-AD91-EB51EE0F56BE} = {B95AB527-F7DB-41E9-AD91-EB51EE0F56BE} - {D28CF9C7-B857-C11E-B94D-ECA46CDEB3CE} = {D28CF9C7-B857-C11E-B94D-ECA46CDEB3CE} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "security_tests", "test\security_tests\security_tests.vcproj", "{E750512D-FC7C-4C98-BF04-0A0DAF882055}" @@ -878,7 +865,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pcre", "..\webkit\pcre.vcpr ProjectSection(ProjectDependencies) = postProject {2E2D3301-2EC4-4C0F-B889-87073B30F673} = {2E2D3301-2EC4-4C0F-B889-87073B30F673} {AA8A5A85-592B-4357-BC60-E0E91E026AF6} = {AA8A5A85-592B-4357-BC60-E0E91E026AF6} - {D28CF9C7-B857-C11E-B94D-ECA46CDEB3CE} = {D28CF9C7-B857-C11E-B94D-ECA46CDEB3CE} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gears", "..\gears\gears.vcproj", "{D703D7A0-EDC1-4FE6-9E22-56154155B24E}" @@ -1340,9 +1326,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gcapi_test", "installer\gca EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "net_resources", "..\net\net_resources.vcproj", "{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}" - ProjectSection(ProjectDependencies) = postProject - {D28CF9C7-B857-C11E-B94D-ECA46CDEB3CE} = {D28CF9C7-B857-C11E-B94D-ECA46CDEB3CE} - EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "webkit_resources", "..\webkit\webkit_resources.vcproj", "{0B469837-3D46-484A-AFB3-C5A6C68730B9}" EndProject @@ -1572,7 +1555,20 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_shell_common", "..\web EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "utility", "utility\utility.vcproj", "{4D2B38E6-65FF-4F97-B88A-E441DF54EBF7}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cygwin", "..\build\win\cygwin.vcproj", "{D28CF9C7-B857-C11E-B94D-ECA46CDEB3CE}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "app_unittests", "..\app\app_unittests.vcproj", "{B4D59AE8-8D2F-97E1-A8E9-6D2826729530}" + ProjectSection(ProjectDependencies) = postProject + {1832A374-8A74-4F9E-B536-69A699B3E165} = {1832A374-8A74-4F9E-B536-69A699B3E165} + {326E9795-E760-410A-B69A-3F79DB3F5243} = {326E9795-E760-410A-B69A-3F79DB3F5243} + {4631946D-7D5F-44BD-A5A8-504C0A7033BE} = {4631946D-7D5F-44BD-A5A8-504C0A7033BE} + {7100F41F-868D-4E99-80A2-AF8E6574749D} = {7100F41F-868D-4E99-80A2-AF8E6574749D} + {8423AF0D-4B88-4EBF-94E1-E4D00D00E21C} = {8423AF0D-4B88-4EBF-94E1-E4D00D00E21C} + {8C27D792-2648-4F5E-9ED0-374276327308} = {8C27D792-2648-4F5E-9ED0-374276327308} + {A508ADD3-CECE-4E0F-8448-2F5E454DF551} = {A508ADD3-CECE-4E0F-8448-2F5E454DF551} + {BFE8E2A7-3B3B-43B0-A994-3058B852DB8B} = {BFE8E2A7-3B3B-43B0-A994-3058B852DB8B} + {C564F145-9172-42C3-BFCB-6014CA97DBCD} = {C564F145-9172-42C3-BFCB-6014CA97DBCD} + {CD9CA56E-4E94-444C-87D4-58CA1E6F300D} = {CD9CA56E-4E94-444C-87D4-58CA1E6F300D} + {EF5E94AB-B646-4E5B-A058-52EF07B8351C} = {EF5E94AB-B646-4E5B-A058-52EF07B8351C} + EndProjectSection EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -2484,6 +2480,14 @@ Global {B30B0E1F-1CE9-4DEF-A752-7498FD709C1F}.Release|Mixed Platforms.Build.0 = Release|Win32 {B30B0E1F-1CE9-4DEF-A752-7498FD709C1F}.Release|Win32.ActiveCfg = Release|Win32 {B30B0E1F-1CE9-4DEF-A752-7498FD709C1F}.Release|Win32.Build.0 = Release|Win32 + {B4D59AE8-8D2F-97E1-A8E9-6D2826729530}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 + {B4D59AE8-8D2F-97E1-A8E9-6D2826729530}.Debug|Mixed Platforms.Build.0 = Debug|Win32 + {B4D59AE8-8D2F-97E1-A8E9-6D2826729530}.Debug|Win32.ActiveCfg = Debug|Win32 + {B4D59AE8-8D2F-97E1-A8E9-6D2826729530}.Debug|Win32.Build.0 = Debug|Win32 + {B4D59AE8-8D2F-97E1-A8E9-6D2826729530}.Release|Mixed Platforms.ActiveCfg = Release|Win32 + {B4D59AE8-8D2F-97E1-A8E9-6D2826729530}.Release|Mixed Platforms.Build.0 = Release|Win32 + {B4D59AE8-8D2F-97E1-A8E9-6D2826729530}.Release|Win32.ActiveCfg = Release|Win32 + {B4D59AE8-8D2F-97E1-A8E9-6D2826729530}.Release|Win32.Build.0 = Release|Win32 {B55CA863-B374-4BAF-95AC-539E4FA4C90C}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 {B55CA863-B374-4BAF-95AC-539E4FA4C90C}.Debug|Mixed Platforms.Build.0 = Debug|Win32 {B55CA863-B374-4BAF-95AC-539E4FA4C90C}.Debug|Win32.ActiveCfg = Debug|Win32 @@ -2692,14 +2696,6 @@ Global {D2250C20-3A94-4FB9-AF73-11BC5B73884B}.Release|Mixed Platforms.Build.0 = Release|Win32 {D2250C20-3A94-4FB9-AF73-11BC5B73884B}.Release|Win32.ActiveCfg = Release|Win32 {D2250C20-3A94-4FB9-AF73-11BC5B73884B}.Release|Win32.Build.0 = Release|Win32 - {D28CF9C7-B857-C11E-B94D-ECA46CDEB3CE}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 - {D28CF9C7-B857-C11E-B94D-ECA46CDEB3CE}.Debug|Mixed Platforms.Build.0 = Debug|Win32 - {D28CF9C7-B857-C11E-B94D-ECA46CDEB3CE}.Debug|Win32.ActiveCfg = Debug|Win32 - {D28CF9C7-B857-C11E-B94D-ECA46CDEB3CE}.Debug|Win32.Build.0 = Debug|Win32 - {D28CF9C7-B857-C11E-B94D-ECA46CDEB3CE}.Release|Mixed Platforms.ActiveCfg = Release|Win32 - {D28CF9C7-B857-C11E-B94D-ECA46CDEB3CE}.Release|Mixed Platforms.Build.0 = Release|Win32 - {D28CF9C7-B857-C11E-B94D-ECA46CDEB3CE}.Release|Win32.ActiveCfg = Release|Win32 - {D28CF9C7-B857-C11E-B94D-ECA46CDEB3CE}.Release|Win32.Build.0 = Release|Win32 {D314F1B3-9299-4866-8362-08BF811B0FA3}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 {D314F1B3-9299-4866-8362-08BF811B0FA3}.Debug|Mixed Platforms.Build.0 = Debug|Win32 {D314F1B3-9299-4866-8362-08BF811B0FA3}.Debug|Win32.ActiveCfg = Debug|Win32 @@ -3087,6 +3083,7 @@ Global {B0EE0599-2913-46A0-A847-A3EC813658D3} = {846901FD-A619-4BD5-A303-38174730CDD6} {B2D715CE-4CBB-415A-A032-E700C90ADF91} = {2325D8C4-8EF5-42AC-8900-492225750DE4} {B30B0E1F-1CE9-4DEF-A752-7498FD709C1F} = {2325D8C4-8EF5-42AC-8900-492225750DE4} + {B4D59AE8-8D2F-97E1-A8E9-6D2826729530} = {1174D37F-6ABB-45DA-81B3-C631281273B7} {B55CA863-B374-4BAF-95AC-539E4FA4C90C} = {873D095E-150E-4262-8C41-2D8ED02F0F57} {B64B396B-8EF1-4B6B-A07E-48D40EB961AB} = {1174D37F-6ABB-45DA-81B3-C631281273B7} {B802A2FE-E4E2-4F5A-905A-D5128875C954} = {EB684A4B-98F7-4E68-8EA7-EA74ACF7060B} @@ -3113,7 +3110,6 @@ Global {CE1426F6-7D2B-4574-9929-58387BF7B05F} = {2325D8C4-8EF5-42AC-8900-492225750DE4} {D13F055D-4428-48F4-ABF6-18359C76EDB0} = {2325D8C4-8EF5-42AC-8900-492225750DE4} {D2250C20-3A94-4FB9-AF73-11BC5B73884B} = {1174D37F-6ABB-45DA-81B3-C631281273B7} - {D28CF9C7-B857-C11E-B94D-ECA46CDEB3CE} = {846901FD-A619-4BD5-A303-38174730CDD6} {D314F1B3-9299-4866-8362-08BF811B0FA3} = {2325D8C4-8EF5-42AC-8900-492225750DE4} {D3E6C0FD-54C7-4FF2-9AE1-72F2DAFD820C} = {1174D37F-6ABB-45DA-81B3-C631281273B7} {D5E8DCB2-9C61-446F-8BEE-B18CA0E0936E} = {EF78C1F9-AA17-4CA5-B6CB-39B37A73A3DA} |