Index: base/process/memory_unittest.cc |
diff --git a/base/process/memory_unittest.cc b/base/process/memory_unittest.cc |
index c4728c52371263dd6f731998761959c08407eda7..853acc9fef5269d97f2968be1bddcfbac7bec3fd 100644 |
--- a/base/process/memory_unittest.cc |
+++ b/base/process/memory_unittest.cc |
@@ -10,8 +10,10 @@ |
#include <limits> |
+#include "base/allocator/allocator_check.h" |
#include "base/compiler_specific.h" |
#include "base/debug/alias.h" |
+#include "base/memory/aligned_memory.h" |
#include "base/strings/stringprintf.h" |
#include "build/build_config.h" |
#include "testing/gtest/include/gtest/gtest.h" |
@@ -139,6 +141,10 @@ TEST(ProcessMemoryTest, MacTerminateOnHeapCorruption) { |
#endif // defined(OS_MACOSX) |
+TEST(MemoryTest, AllocatorShimWorking) { |
+ ASSERT_TRUE(base::allocator::IsAllocatorInitialized()); |
+} |
+ |
// Android doesn't implement set_new_handler, so we can't use the |
// OutOfMemoryTest cases. OpenBSD does not support these tests either. |
// Don't test these on ASan/TSan/MSan configurations: only test the real |
@@ -219,6 +225,13 @@ TEST_F(OutOfMemoryDeathTest, Calloc) { |
}, kOomRegex); |
} |
+TEST_F(OutOfMemoryDeathTest, AlignedMem) { |
+ ASSERT_DEATH({ |
+ SetUpInDeathAssert(); |
+ value_ = base::AlignedAlloc(test_size_, 8); |
+ }, kOomRegex); |
+} |
+ |
// OS X has no 2Gb allocation limit. |
// See https://crbug.com/169327. |
#if !defined(OS_MACOSX) |
@@ -256,6 +269,14 @@ TEST_F(OutOfMemoryDeathTest, SecurityCalloc) { |
value_ = calloc(1024, insecure_test_size_ / 1024L); |
}, kOomRegex); |
} |
+ |
+TEST_F(OutOfMemoryDeathTest, SecurityAlignedMem) { |
+ ASSERT_DEATH({ |
+ SetUpInDeathAssert(); |
+ value_ = base::AlignedAlloc(insecure_test_size_, 8); |
+ }, kOomRegex); |
+} |
+ |
#endif // !defined(OS_MACOSX) |
#if defined(OS_LINUX) |