OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/memory/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 |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 } | 341 } |
342 | 342 |
343 TEST(ScopedPtrTest, PassAs) { | 343 TEST(ScopedPtrTest, PassAs) { |
344 int constructed = 0; | 344 int constructed = 0; |
345 { | 345 { |
346 scoped_ptr<ConDecLogger> scoper(new ConDecLogger(&constructed)); | 346 scoped_ptr<ConDecLogger> scoper(new ConDecLogger(&constructed)); |
347 EXPECT_EQ(1, constructed); | 347 EXPECT_EQ(1, constructed); |
348 EXPECT_TRUE(scoper.get()); | 348 EXPECT_TRUE(scoper.get()); |
349 | 349 |
350 scoped_ptr<ConDecLoggerParent> scoper_parent; | 350 scoped_ptr<ConDecLoggerParent> scoper_parent; |
351 scoper_parent = UpcastUsingPassAs(scoper.Pass()); | 351 // scoper_parent = UpcastUsingPassAs(scoper.Pass()); |
352 EXPECT_EQ(1, constructed); | 352 EXPECT_EQ(1, constructed); |
353 EXPECT_TRUE(scoper_parent.get()); | 353 EXPECT_TRUE(scoper_parent.get()); |
354 EXPECT_FALSE(scoper.get()); | 354 EXPECT_FALSE(scoper.get()); |
355 } | 355 } |
356 EXPECT_EQ(0, constructed); | 356 EXPECT_EQ(0, constructed); |
357 } | 357 } |
358 | 358 |
359 // TODO scoped_ptr_malloc | 359 // TODO scoped_ptr_malloc |
OLD | NEW |