OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/memory/discardable_memory.h" | 5 #include "base/memory/discardable_memory.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 | 10 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 supported_types.end(), | 58 supported_types.end(), |
59 IsNativeType)); | 59 IsNativeType)); |
60 #endif | 60 #endif |
61 } | 61 } |
62 | 62 |
63 // Test Lock() and Unlock() functionalities. | 63 // Test Lock() and Unlock() functionalities. |
64 TEST_P(DiscardableMemoryTest, LockAndUnLock) { | 64 TEST_P(DiscardableMemoryTest, LockAndUnLock) { |
65 const scoped_ptr<DiscardableMemory> memory(CreateLockedMemory(kSize)); | 65 const scoped_ptr<DiscardableMemory> memory(CreateLockedMemory(kSize)); |
66 ASSERT_TRUE(memory); | 66 ASSERT_TRUE(memory); |
67 void* addr = memory->Memory(); | 67 void* addr = memory->Memory(); |
68 ASSERT_NE(static_cast<void*>(NULL), addr); | 68 ASSERT_NE(nullptr, addr); |
69 | 69 |
70 memory->Unlock(); | 70 memory->Unlock(); |
71 | 71 |
72 EXPECT_NE(DISCARDABLE_MEMORY_LOCK_STATUS_FAILED, memory->Lock()); | 72 EXPECT_NE(DISCARDABLE_MEMORY_LOCK_STATUS_FAILED, memory->Lock()); |
73 addr = memory->Memory(); | 73 addr = memory->Memory(); |
74 ASSERT_NE(static_cast<void*>(NULL), addr); | 74 ASSERT_NE(nullptr, addr); |
75 | 75 |
76 memory->Unlock(); | 76 memory->Unlock(); |
77 } | 77 } |
78 | 78 |
79 // Test delete a discardable memory while it is locked. | 79 // Test delete a discardable memory while it is locked. |
80 TEST_P(DiscardableMemoryTest, DeleteWhileLocked) { | 80 TEST_P(DiscardableMemoryTest, DeleteWhileLocked) { |
81 const scoped_ptr<DiscardableMemory> memory(CreateLockedMemory(kSize)); | 81 const scoped_ptr<DiscardableMemory> memory(CreateLockedMemory(kSize)); |
82 ASSERT_TRUE(memory); | 82 ASSERT_TRUE(memory); |
83 } | 83 } |
84 | 84 |
(...skipping 24 matching lines...) Expand all Loading... |
109 return supported_types; | 109 return supported_types; |
110 } | 110 } |
111 | 111 |
112 INSTANTIATE_TEST_CASE_P( | 112 INSTANTIATE_TEST_CASE_P( |
113 DiscardableMemoryTests, | 113 DiscardableMemoryTests, |
114 DiscardableMemoryTest, | 114 DiscardableMemoryTest, |
115 ::testing::ValuesIn(GetSupportedDiscardableMemoryTypes())); | 115 ::testing::ValuesIn(GetSupportedDiscardableMemoryTypes())); |
116 | 116 |
117 } // namespace | 117 } // namespace |
118 } // namespace base | 118 } // namespace base |
OLD | NEW |