summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authorhbono@chromium.org <hbono@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-19 07:42:00 +0000
committerhbono@chromium.org <hbono@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-19 07:42:00 +0000
commit10a5bfb37bf1044e4d19ab5c7b0161e9d4dd3d3a (patch)
treef568a8253f2f4bb6b0caef73d3cb164626d4b326 /base
parenta0eb491b18a73339e137a4ad5fa5831291058e80 (diff)
downloadchromium_src-10a5bfb37bf1044e4d19ab5c7b0161e9d4dd3d3a.zip
chromium_src-10a5bfb37bf1044e4d19ab5c7b0161e9d4dd3d3a.tar.gz
chromium_src-10a5bfb37bf1044e4d19ab5c7b0161e9d4dd3d3a.tar.bz2
Suppress the "Assertion Failed" dialog of VC++. (Take 2)
This change suppresses assertion-failure dialogs of VC++ and outputs assertion messages to stderr on Windows. This change calls _CrtSetReportMode and _CrtSetReportFile only when it enables exceptions on Debug. (_CrtSetReportFile seems to depend on them.) BUG=132037,133313 TEST=none Review URL: https://chromiumcodereview.appspot.com/10583011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@142924 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r--base/test/test_suite.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/base/test/test_suite.cc b/base/test/test_suite.cc
index 83a2549..fb0070f 100644
--- a/base/test/test_suite.cc
+++ b/base/test/test_suite.cc
@@ -232,6 +232,14 @@ void TestSuite::SuppressErrorDialogs() {
// http://blogs.msdn.com/oldnewthing/archive/2004/07/27/198410.aspx
UINT existing_flags = SetErrorMode(new_flags);
SetErrorMode(existing_flags | new_flags);
+
+#if defined(_DEBUG) && defined(_HAS_EXCEPTIONS) && (_HAS_EXCEPTIONS == 1)
+ // Suppress the "Debug Assertion Failed" dialog.
+ // TODO(hbono): remove this code when gtest has it.
+ // http://groups.google.com/d/topic/googletestframework/OjuwNlXy5ac/discussion
+ _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG);
+ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);
+#endif // defined(_DEBUG) && defined(_HAS_EXCEPTIONS) && (_HAS_EXCEPTIONS == 1)
#endif // defined(OS_WIN)
}