summaryrefslogtreecommitdiffstats
path: root/base/test
diff options
context:
space:
mode:
Diffstat (limited to 'base/test')
-rw-r--r--base/test/run_all_unittests.cc25
-rw-r--r--base/test/test_suite.cc15
-rw-r--r--base/test/test_suite.h7
3 files changed, 9 insertions, 38 deletions
diff --git a/base/test/run_all_unittests.cc b/base/test/run_all_unittests.cc
index 93cb8cb..e5c5975 100644
--- a/base/test/run_all_unittests.cc
+++ b/base/test/run_all_unittests.cc
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "base/at_exit.h"
#include "base/bind.h"
#include "base/test/launcher/unit_test_launcher.h"
#include "base/test/test_suite.h"
@@ -12,29 +11,13 @@
#include "base/test/test_file_util.h"
#endif
-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(OS_ANDROID)
JNIEnv* env = base::android::AttachCurrentThread();
base::RegisterContentUriTestUtils(env);
-#else
- base::AtExitManager at_exit;
#endif
- return base::LaunchUnitTests(argc,
- argv,
- base::Bind(&RunTestSuite, argc, argv));
+ base::TestSuite test_suite(argc, argv);
+ return base::LaunchUnitTests(
+ argc, argv,
+ base::Bind(&base::TestSuite::Run, base::Unretained(&test_suite)));
}
diff --git a/base/test/test_suite.cc b/base/test/test_suite.cc
index 57f4241..3a6c2b0 100644
--- a/base/test/test_suite.cc
+++ b/base/test/test_suite.cc
@@ -97,24 +97,18 @@ int RunUnitTestsUsingBaseTestSuite(int argc, char **argv) {
}
TestSuite::TestSuite(int argc, char** argv) : initialized_command_line_(false) {
- PreInitialize(true);
+ PreInitialize();
InitializeFromCommandLine(argc, argv);
}
#if defined(OS_WIN)
TestSuite::TestSuite(int argc, wchar_t** argv)
: initialized_command_line_(false) {
- PreInitialize(true);
+ PreInitialize();
InitializeFromCommandLine(argc, argv);
}
#endif // defined(OS_WIN)
-TestSuite::TestSuite(int argc, char** argv, bool create_at_exit_manager)
- : initialized_command_line_(false) {
- PreInitialize(create_at_exit_manager);
- InitializeFromCommandLine(argc, argv);
-}
-
TestSuite::~TestSuite() {
if (initialized_command_line_)
CommandLine::Reset();
@@ -139,7 +133,7 @@ void TestSuite::InitializeFromCommandLine(int argc, wchar_t** argv) {
}
#endif // defined(OS_WIN)
-void TestSuite::PreInitialize(bool create_at_exit_manager) {
+void TestSuite::PreInitialize() {
#if defined(OS_WIN)
testing::GTEST_FLAG(catch_exceptions) = false;
#endif
@@ -154,8 +148,7 @@ void TestSuite::PreInitialize(bool create_at_exit_manager) {
// On Android, AtExitManager is created in
// testing/android/native_test_wrapper.cc before main() is called.
#if !defined(OS_ANDROID)
- if (create_at_exit_manager)
- at_exit_manager_.reset(new AtExitManager);
+ at_exit_manager_.reset(new AtExitManager);
#endif
// Don't add additional code to this function. Instead add it to
diff --git a/base/test/test_suite.h b/base/test/test_suite.h
index cf0dd3a..e63ef32 100644
--- a/base/test/test_suite.h
+++ b/base/test/test_suite.h
@@ -49,11 +49,6 @@ class TestSuite {
int Run();
protected:
- // This constructor is only accessible to specialized test suite
- // implementations which need to control the creation of an AtExitManager
- // instance for the duration of the test.
- TestSuite(int argc, char** argv, bool create_at_exit_manager);
-
// By default fatal log messages (e.g. from DCHECKs) result in error dialogs
// which gum up buildbots. Use a minimalistic assert handler which just
// terminates the process.
@@ -79,7 +74,7 @@ class TestSuite {
#endif // defined(OS_WIN)
// Basic initialization for the test suite happens here.
- void PreInitialize(bool create_at_exit_manager);
+ void PreInitialize();
test::TraceToFile trace_to_file_;