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 " |