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

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

Issue 623633002: scoped_refptr: support opaque pointed-to classes via extern template (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix header guard Created 6 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
« no previous file with comments | « base/memory/ref_counted.h ('k') | base/test/BUILD.gn » ('j') | 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/memory/ref_counted.h" 5 #include "base/memory/ref_counted.h"
6
7 #include "base/test/opaque_ref_counted.h"
6 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
7 9
8 namespace { 10 namespace {
9 11
10 class SelfAssign : public base::RefCounted<SelfAssign> { 12 class SelfAssign : public base::RefCounted<SelfAssign> {
11 friend class base::RefCounted<SelfAssign>; 13 friend class base::RefCounted<SelfAssign>;
12 14
13 ~SelfAssign() {} 15 ~SelfAssign() {}
14 }; 16 };
15 17
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 TEST(RefCountedUnitTest, ScopedRefPtrMemberAccess) { 55 TEST(RefCountedUnitTest, ScopedRefPtrMemberAccess) {
54 CheckDerivedMemberAccess check; 56 CheckDerivedMemberAccess check;
55 } 57 }
56 58
57 TEST(RefCountedUnitTest, ScopedRefPtrToSelf) { 59 TEST(RefCountedUnitTest, ScopedRefPtrToSelf) {
58 ScopedRefPtrToSelf* check = new ScopedRefPtrToSelf(); 60 ScopedRefPtrToSelf* check = new ScopedRefPtrToSelf();
59 EXPECT_FALSE(ScopedRefPtrToSelf::was_destroyed()); 61 EXPECT_FALSE(ScopedRefPtrToSelf::was_destroyed());
60 check->SelfDestruct(); 62 check->SelfDestruct();
61 EXPECT_TRUE(ScopedRefPtrToSelf::was_destroyed()); 63 EXPECT_TRUE(ScopedRefPtrToSelf::was_destroyed());
62 } 64 }
65
66 TEST(RefCountedUnitTest, ScopedRefPtrToOpaque) {
67 scoped_refptr<base::OpaqueRefCounted> p = base::MakeOpaqueRefCounted();
68 base::TestOpaqueRefCounted(p);
69
70 scoped_refptr<base::OpaqueRefCounted> q;
71 q = p;
72 base::TestOpaqueRefCounted(p);
73 base::TestOpaqueRefCounted(q);
74 }
OLDNEW
« no previous file with comments | « base/memory/ref_counted.h ('k') | base/test/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698