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

Unified Diff: base/test/test_suite.h

Issue 482001: Force failing CHECK/DCHECKs to end the process on Windows.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years 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 | « base/cancellation_flag_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/test/test_suite.h
===================================================================
--- base/test/test_suite.h (revision 34168)
+++ base/test/test_suite.h (working copy)
@@ -58,7 +58,7 @@
#if defined(OS_LINUX)
g_thread_init(NULL);
gtk_init_check(&argc, &argv);
-#endif
+#endif // defined(OS_LINUX)
// Don't add additional code to this constructor. Instead add it to
// Initialize(). See bug 6436.
}
@@ -146,12 +146,22 @@
}
protected:
- // All fatal log messages (e.g. DCHECK failures) imply unit test failures.
+#if defined(OS_WIN)
+ // TODO(phajdan.jr): Clean up the windows-specific hacks.
+ // See http://crbug.com/29997
+
+ // By default, base::LogMessage::~LogMessage calls DebugUtil::BreakDebugger()
M-A Ruel 2009/12/10 18:49:35 Thanks for the doc.
+ // when severity is LOG_FATAL. On Windows, this results in error dialogs
+ // which are not friendly to buildbots.
+ // To avoid these problems, we override the LogMessage behaviour by
+ // replacing the assert handler with UnitTestAssertHandler.
static void UnitTestAssertHandler(const std::string& str) {
+ // FAIL is a googletest macro, it marks the current test as failed.
+ // If throw_on_failure is set to true, it also ends the process.
+ ::testing::FLAGS_gtest_throw_on_failure = true;
FAIL() << str;
}
-#if defined(OS_WIN)
// Disable crash dialogs so that it doesn't gum up the buildbot
virtual void SuppressErrorDialogs() {
UINT new_flags = SEM_FAILCRITICALERRORS |
@@ -163,7 +173,7 @@
UINT existing_flags = SetErrorMode(new_flags);
SetErrorMode(existing_flags | new_flags);
}
-#endif
+#endif // defined(OS_WIN)
// Override these for custom initialization and shutdown handling. Use these
// instead of putting complex code in your constructor/destructor.
« no previous file with comments | « base/cancellation_flag_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698