diff options
29 files changed, 122 insertions, 138 deletions
diff --git a/cc/test/run_all_unittests.cc b/cc/test/run_all_unittests.cc index 0ac740e..f4b42a0 100644 --- a/cc/test/run_all_unittests.cc +++ b/cc/test/run_all_unittests.cc @@ -2,15 +2,18 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "base/bind.h" #include "base/message_loop/message_loop.h" #include "base/test/test_suite.h" +#include "base/test/unit_test_launcher.h" #include "cc/test/cc_test_suite.h" #include "testing/gmock/include/gmock/gmock.h" int main(int argc, char** argv) { ::testing::InitGoogleMock(&argc, argv); cc::CCTestSuite test_suite(argc, argv); - int result = test_suite.Run(); - return result; + return base::LaunchUnitTests( + argc, argv, base::Bind(&cc::CCTestSuite::Run, + base::Unretained(&test_suite))); } diff --git a/chrome/app/run_all_unittests.cc b/chrome/app/run_all_unittests.cc deleted file mode 100644 index 9beab0d..0000000 --- a/chrome/app/run_all_unittests.cc +++ /dev/null @@ -1,9 +0,0 @@ -// 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 "base/test/test_suite.h" - -int main(int argc, char **argv) { - return base::TestSuite(argc, argv).Run(); -} diff --git a/chrome/chrome_tests_unit.gypi b/chrome/chrome_tests_unit.gypi index 1edbf36..4f73be8 100644 --- a/chrome/chrome_tests_unit.gypi +++ b/chrome/chrome_tests_unit.gypi @@ -2656,6 +2656,7 @@ '<@(chromium_child_dependencies)', '../content/content.gyp:content_app_both', # 2) test-specific support libraries: + '../base/base.gyp:run_all_unittests', '../testing/gmock.gyp:gmock', '../testing/gtest.gyp:gtest', 'test_support_common', @@ -2671,7 +2672,6 @@ 'app/delay_load_hook_win.h', 'app/delay_load_hook_unittest_win.cc', 'app/hard_error_handler_win.cc', - 'app/run_all_unittests.cc', 'common/crash_keys.cc', 'common/crash_keys.h', ], diff --git a/chrome/test/base/run_all_unittests.cc b/chrome/test/base/run_all_unittests.cc index 0cd1fa5..55ddcb6 100644 --- a/chrome/test/base/run_all_unittests.cc +++ b/chrome/test/base/run_all_unittests.cc @@ -2,9 +2,15 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "base/bind.h" +#include "base/test/unit_test_launcher.h" #include "chrome/test/base/chrome_test_suite.h" #include "content/public/test/unittest_test_suite.h" int main(int argc, char **argv) { - return content::UnitTestTestSuite(new ChromeTestSuite(argc, argv)).Run(); + content::UnitTestTestSuite test_suite(new ChromeTestSuite(argc, argv)); + + return base::LaunchUnitTests( + argc, argv, base::Bind(&content::UnitTestTestSuite::Run, + base::Unretained(&test_suite))); } diff --git a/components/test/run_all_unittests.cc b/components/test/run_all_unittests.cc index a881798..eeb42ed 100644 --- a/components/test/run_all_unittests.cc +++ b/components/test/run_all_unittests.cc @@ -2,8 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "base/bind.h" #include "base/memory/scoped_ptr.h" #include "base/test/test_suite.h" +#include "base/test/unit_test_launcher.h" #include "content/public/test/test_content_client_initializer.h" #include "testing/gtest/include/gtest/gtest.h" @@ -39,5 +41,7 @@ int main(int argc, char** argv) { testing::UnitTest::GetInstance()->listeners(); listeners.Append(new components::ComponentsUnitTestEventListener()); - return test_suite.Run(); + return base::LaunchUnitTests( + argc, argv, base::Bind(&base::TestSuite::Run, + base::Unretained(&test_suite))); } diff --git a/content/test/run_all_unittests.cc b/content/test/run_all_unittests.cc index 695cebe..f098a06 100644 --- a/content/test/run_all_unittests.cc +++ b/content/test/run_all_unittests.cc @@ -2,10 +2,16 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "base/bind.h" +#include "base/test/unit_test_launcher.h" #include "content/test/content_test_suite.h" #include "content/public/test/unittest_test_suite.h" int main(int argc, char** argv) { - return content::UnitTestTestSuite( - new content::ContentTestSuite(argc, argv)).Run(); + content::UnitTestTestSuite test_suite( + new content::ContentTestSuite(argc, argv)); + + return base::LaunchUnitTests( + argc, argv, base::Bind(&content::UnitTestTestSuite::Run, + base::Unretained(&test_suite))); } diff --git a/courgette/courgette.gyp b/courgette/courgette.gyp index 5bed905..03ab825 100644 --- a/courgette/courgette.gyp +++ b/courgette/courgette.gyp @@ -102,7 +102,6 @@ 'encoded_program_unittest.cc', 'encode_decode_unittest.cc', 'ensemble_unittest.cc', - 'run_all_unittests.cc', 'streams_unittest.cc', 'typedrva_unittest.cc', 'versioning_unittest.cc', @@ -112,6 +111,7 @@ 'courgette_lib', '../base/base.gyp:base', '../base/base.gyp:base_i18n', + '../base/base.gyp:run_all_unittests', '../base/base.gyp:test_support_base', '../testing/gtest.gyp:gtest', ], diff --git a/courgette/run_all_unittests.cc b/courgette/run_all_unittests.cc deleted file mode 100644 index 8bfeb3b..0000000 --- a/courgette/run_all_unittests.cc +++ /dev/null @@ -1,9 +0,0 @@ -// 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. - -#include "base/test/test_suite.h" - -int main(int argc, char** argv) { - return base::TestSuite(argc, argv).Run(); -} diff --git a/crypto/crypto.gyp b/crypto/crypto.gyp index e2ac853..2f38aee 100644 --- a/crypto/crypto.gyp +++ b/crypto/crypto.gyp @@ -243,10 +243,6 @@ 'target_name': 'crypto_unittests', 'type': 'executable', 'sources': [ - # Infrastructure files. - 'run_all_unittests.cc', - - # Tests. 'curve25519_unittest.cc', 'ec_private_key_unittest.cc', 'ec_signature_creator_unittest.cc', @@ -270,6 +266,7 @@ 'dependencies': [ 'crypto', '../base/base.gyp:base', + '../base/base.gyp:run_all_unittests', '../base/base.gyp:test_support_base', '../testing/gmock.gyp:gmock', '../testing/gtest.gyp:gtest', diff --git a/crypto/run_all_unittests.cc b/crypto/run_all_unittests.cc deleted file mode 100644 index 0728a98..0000000 --- a/crypto/run_all_unittests.cc +++ /dev/null @@ -1,17 +0,0 @@ -// 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 "base/test/test_suite.h" -#include "crypto/nss_util.h" - -int main(int argc, char** argv) { -#if defined(USE_NSS) - // This is most likely not needed, but it basically replaces a similar call - // that was performed on test_support_base. - // TODO(rvargas) Bug 79359: remove this. - crypto::EnsureNSSInit(); -#endif // defined(USE_NSS) - - return base::TestSuite(argc, argv).Run(); -} diff --git a/device/device_tests.gyp b/device/device_tests.gyp index bdc387c..c9d29d44 100644 --- a/device/device_tests.gyp +++ b/device/device_tests.gyp @@ -11,6 +11,7 @@ 'target_name': 'device_unittests', 'type': '<(gtest_target_type)', 'dependencies': [ + '../base/base.gyp:run_all_unittests', '../base/base.gyp:test_support_base', '../testing/gmock.gyp:gmock', '../testing/gtest.gyp:gtest', @@ -28,7 +29,6 @@ 'bluetooth/bluetooth_service_record_win_unittest.cc', 'bluetooth/bluetooth_task_manager_win_unittest.cc', 'bluetooth/bluetooth_utils_unittest.cc', - 'test/run_all_unittests.cc', 'usb/usb_ids_unittest.cc', ], 'conditions': [ diff --git a/device/test/run_all_unittests.cc b/device/test/run_all_unittests.cc deleted file mode 100644 index f4b4fc8..0000000 --- a/device/test/run_all_unittests.cc +++ /dev/null @@ -1,9 +0,0 @@ -// 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 "base/test/test_suite.h" - -int main(int argc, char **argv) { - return base::TestSuite(argc, argv).Run(); -} diff --git a/jingle/jingle.gyp b/jingle/jingle.gyp index ecfd30e..b2e9f76 100644 --- a/jingle/jingle.gyp +++ b/jingle/jingle.gyp @@ -182,7 +182,6 @@ 'notifier/listener/send_ping_task_unittest.cc', 'notifier/listener/xml_element_util_unittest.cc', 'notifier/listener/xmpp_push_client_unittest.cc', - 'run_all_unittests.cc', ], 'conditions': [ ['OS=="android"', { @@ -203,6 +202,7 @@ 'notifier', 'notifier_test_util', '../base/base.gyp:base', + '../base/base.gyp:run_all_unittests', '../base/base.gyp:test_support_base', '../net/net.gyp:net', '../net/net.gyp:net_test_support', diff --git a/jingle/run_all_unittests.cc b/jingle/run_all_unittests.cc deleted file mode 100644 index 7fd6ef2..0000000 --- a/jingle/run_all_unittests.cc +++ /dev/null @@ -1,9 +0,0 @@ -// 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 "base/test/test_suite.h" - -int main(int argc, char** argv) { - return base::TestSuite(argc, argv).Run(); -} diff --git a/media/base/run_all_unittests.cc b/media/base/run_all_unittests.cc index f0c3a6b..a9a6423 100644 --- a/media/base/run_all_unittests.cc +++ b/media/base/run_all_unittests.cc @@ -2,8 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "base/bind.h" #include "base/command_line.h" #include "base/test/test_suite.h" +#include "base/test/unit_test_launcher.h" #include "build/build_config.h" #include "media/base/media.h" #include "media/base/media_switches.h" @@ -40,5 +42,9 @@ void TestSuiteNoAtExit::Initialize() { } int main(int argc, char** argv) { - return TestSuiteNoAtExit(argc, argv).Run(); + TestSuiteNoAtExit test_suite(argc, argv); + + return base::LaunchUnitTests( + argc, argv, base::Bind(&TestSuiteNoAtExit::Run, + base::Unretained(&test_suite))); } diff --git a/net/test/run_all_unittests.cc b/net/test/run_all_unittests.cc index d8392ff..07aaeb6 100644 --- a/net/test/run_all_unittests.cc +++ b/net/test/run_all_unittests.cc @@ -3,6 +3,7 @@ // found in the LICENSE file. #include "base/metrics/statistics_recorder.h" +#include "base/test/unit_test_launcher.h" #include "build/build_config.h" #include "crypto/nss_util.h" #include "net/socket/client_socket_pool_base.h" @@ -49,5 +50,7 @@ int main(int argc, char** argv) { net::ProxyResolverV8::RememberDefaultIsolate(); #endif - return test_suite.Run(); + return base::LaunchUnitTests( + argc, argv, base::Bind(&NetTestSuite::Run, + base::Unretained(&test_suite))); } diff --git a/ppapi/ppapi_tests.gypi b/ppapi/ppapi_tests.gypi index cf755c1..4f439ba 100644 --- a/ppapi/ppapi_tests.gypi +++ b/ppapi/ppapi_tests.gypi @@ -143,6 +143,7 @@ 'ppapi_proxy', 'ppapi_shared', 'ppapi_unittest_shared', + '../base/base.gyp:run_all_unittests', '../base/base.gyp:test_support_base', '../gpu/gpu.gyp:gpu_ipc', '../ipc/ipc.gyp:ipc', @@ -157,8 +158,6 @@ '../ppapi', ], 'sources': [ - 'proxy/run_all_unittests.cc', - 'host/resource_message_filter_unittest.cc', # Piggy back on ppapi_unittests for a simple NaCl unittest, # which must not have dependencies on anything other than stdlibs. diff --git a/ppapi/proxy/run_all_unittests.cc b/ppapi/proxy/run_all_unittests.cc deleted file mode 100644 index 7fd6ef2..0000000 --- a/ppapi/proxy/run_all_unittests.cc +++ /dev/null @@ -1,9 +0,0 @@ -// 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 "base/test/test_suite.h" - -int main(int argc, char** argv) { - return base::TestSuite(argc, argv).Run(); -} diff --git a/printing/printing.gyp b/printing/printing.gyp index 890e5bf..8834611 100644 --- a/printing/printing.gyp +++ b/printing/printing.gyp @@ -242,6 +242,7 @@ 'dependencies': [ 'printing', '../testing/gtest.gyp:gtest', + '../base/base.gyp:run_all_unittests', '../base/base.gyp:test_support_base', '../ui/ui.gyp:ui', ], @@ -254,14 +255,12 @@ 'page_setup_unittest.cc', 'pdf_metafile_cg_mac_unittest.cc', 'printed_page_unittest.cc', - 'run_all_unittests.cc', 'units_unittest.cc', ], 'conditions': [ ['enable_printing==0', { 'sources/': [ ['exclude', '.'], - ['include', 'run_all_unittests.cc'], ], }], ['toolkit_uses_gtk == 0', {'sources/': [['exclude', '_gtk_unittest\\.cc$']]}], diff --git a/printing/run_all_unittests.cc b/printing/run_all_unittests.cc deleted file mode 100644 index b715a328b..0000000 --- a/printing/run_all_unittests.cc +++ /dev/null @@ -1,9 +0,0 @@ -// 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 "base/test/test_suite.h" - -int main(int argc, char** argv) { - return base::TestSuite(argc, argv).Run(); -} diff --git a/sql/run_all_unittests.cc b/sql/run_all_unittests.cc deleted file mode 100644 index 2c8d29c..0000000 --- a/sql/run_all_unittests.cc +++ /dev/null @@ -1,9 +0,0 @@ -// 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 "base/test/test_suite.h" - -int main(int argc, char** argv) { - return base::TestSuite(argc, argv).Run(); -} diff --git a/sql/sql.gyp b/sql/sql.gyp index 49ace01..aa2d642 100644 --- a/sql/sql.gyp +++ b/sql/sql.gyp @@ -78,12 +78,12 @@ 'dependencies': [ 'sql', 'test_support_sql', + '../base/base.gyp:run_all_unittests', '../base/base.gyp:test_support_base', '../testing/gtest.gyp:gtest', '../third_party/sqlite/sqlite.gyp:sqlite', ], 'sources': [ - 'run_all_unittests.cc', 'connection_unittest.cc', 'recovery_unittest.cc', 'sqlite_features_unittest.cc', diff --git a/ui/aura/test/run_all_unittests.cc b/ui/aura/test/run_all_unittests.cc index 9932c03..5f184b0 100644 --- a/ui/aura/test/run_all_unittests.cc +++ b/ui/aura/test/run_all_unittests.cc @@ -2,8 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "base/bind.h" +#include "base/test/unit_test_launcher.h" #include "ui/aura/test/test_suite.h" int main(int argc, char** argv) { - return aura::test::AuraTestSuite(argc, argv).Run(); + aura::test::AuraTestSuite test_suite(argc, argv); + + return base::LaunchUnitTests( + argc, argv, base::Bind(&aura::test::AuraTestSuite::Run, + base::Unretained(&test_suite))); } diff --git a/ui/compositor/run_all_unittests.cc b/ui/compositor/run_all_unittests.cc index 52bb2fa..f2f7251 100644 --- a/ui/compositor/run_all_unittests.cc +++ b/ui/compositor/run_all_unittests.cc @@ -2,8 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "base/bind.h" +#include "base/test/unit_test_launcher.h" #include "ui/compositor/test/test_suite.h" int main(int argc, char** argv) { - return ui::test::CompositorTestSuite(argc, argv).Run(); + ui::test::CompositorTestSuite test_suite(argc, argv); + + return base::LaunchUnitTests( + argc, argv, base::Bind(&ui::test::CompositorTestSuite::Run, + base::Unretained(&test_suite))); } diff --git a/ui/message_center/test/run_all_unittests.cc b/ui/message_center/test/run_all_unittests.cc index ff863b6..a4bfa26 100644 --- a/ui/message_center/test/run_all_unittests.cc +++ b/ui/message_center/test/run_all_unittests.cc @@ -2,35 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "base/basictypes.h" -#include "base/compiler_specific.h" -#include "ui/base/resource/resource_bundle.h" -#include "ui/base/ui_base_paths.h" +#include "base/bind.h" +#include "base/test/unit_test_launcher.h" #include "ui/test/test_suite.h" -#include "ui/views/view.h" - -class MessageCenterTestSuite : public ui::test::UITestSuite { - public: - MessageCenterTestSuite(int argc, char** argv) - : ui::test::UITestSuite(argc, argv) { - } - - protected: - virtual void Initialize() OVERRIDE; - virtual void Shutdown() OVERRIDE; - - private: - DISALLOW_COPY_AND_ASSIGN(MessageCenterTestSuite); -}; - -void MessageCenterTestSuite::Initialize() { - ui::test::UITestSuite::Initialize(); -} - -void MessageCenterTestSuite::Shutdown() { - ui::test::UITestSuite::Shutdown(); -} int main(int argc, char** argv) { - return MessageCenterTestSuite(argc, argv).Run(); + ui::test::UITestSuite test_suite(argc, argv); + + return base::LaunchUnitTests( + argc, argv, base::Bind(&ui::test::UITestSuite::Run, + base::Unretained(&test_suite))); } diff --git a/ui/snapshot/test/run_all_unittests.cc b/ui/snapshot/test/run_all_unittests.cc index 5bf3d5f..395f0f6 100644 --- a/ui/snapshot/test/run_all_unittests.cc +++ b/ui/snapshot/test/run_all_unittests.cc @@ -2,13 +2,39 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "base/bind.h" #include "base/test/test_suite.h" +#include "base/test/unit_test_launcher.h" #include "ui/compositor/test/test_suite.h" +namespace { + +class NoAtExitBaseTestSuite : public base::TestSuite { + public: + NoAtExitBaseTestSuite(int argc, char** argv) + : base::TestSuite(argc, argv, false) { + } +}; + +int RunTestSuite(int argc, char** argv) { + return NoAtExitBaseTestSuite(argc, argv).Run(); +} + +} // namespace + int main(int argc, char** argv) { #if defined(USE_AURA) - return ui::test::CompositorTestSuite(argc, argv).Run(); + ui::test::CompositorTestSuite test_suite(argc, argv); + + return base::LaunchUnitTests( + argc, argv, base::Bind(&ui::test::CompositorTestSuite::Run, + base::Unretained(&test_suite))); #else - return base::TestSuite(argc, argv).Run(); +#if !defined(OS_ANDROID) + base::AtExitManager at_exit; +#endif + return base::LaunchUnitTests(argc, + argv, + base::Bind(&RunTestSuite, argc, argv)); #endif } diff --git a/ui/test/run_all_unittests.cc b/ui/test/run_all_unittests.cc index 13ed8d6..6c45f66 100644 --- a/ui/test/run_all_unittests.cc +++ b/ui/test/run_all_unittests.cc @@ -2,8 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "base/bind.h" +#include "base/test/unit_test_launcher.h" #include "ui/test/test_suite.h" int main(int argc, char** argv) { - return ui::test::UITestSuite(argc, argv).Run(); + ui::test::UITestSuite test_suite(argc, argv); + + return base::LaunchUnitTests( + argc, argv, base::Bind(&ui::test::UITestSuite::Run, + base::Unretained(&test_suite))); } diff --git a/ui/views/run_all_unittests.cc b/ui/views/run_all_unittests.cc index 6c425d7..fb99c44 100644 --- a/ui/views/run_all_unittests.cc +++ b/ui/views/run_all_unittests.cc @@ -3,8 +3,10 @@ // found in the LICENSE file. #include "base/basictypes.h" +#include "base/bind.h" #include "base/compiler_specific.h" #include "base/test/test_suite.h" +#include "base/test/unit_test_launcher.h" #include "ui/base/resource/resource_bundle.h" #include "ui/base/ui_base_paths.h" #include "ui/views/view.h" @@ -25,5 +27,9 @@ class ViewTestSuite : public base::TestSuite { }; int main(int argc, char** argv) { - return ViewTestSuite(argc, argv).Run(); + ViewTestSuite test_suite(argc, argv); + + return base::LaunchUnitTests( + argc, argv, base::Bind(&ViewTestSuite::Run, + base::Unretained(&test_suite))); } diff --git a/webkit/renderer/compositor_bindings/test/run_all_unittests.cc b/webkit/renderer/compositor_bindings/test/run_all_unittests.cc index 0a37c57..94d25fb 100644 --- a/webkit/renderer/compositor_bindings/test/run_all_unittests.cc +++ b/webkit/renderer/compositor_bindings/test/run_all_unittests.cc @@ -2,15 +2,27 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "base/bind.h" #include "base/message_loop/message_loop.h" #include "base/test/test_suite.h" +#include "base/test/unit_test_launcher.h" #include "testing/gmock/include/gmock/gmock.h" +namespace { + +int RunTestSuite(TestSuite* test_suite) { + base::MessageLoop message_loop; + return test_suite->Run(); +} + +} // namespace + int main(int argc, char** argv) { ::testing::InitGoogleMock(&argc, argv); + TestSuite test_suite(argc, argv); - base::MessageLoop message_loop; - int result = test_suite.Run(); - return result; + return base::LaunchUnitTests( + argc, argv, base::Bind(&RunTestSuite, + base::Unretained(&test_suite))); } |