Chromium Code Reviews| Index: base/memory/discardable_memory_unittest.cc |
| diff --git a/base/memory/discardable_memory_unittest.cc b/base/memory/discardable_memory_unittest.cc |
| index a111cfcc07916a7237fdd7d0b67d55aef1c4f688..c9d19c29c03d28cf3a95bbfa04d9d75fb62bc7ea 100644 |
| --- a/base/memory/discardable_memory_unittest.cc |
| +++ b/base/memory/discardable_memory_unittest.cc |
| @@ -103,6 +103,22 @@ TEST_P(DiscardableMemoryTest, UnlockedMemoryAccessCrashesInDebugMode) { |
| } |
| #endif |
| +// Test behavior when creating enough instances that could use up a 32-bit |
| +// address space. |
| +TEST_P(DiscardableMemoryTest, AddressSpace) { |
| + const size_t kLargeSize = 4 * 1024 * 1024; // 4MB. |
| + const size_t kNumberOfInstances = 1024 + 1; // >4GiB total. |
|
Avi (use Gerrit)
2014/10/15 21:11:27
Why "4MB" on the line above, and "4GiB" here? Eith
reveman
2014/10/16 20:50:34
Done.
|
| + |
| + scoped_ptr<DiscardableMemory> instances[kNumberOfInstances]; |
| + for (auto& memory : instances) { |
| + memory = CreateLockedMemory(kLargeSize); |
| + ASSERT_TRUE(memory); |
| + void* addr = memory->Memory(); |
| + ASSERT_NE(static_cast<void*>(NULL), addr); |
|
Avi (use Gerrit)
2014/10/15 21:11:27
nullptr, plus you shouldn't need a cast with it.
reveman
2014/10/16 20:50:34
Done.
|
| + memory->Unlock(); |
| + } |
| +} |
| + |
| std::vector<DiscardableMemoryType> GetSupportedDiscardableMemoryTypes() { |
| std::vector<DiscardableMemoryType> supported_types; |
| DiscardableMemory::GetSupportedTypes(&supported_types); |