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

Unified Diff: base/process_util_unittest.cc

Issue 7670025: [Mac] Implement base::EnableTerminationOnHeapCorruption() by overriding malloc_error_break(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Patch mach_override Created 9 years, 4 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
Index: base/process_util_unittest.cc
diff --git a/base/process_util_unittest.cc b/base/process_util_unittest.cc
index 3b05d03a0661a5e1b62c51bda81c7f513b6fa5b6..8a653d4c04c14540590ec21365c8f18cbecc58dd 100644
--- a/base/process_util_unittest.cc
+++ b/base/process_util_unittest.cc
@@ -397,6 +397,21 @@ TEST_F(ProcessUtilTest, LaunchAsUser) {
#endif // defined(OS_WIN)
+#if defined(OS_MACOSX)
+
+TEST_F(ProcessUtilTest, MacTerminateOnHeapCorruption) {
+ // Note that base::EnableTerminationOnHeapCorruption() is called as part of
+ // test suite setup and does not need to be done again, else mach_override
+ // will fail.
+
+ char buf[3];
+ ASSERT_DEATH(free(buf), "being freed.*"
+ "\\*\\*\\* set a breakpoint in malloc_error_break to debug.*"
+ "Terminating process due to a potential for future heap corruption");
+}
+
+#endif // defined(OS_MACOSX)
+
#if defined(OS_POSIX)
namespace {

Powered by Google App Engine
This is Rietveld 408576698