| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/common/discardable_shared_memory_heap.h" | 5 #include "components/discardable_memory/common/discardable_shared_memory_heap.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/memory/discardable_shared_memory.h" | 11 #include "base/memory/discardable_shared_memory.h" |
| 12 #include "base/process/process_metrics.h" | 12 #include "base/process/process_metrics.h" |
| 13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
| 14 | 14 |
| 15 namespace content { | 15 namespace discardable_memory { |
| 16 namespace { | 16 namespace { |
| 17 | 17 |
| 18 void NullTask() { | 18 void NullTask() {} |
| 19 } | |
| 20 | 19 |
| 21 TEST(DiscardableSharedMemoryHeapTest, Basic) { | 20 TEST(DiscardableSharedMemoryHeapTest, Basic) { |
| 22 size_t block_size = base::GetPageSize(); | 21 size_t block_size = base::GetPageSize(); |
| 23 DiscardableSharedMemoryHeap heap(block_size); | 22 DiscardableSharedMemoryHeap heap(block_size); |
| 24 | 23 |
| 25 // Initial size should be 0. | 24 // Initial size should be 0. |
| 26 EXPECT_EQ(0u, heap.GetSize()); | 25 EXPECT_EQ(0u, heap.GetSize()); |
| 27 | 26 |
| 28 // Initial size of free lists should be 0. | 27 // Initial size of free lists should be 0. |
| 29 EXPECT_EQ(0u, heap.GetSizeOfFreeLists()); | 28 EXPECT_EQ(0u, heap.GetSizeOfFreeLists()); |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 EXPECT_TRUE(rv); | 329 EXPECT_TRUE(rv); |
| 331 heap.ReleasePurgedMemory(); | 330 heap.ReleasePurgedMemory(); |
| 332 | 331 |
| 333 // Check that allocator dump is created after memory is purged. | 332 // Check that allocator dump is created after memory is purged. |
| 334 EXPECT_TRUE(heap.CreateMemoryAllocatorDump(span.get(), "discardable/test2", | 333 EXPECT_TRUE(heap.CreateMemoryAllocatorDump(span.get(), "discardable/test2", |
| 335 pmd.get())); | 334 pmd.get())); |
| 336 } | 335 } |
| 337 | 336 |
| 338 } // namespace | 337 } // namespace |
| 339 } // namespace content | 338 } // namespace content |
| OLD | NEW |