Index: media/base/run_all_unittests.cc |
diff --git a/media/base/run_all_unittests.cc b/media/base/run_all_unittests.cc |
index 4dc422450c8634f3fd164e28bd3dcb172c81d2d4..01616fb6f95fc88940e6c487443ddcc17aecc9e3 100644 |
--- a/media/base/run_all_unittests.cc |
+++ b/media/base/run_all_unittests.cc |
@@ -2,33 +2,25 @@ |
// 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/command_line.h" |
-#include "base/logging.h" |
#include "base/test/test_suite.h" |
#include "media/base/media.h" |
class TestSuiteNoAtExit : public base::TestSuite { |
public: |
- TestSuiteNoAtExit(int argc, char** argv) : TestSuite(argc, argv, false) {} |
+ TestSuiteNoAtExit(int argc, char** argv) : TestSuite(argc, argv) {} |
virtual ~TestSuiteNoAtExit() {} |
+ protected: |
+ virtual void Initialize(); |
}; |
-int main(int argc, char** argv) { |
- // By default command-line parsing happens only in TestSuite::Run(), but |
- // that's too late to get VLOGs and so on from |
- // InitializeMediaLibraryForTesting() below. Instead initialize logging |
- // explicitly here (and have it get re-initialized by TestSuite::Run()). |
- CommandLine::Init(argc, argv); |
- CHECK(logging::InitLogging( |
- NULL, |
- logging::LOG_ONLY_TO_SYSTEM_DEBUG_LOG, |
- logging::DONT_LOCK_LOG_FILE, |
- logging::APPEND_TO_OLD_LOG_FILE, |
- logging::ENABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS)); |
- base::AtExitManager exit_manager; |
- |
+void TestSuiteNoAtExit::Initialize() { |
+ // Run TestSuite::Initialize first so that logging is initialized. |
+ base::TestSuite::Initialize(); |
+ // Run this here instead of main() to ensure an AtExitManager is already |
+ // present. |
media::InitializeMediaLibraryForTesting(); |
+} |
+int main(int argc, char** argv) { |
return TestSuiteNoAtExit(argc, argv).Run(); |
} |