Chromium Code Reviews| Index: base/process/memory_unittest.cc |
| diff --git a/base/process/memory_unittest.cc b/base/process/memory_unittest.cc |
| index ce28225d3f5bc709a524e517e9990eb4efd8156d..5d72cefaf28c091e6c32334584925906c60197e8 100644 |
| --- a/base/process/memory_unittest.cc |
| +++ b/base/process/memory_unittest.cc |
| @@ -27,6 +27,7 @@ |
| #endif |
| #if defined(OS_MACOSX) |
| #include <malloc/malloc.h> |
| +#include "base/allocator/allocator_shim.h" |
| #include "base/process/memory_unittest_mac.h" |
| #endif |
| #if defined(OS_LINUX) |
| @@ -59,6 +60,9 @@ typedef BOOL (WINAPI* HeapQueryFn) \ |
| // will fail. |
| TEST(ProcessMemoryTest, MacTerminateOnHeapCorruption) { |
| +#if BUILDFLAG(USE_EXPERIMENTAL_ALLOCATOR_SHIM) |
| + base::allocator::InitializeAllocatorShim(); |
| +#endif |
| // Assert that freeing an unallocated pointer will crash the process. |
| char buf[9]; |
| asm("" : "=r" (buf)); // Prevent clang from being too smart. |
| @@ -79,6 +83,9 @@ TEST(ProcessMemoryTest, MacTerminateOnHeapCorruption) { |
| #endif // defined(OS_MACOSX) |
| TEST(MemoryTest, AllocatorShimWorking) { |
| +#if defined(OS_MACOSX) && BUILDFLAG(USE_EXPERIMENTAL_ALLOCATOR_SHIM) |
| + base::allocator::InitializeAllocatorShim(); |
| +#endif |
| ASSERT_TRUE(base::allocator::IsAllocatorInitialized()); |
| } |
| @@ -114,6 +121,12 @@ class OutOfMemoryTest : public testing::Test { |
| signed_test_size_(std::numeric_limits<ssize_t>::max()) { |
| } |
| + static void SetUpTestCase() { |
| +#if defined(OS_MACOSX) && BUILDFLAG(USE_EXPERIMENTAL_ALLOCATOR_SHIM) |
|
Primiano Tucci (use gerrit)
2017/02/07 11:58:08
I think you just need to move these 3 lines (#if..
erikchen
2017/02/09 23:49:04
Done.
|
| + base::allocator::InitializeAllocatorShim(); |
| +#endif |
| + } |
| + |
| protected: |
| void* value_; |
| size_t test_size_; |