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/memory/ptr_util.h" | 5 #include "base/memory/ptr_util.h" |
6 | 6 |
| 7 #include <stddef.h> |
| 8 |
7 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
8 | 10 |
9 namespace base { | 11 namespace base { |
10 | 12 |
11 namespace { | 13 namespace { |
12 | 14 |
13 class DeleteCounter { | 15 class DeleteCounter { |
14 public: | 16 public: |
15 DeleteCounter() { ++count_; } | 17 DeleteCounter() { ++count_; } |
16 ~DeleteCounter() { --count_; } | 18 ~DeleteCounter() { --count_; } |
(...skipping 12 matching lines...) Expand all Loading... |
29 EXPECT_EQ(0u, DeleteCounter::count()); | 31 EXPECT_EQ(0u, DeleteCounter::count()); |
30 DeleteCounter* counter = new DeleteCounter; | 32 DeleteCounter* counter = new DeleteCounter; |
31 EXPECT_EQ(1u, DeleteCounter::count()); | 33 EXPECT_EQ(1u, DeleteCounter::count()); |
32 std::unique_ptr<DeleteCounter> owned_counter = WrapUnique(counter); | 34 std::unique_ptr<DeleteCounter> owned_counter = WrapUnique(counter); |
33 EXPECT_EQ(1u, DeleteCounter::count()); | 35 EXPECT_EQ(1u, DeleteCounter::count()); |
34 owned_counter.reset(); | 36 owned_counter.reset(); |
35 EXPECT_EQ(0u, DeleteCounter::count()); | 37 EXPECT_EQ(0u, DeleteCounter::count()); |
36 } | 38 } |
37 | 39 |
38 } // namespace base | 40 } // namespace base |
OLD | NEW |