summaryrefslogtreecommitdiffstats
path: root/chrome_frame
diff options
context:
space:
mode:
authorphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-27 20:36:51 +0000
committerphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-27 20:36:51 +0000
commit82682c584f28b2a479c3a58eab6b32d7647dc276 (patch)
tree4bb8e658a9f38163ae790f224375446a8458c063 /chrome_frame
parenta7692c229bdf4e8fdd6e92f5fb0189204a8a6e43 (diff)
downloadchromium_src-82682c584f28b2a479c3a58eab6b32d7647dc276.zip
chromium_src-82682c584f28b2a479c3a58eab6b32d7647dc276.tar.gz
chromium_src-82682c584f28b2a479c3a58eab6b32d7647dc276.tar.bz2
GTTF: enable brave new test launcher for chrome_frame_tests and chrome_frame_unittests
This is still behind --brave-new-test-launcher command-line flag. BUG=236893 R=erikwright@chromium.org Review URL: https://codereview.chromium.org/86773003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@237621 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame')
-rw-r--r--chrome_frame/chrome_frame_unittest_main.cc31
-rw-r--r--chrome_frame/test/run_all_unittests.cc52
2 files changed, 58 insertions, 25 deletions
diff --git a/chrome_frame/chrome_frame_unittest_main.cc b/chrome_frame/chrome_frame_unittest_main.cc
index f8be06e..84523d8 100644
--- a/chrome_frame/chrome_frame_unittest_main.cc
+++ b/chrome_frame/chrome_frame_unittest_main.cc
@@ -9,6 +9,8 @@
#include "base/command_line.h"
#include "base/process/kill.h"
#include "base/process/process.h"
+#include "base/test/launcher/unit_test_launcher.h"
+#include "base/test/test_suite.h"
#include "chrome_frame/crash_server_init.h"
#include "chrome_frame/test/chrome_frame_test_utils.h"
#include "gtest/gtest.h"
@@ -26,23 +28,38 @@ void DeleteAllSingletons() {
}
}
-int main(int argc, char** argv) {
- testing::InitGoogleTest(&argc, argv);
+namespace {
+
+class NoAtExitBaseTestSuite : public base::TestSuite {
+ public:
+ NoAtExitBaseTestSuite(int argc, char** argv)
+ : base::TestSuite(argc, argv, false) {
+ }
+};
+int RunTests(int argc, char** argv) {
base::AtExitManager at_exit_manager;
g_at_exit_manager = &at_exit_manager;
+ NoAtExitBaseTestSuite test_suite(argc, argv);
+ int exit_code = test_suite.Run();
+ g_at_exit_manager = NULL;
+ return exit_code;
+}
+} // namespace
+
+int main(int argc, char** argv) {
base::ProcessHandle crash_service = chrome_frame_test::StartCrashService();
google_breakpad::scoped_ptr<google_breakpad::ExceptionHandler> breakpad(
InitializeCrashReporting(HEADLESS));
- CommandLine::Init(argc, argv);
-
- RUN_ALL_TESTS();
-
- g_at_exit_manager = NULL;
+ int exit_code = base::LaunchUnitTests(argc,
+ argv,
+ base::Bind(&RunTests, argc, argv));
if (crash_service)
base::KillProcess(crash_service, 0, false);
+
+ return exit_code;
}
diff --git a/chrome_frame/test/run_all_unittests.cc b/chrome_frame/test/run_all_unittests.cc
index 8d42783..c1deee4 100644
--- a/chrome_frame/test/run_all_unittests.cc
+++ b/chrome_frame/test/run_all_unittests.cc
@@ -7,6 +7,7 @@
#include "base/command_line.h"
#include "base/process/kill.h"
#include "base/process/memory.h"
+#include "base/test/launcher/unit_test_launcher.h"
#include "base/test/test_suite.h"
#include "base/threading/platform_thread.h"
#include "base/win/scoped_com_initializer.h"
@@ -44,31 +45,17 @@ void PureCall() {
__debugbreak();
}
-int main(int argc, char **argv) {
+namespace {
+
+int RunTests(int argc, char** argv) {
// For ATL in VS2010 and up, ChromeFrameUnittestsModule::InitializeCom() is
// not called, so we init COM here.
base::win::ScopedCOMInitializer com_initializer_;
ScopedChromeFrameRegistrar::RegisterAndExitProcessIfDirected();
- base::EnableTerminationOnHeapCorruption();
- base::PlatformThread::SetName("ChromeFrame tests");
-
- _set_purecall_handler(PureCall);
base::TestSuite test_suite(argc, argv);
- SetConfigBool(kChromeFrameHeadlessMode, true);
- SetConfigBool(kChromeFrameAccessibleMode, true);
-
- base::ProcessHandle crash_service = NULL;
- google_breakpad::scoped_ptr<google_breakpad::ExceptionHandler> breakpad;
-
- if (!CommandLine::ForCurrentProcess()->HasSwitch(kNoCrashService)) {
- crash_service = chrome_frame_test::StartCrashService();
-
- breakpad.reset(InitializeCrashReporting(HEADLESS));
- }
-
// Install the log collector before anything else that adds a Google Test
// event listener so that it's the last one to run after each test (the
// listeners are invoked in reverse order at the end of a test). This allows
@@ -101,10 +88,39 @@ int main(int argc, char **argv) {
ret = test_suite.Run();
}
+ return ret;
+}
+
+} // namespace
+
+int main(int argc, char **argv) {
+ CommandLine::Init(argc, argv);
+
+ base::EnableTerminationOnHeapCorruption();
+
+ _set_purecall_handler(PureCall);
+
+ SetConfigBool(kChromeFrameHeadlessMode, true);
+ SetConfigBool(kChromeFrameAccessibleMode, true);
+
+ base::ProcessHandle crash_service = NULL;
+ google_breakpad::scoped_ptr<google_breakpad::ExceptionHandler> breakpad;
+
+ if (!CommandLine::ForCurrentProcess()->HasSwitch(kNoCrashService)) {
+ crash_service = chrome_frame_test::StartCrashService();
+
+ breakpad.reset(InitializeCrashReporting(HEADLESS));
+ }
+
+ int exit_code = base::LaunchUnitTests(argc,
+ argv,
+ base::Bind(&RunTests, argc, argv));
+
DeleteConfigValue(kChromeFrameHeadlessMode);
DeleteConfigValue(kChromeFrameAccessibleMode);
if (crash_service)
base::KillProcess(crash_service, 0, false);
- return ret;
+
+ return exit_code;
}