Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(422)

Unified Diff: webkit/support/webkit_support.cc

Issue 3030018: webkit_support: Move the logger initialization code so that it is... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/support/webkit_support.cc
===================================================================
--- webkit/support/webkit_support.cc (revision 53614)
+++ webkit/support/webkit_support.cc (working copy)
@@ -51,11 +51,54 @@
namespace {
+// All fatal log messages (e.g. DCHECK failures) imply unit test failures
+void UnitTestAssertHandler(const std::string& str) {
+ FAIL() << str;
+}
+
+void InitLogging(bool enable_gp_fault_error_box) {
+ logging::SetLogAssertHandler(UnitTestAssertHandler);
+
+#if defined(OS_WIN)
+ if (!::IsDebuggerPresent()) {
+ UINT new_flags = SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX;
+ if (!enable_gp_fault_error_box)
+ new_flags |= SEM_NOGPFAULTERRORBOX;
+
+ // Preserve existing error mode, as discussed at
+ // http://blogs.msdn.com/oldnewthing/archive/2004/07/27/198410.aspx
+ UINT existing_flags = SetErrorMode(new_flags);
+ SetErrorMode(existing_flags | new_flags);
+ }
+#endif
+
+ FilePath log_filename;
+ PathService::Get(base::DIR_EXE, &log_filename);
+ log_filename = log_filename.AppendASCII("DumpRenderTree.log");
+ logging::InitLogging(
+ log_filename.value().c_str(),
+ // Only log to a file. This prevents debugging output from disrupting
+ // whether or not we pass.
+ logging::LOG_ONLY_TO_FILE,
+ // We might have multiple DumpRenderTree processes going at once.
+ logging::LOCK_LOG_FILE,
+ logging::DELETE_OLD_LOG_FILE);
+
+ // We want process and thread IDs because we may have multiple processes.
+ const bool kProcessId = true;
+ const bool kThreadId = true;
+ const bool kTimestamp = true;
+ const bool kTickcount = true;
+ logging::SetLogItems(kProcessId, kThreadId, !kTimestamp, kTickcount);
+}
+
class TestEnvironment {
public:
explicit TestEnvironment(bool unit_test_mode) {
- if (!unit_test_mode)
+ if (!unit_test_mode) {
at_exit_manager_.reset(new base::AtExitManager);
+ InitLogging(false);
+ }
main_message_loop_.reset(new MessageLoopForUI);
// TestWebKitClient must be instantiated after the MessageLoopForUI.
webkit_client_.reset(new TestWebKitClient(unit_test_mode));
@@ -112,47 +155,6 @@
}
}
-// All fatal log messages (e.g. DCHECK failures) imply unit test failures
-void UnitTestAssertHandler(const std::string& str) {
- FAIL() << str;
-}
-
-void InitLogging(bool enable_gp_fault_error_box) {
- logging::SetLogAssertHandler(UnitTestAssertHandler);
-
-#if defined(OS_WIN)
- if (!::IsDebuggerPresent()) {
- UINT new_flags = SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX;
- if (!enable_gp_fault_error_box)
- new_flags |= SEM_NOGPFAULTERRORBOX;
-
- // Preserve existing error mode, as discussed at
- // http://blogs.msdn.com/oldnewthing/archive/2004/07/27/198410.aspx
- UINT existing_flags = SetErrorMode(new_flags);
- SetErrorMode(existing_flags | new_flags);
- }
-#endif
-
- FilePath log_filename;
- PathService::Get(base::DIR_EXE, &log_filename);
- log_filename = log_filename.AppendASCII("DumpRenderTree.log");
- logging::InitLogging(
- log_filename.value().c_str(),
- // Only log to a file. This prevents debugging output from disrupting
- // whether or not we pass.
- logging::LOG_ONLY_TO_FILE,
- // We might have multiple DumpRenderTree processes going at once.
- logging::LOCK_LOG_FILE,
- logging::DELETE_OLD_LOG_FILE);
-
- // We want process and thread IDs because we may have multiple processes.
- const bool kProcessId = true;
- const bool kThreadId = true;
- const bool kTimestamp = true;
- const bool kTickcount = true;
- logging::SetLogItems(kProcessId, kThreadId, !kTimestamp, kTickcount);
-}
-
} // namespace
namespace webkit_support {
@@ -174,8 +176,6 @@
const char* kFixedArguments[] = {"DumpRenderTree"};
CommandLine::Init(arraysize(kFixedArguments), kFixedArguments);
- InitLogging(false);
-
webkit_support::BeforeInitialize();
webkit_support::test_environment = new TestEnvironment(unit_test_mode);
webkit_support::AfterInitialize();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698