| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/basictypes.h" | 5 #include "base/basictypes.h" |
| 6 #include "base/scoped_ptr.h" | 6 #include "base/memory/scoped_ptr.h" |
| 7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
| 8 | 8 |
| 9 namespace { | 9 namespace { |
| 10 | 10 |
| 11 class ConDecLogger { | 11 class ConDecLogger { |
| 12 public: | 12 public: |
| 13 ConDecLogger() : ptr_(NULL) { } | 13 ConDecLogger() : ptr_(NULL) { } |
| 14 explicit ConDecLogger(int* ptr) { set_ptr(ptr); } | 14 explicit ConDecLogger(int* ptr) { set_ptr(ptr); } |
| 15 ~ConDecLogger() { --*ptr_; } | 15 ~ConDecLogger() { --*ptr_; } |
| 16 | 16 |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 scoper2.swap(scoper1); | 160 scoper2.swap(scoper1); |
| 161 EXPECT_EQ(loggers, scoper2.get()); | 161 EXPECT_EQ(loggers, scoper2.get()); |
| 162 EXPECT_FALSE(scoper1.get()); | 162 EXPECT_FALSE(scoper1.get()); |
| 163 EXPECT_FALSE(scoper1 == scoper2.get()); | 163 EXPECT_FALSE(scoper1 == scoper2.get()); |
| 164 EXPECT_TRUE(scoper1 != scoper2.get()); | 164 EXPECT_TRUE(scoper1 != scoper2.get()); |
| 165 } | 165 } |
| 166 EXPECT_EQ(0, constructed); | 166 EXPECT_EQ(0, constructed); |
| 167 } | 167 } |
| 168 | 168 |
| 169 // TODO scoped_ptr_malloc | 169 // TODO scoped_ptr_malloc |
| OLD | NEW |