Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Side by Side Diff: base/memory/scoped_ptr_unittest.cc

Issue 11149006: Extend scoped_ptr to be closer to unique_ptr. Support custom deleters, and deleting arrays. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: I think this works. Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« base/memory/scoped_ptr.h ('K') | « base/memory/scoped_ptr.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« base/memory/scoped_ptr.h ('K') | « base/memory/scoped_ptr.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698