OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
7 #include "base/memory/discardable_memory.h" | 7 #include "base/memory/discardable_memory.h" |
8 #include "content/child/child_discardable_shared_memory_manager.h" | 8 #include "content/child/child_discardable_shared_memory_manager.h" |
9 #include "content/child/child_thread_impl.h" | 9 #include "content/child/child_thread_impl.h" |
10 #include "content/common/host_discardable_shared_memory_manager.h" | 10 #include "content/common/host_discardable_shared_memory_manager.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 } | 42 } |
43 | 43 |
44 static void UnlockMemory(base::DiscardableMemory* memory) { | 44 static void UnlockMemory(base::DiscardableMemory* memory) { |
45 memory->Unlock(); | 45 memory->Unlock(); |
46 } | 46 } |
47 | 47 |
48 static void FreeMemory(scoped_ptr<base::DiscardableMemory> memory) {} | 48 static void FreeMemory(scoped_ptr<base::DiscardableMemory> memory) {} |
49 }; | 49 }; |
50 | 50 |
51 IN_PROC_BROWSER_TEST_F(ChildDiscardableSharedMemoryManagerBrowserTest, | 51 IN_PROC_BROWSER_TEST_F(ChildDiscardableSharedMemoryManagerBrowserTest, |
52 DISABLED_LockMemory) { | 52 LockMemory) { |
53 const size_t kSize = 1024 * 1024; // 1MiB. | 53 const size_t kSize = 1024 * 1024; // 1MiB. |
54 | 54 |
55 NavigateToURL(shell(), GURL(url::kAboutBlankURL)); | 55 NavigateToURL(shell(), GURL(url::kAboutBlankURL)); |
56 | 56 |
57 scoped_ptr<base::DiscardableMemory> memory; | 57 scoped_ptr<base::DiscardableMemory> memory; |
58 PostTaskToInProcessRendererAndWait(base::Bind( | 58 PostTaskToInProcessRendererAndWait(base::Bind( |
59 &ChildDiscardableSharedMemoryManagerBrowserTest::AllocateLockedMemory, | 59 &ChildDiscardableSharedMemoryManagerBrowserTest::AllocateLockedMemory, |
60 kSize, &memory)); | 60 kSize, &memory)); |
61 | 61 |
62 ASSERT_TRUE(memory); | 62 ASSERT_TRUE(memory); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 kSize); | 131 kSize); |
132 | 132 |
133 PostTaskToInProcessRendererAndWait(base::Bind( | 133 PostTaskToInProcessRendererAndWait(base::Bind( |
134 &ChildDiscardableSharedMemoryManagerBrowserTest::ReleaseFreeMemory)); | 134 &ChildDiscardableSharedMemoryManagerBrowserTest::ReleaseFreeMemory)); |
135 | 135 |
136 EXPECT_EQ(HostDiscardableSharedMemoryManager::current()->GetBytesAllocated(), | 136 EXPECT_EQ(HostDiscardableSharedMemoryManager::current()->GetBytesAllocated(), |
137 0u); | 137 0u); |
138 } | 138 } |
139 | 139 |
140 } // content | 140 } // content |
OLD | NEW |