Index: components/html_viewer/discardable_memory_allocator_unittest.cc |
diff --git a/components/html_viewer/discardable_memory_allocator_unittest.cc b/components/html_viewer/discardable_memory_allocator_unittest.cc |
index 95cea2950bafdd45c08303f83e6da6c295f46487..cc73fb0cbbfb115d8cde3b543767967ffd9a24c5 100644 |
--- a/components/html_viewer/discardable_memory_allocator_unittest.cc |
+++ b/components/html_viewer/discardable_memory_allocator_unittest.cc |
@@ -15,16 +15,23 @@ |
const size_t kOneMegabyte = 1024 * kOneKilobyte; |
TEST(DiscardableMemoryAllocator, Basic) { |
- DiscardableMemoryAllocator allocator(kOneMegabyte); |
scoped_ptr<base::DiscardableMemory> chunk; |
- // Make sure the chunk is locked when allocated. In debug mode, we will |
- // dcheck. |
- chunk = allocator.AllocateLockedDiscardableMemory(kOneKilobyte); |
- chunk->Unlock(); |
- // Make sure we can lock a chunk. |
- EXPECT_TRUE(chunk->Lock()); |
- chunk->Unlock(); |
+ { |
+ DiscardableMemoryAllocator allocator(kOneMegabyte); |
+ |
+ // Make sure the chunk is locked when allocated. In debug mode, we will |
+ // dcheck. |
+ chunk = allocator.AllocateLockedDiscardableMemory(kOneKilobyte); |
+ chunk->Unlock(); |
+ |
+ // Make sure we can lock a chunk. |
+ EXPECT_TRUE(chunk->Lock()); |
+ chunk->Unlock(); |
+ } |
+ |
+ // The chunk's backing should have disappeared with the allocator. |
+ EXPECT_FALSE(chunk->Lock()); |
} |
TEST(DiscardableMemoryAllocator, DiscardChunks) { |