diff options
author | erikkay@google.com <erikkay@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-13 22:35:10 +0000 |
---|---|---|
committer | erikkay@google.com <erikkay@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-13 22:35:10 +0000 |
commit | 302831b6e4e9d8a700ecbea7616f1879898bbfb9 (patch) | |
tree | 1325149eae7db9f1a302801d275ae9761b1aebf1 /base/test_suite.h | |
parent | d3f6b195024afbf311e9eff816ebe17d853d9ab8 (diff) | |
download | chromium_src-302831b6e4e9d8a700ecbea7616f1879898bbfb9.zip chromium_src-302831b6e4e9d8a700ecbea7616f1879898bbfb9.tar.gz chromium_src-302831b6e4e9d8a700ecbea7616f1879898bbfb9.tar.bz2 |
Call logging::InitLogging. The lack of this was causing some hangs (and possibly crashes) in ObserverListTest.BUG=6286
This CL has expanded to include some cleanup and refactoring of test_suite and related files, so that this logging change (and other improvements) are applied to all unit tests.
Review URL: http://codereview.chromium.org/18003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@7977 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/test_suite.h')
-rw-r--r-- | base/test_suite.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/base/test_suite.h b/base/test_suite.h index 1c0a785..a9f05b2 100644 --- a/base/test_suite.h +++ b/base/test_suite.h @@ -10,11 +10,14 @@ // any gtest based tests that are linked into your executable. #include "base/at_exit.h" +#include "base/base_paths.h" #include "base/command_line.h" #include "base/debug_on_start.h" +#include "base/file_path.h" #include "base/icu_util.h" #include "base/logging.h" #include "base/multiprocess_test.h" +#include "base/scoped_nsautorelease_pool.h" #include "testing/gtest/include/gtest/gtest.h" #include "testing/multiprocess_func_list.h" @@ -27,16 +30,31 @@ class TestSuite { public: TestSuite(int argc, char** argv) { + base::ScopedNSAutoreleasePool scoped_pool; + + base::EnableTerminationOnHeapCorruption(); CommandLine::SetArgcArgv(argc, argv); testing::InitGoogleTest(&argc, argv); #if defined(OS_LINUX) gtk_init_check(&argc, &argv); #endif + + FilePath exe; + PathService::Get(base::FILE_EXE, &exe); + FilePath log_filename = exe.ReplaceExtension(FILE_PATH_LITERAL("log")); + logging::InitLogging(log_filename.value().c_str(), + logging::LOG_TO_BOTH_FILE_AND_SYSTEM_DEBUG_LOG, + logging::LOCK_LOG_FILE, + logging::DELETE_OLD_LOG_FILE); + // we want process and thread IDs because we may have multiple processes + logging::SetLogItems(true, true, false, true); } virtual ~TestSuite() {} int Run() { + base::ScopedNSAutoreleasePool scoped_pool; + Initialize(); std::wstring client_func = CommandLine().GetSwitchValue(kRunClientProcess); // Check to see if we are being run as a client process. |