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

Unified Diff: base/process_util_unittest.cc

Issue 13529020: MacTerminateOnHeapCorruption shouldn't leak the OOM killer into the shared test context. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: formatting Created 7 years, 8 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: base/process_util_unittest.cc
diff --git a/base/process_util_unittest.cc b/base/process_util_unittest.cc
index ef383b6175a04614e4572599fb3b61d304c87e7b..f5e0df02a831602f46e0e2da6eb90000158a6f1b 100644
--- a/base/process_util_unittest.cc
+++ b/base/process_util_unittest.cc
@@ -543,9 +543,6 @@ TEST_F(ProcessUtilTest, LaunchAsUser) {
// The following code tests the system implementation of malloc() thus no need
// to test it under AddressSanitizer.
TEST_F(ProcessUtilTest, MacMallocFailureDoesNotTerminate) {
- // Install the OOM killer.
- base::EnableTerminationOnOutOfMemory();
-
// Test that ENOMEM doesn't crash via CrMallocErrorBreak two ways: the exit
// code and lack of the error string. The number of bytes is one less than
// MALLOC_ABSOLUTE_MAX_SIZE, more than which the system early-returns NULL and
@@ -553,7 +550,11 @@ TEST_F(ProcessUtilTest, MacMallocFailureDoesNotTerminate) {
// EnableTerminationOnOutOfMemory() for more information.
void* buf = NULL;
ASSERT_EXIT(
- buf = malloc(std::numeric_limits<size_t>::max() - (2 * PAGE_SIZE) - 1),
+ {
+ base::EnableTerminationOnOutOfMemory();
+
+ buf = malloc(std::numeric_limits<size_t>::max() - (2 * PAGE_SIZE) - 1);
+ },
testing::KilledBySignal(SIGTRAP),
"\\*\\*\\* error: can't allocate region.*"
"(Terminating process due to a potential for future heap "
« 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