| Index: base/memory/discardable_memory_unittest.cc
|
| diff --git a/base/memory/discardable_memory_unittest.cc b/base/memory/discardable_memory_unittest.cc
|
| index eb730f19f18e8482fde972598c99378f2c30447a..c9f67b2556f17a24a1e7f65d9533403106e6c94e 100644
|
| --- a/base/memory/discardable_memory_unittest.cc
|
| +++ b/base/memory/discardable_memory_unittest.cc
|
| @@ -3,12 +3,29 @@
|
| // found in the LICENSE file.
|
|
|
| #include "base/memory/discardable_memory.h"
|
| +
|
| +#include <limits>
|
| +
|
| #include "testing/gtest/include/gtest/gtest.h"
|
|
|
| namespace base {
|
|
|
| const size_t kSize = 1024;
|
|
|
| +#if defined(OS_ANDROID)
|
| +TEST(DiscardableMemoryTest, TooLargeAllocationFails) {
|
| + const size_t kPageSize = 4096;
|
| + const size_t max_allowed_allocation_size =
|
| + std::numeric_limits<size_t>::max() - kPageSize + 1;
|
| + scoped_ptr<DiscardableMemory> memory(
|
| + DiscardableMemory::CreateLockedMemory(max_allowed_allocation_size + 1));
|
| + // On certain platforms (e.g. Android), page-alignment would have caused an
|
| + // overflow resulting in a small allocation if the input size wasn't checked
|
| + // correctly.
|
| + ASSERT_FALSE(memory);
|
| +}
|
| +#endif
|
| +
|
| TEST(DiscardableMemoryTest, SupportedNatively) {
|
| #if defined(DISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY)
|
| ASSERT_TRUE(DiscardableMemory::SupportedNatively());
|
|
|