OLD | NEW |
1 // Copyright 2016 PDFium Authors. All rights reserved. | 1 // Copyright 2016 PDFium 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 "core/fxcrt/include/cfx_weak_ptr.h" | 5 #include "core/fxcrt/cfx_weak_ptr.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "core/fxcrt/include/fx_memory.h" | 10 #include "core/fxcrt/fx_memory.h" |
11 #include "testing/fx_string_testhelpers.h" | 11 #include "testing/fx_string_testhelpers.h" |
12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
13 | 13 |
14 namespace { | 14 namespace { |
15 | 15 |
16 class PseudoDeletable; | 16 class PseudoDeletable; |
17 using WeakPtr = CFX_WeakPtr<PseudoDeletable, ReleaseDeleter<PseudoDeletable>>; | 17 using WeakPtr = CFX_WeakPtr<PseudoDeletable, ReleaseDeleter<PseudoDeletable>>; |
18 using UniquePtr = | 18 using UniquePtr = |
19 std::unique_ptr<PseudoDeletable, ReleaseDeleter<PseudoDeletable>>; | 19 std::unique_ptr<PseudoDeletable, ReleaseDeleter<PseudoDeletable>>; |
20 | 20 |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 WeakPtr ptr2(std::move(unique2)); | 165 WeakPtr ptr2(std::move(unique2)); |
166 ptr1->SetNext(ptr2); | 166 ptr1->SetNext(ptr2); |
167 ptr2->SetNext(ptr1); | 167 ptr2->SetNext(ptr1); |
168 ptr1.Clear(); | 168 ptr1.Clear(); |
169 EXPECT_EQ(1, thing1.delete_count()); | 169 EXPECT_EQ(1, thing1.delete_count()); |
170 EXPECT_EQ(0, thing2.delete_count()); | 170 EXPECT_EQ(0, thing2.delete_count()); |
171 } | 171 } |
172 EXPECT_EQ(1, thing1.delete_count()); | 172 EXPECT_EQ(1, thing1.delete_count()); |
173 EXPECT_EQ(1, thing2.delete_count()); | 173 EXPECT_EQ(1, thing2.delete_count()); |
174 } | 174 } |
OLD | NEW |