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

Side by Side Diff: base/ref_counted_unittest.cc

Issue 17464: Changing access to scoped_refptr member variables from private to protected.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 11 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
« no previous file with comments | « base/ref_counted.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) 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 "testing/gtest/include/gtest/gtest.h" 5 #include "testing/gtest/include/gtest/gtest.h"
6 #include "base/ref_counted.h" 6 #include "base/ref_counted.h"
7 7
8 namespace {
9
8 class SelfAssign : public base::RefCounted<SelfAssign> { 10 class SelfAssign : public base::RefCounted<SelfAssign> {
9 }; 11 };
10 12
13 class CheckDerivedMemberAccess : public scoped_refptr<SelfAssign> {
14 public:
15 CheckDerivedMemberAccess() {
16 // This shouldn't compile if we don't have access to the member variable.
17 SelfAssign** pptr = &ptr_;
18 EXPECT_EQ(*pptr, ptr_);
19 }
20 };
21
22 } // end namespace
23
11 TEST(RefCountedUnitTest, TestSelfAssignment) { 24 TEST(RefCountedUnitTest, TestSelfAssignment) {
12 SelfAssign* p = new SelfAssign; 25 SelfAssign* p = new SelfAssign;
13 scoped_refptr<SelfAssign> var = p; 26 scoped_refptr<SelfAssign> var = p;
14 var = var; 27 var = var;
15 EXPECT_EQ(var.get(), p); 28 EXPECT_EQ(var.get(), p);
16 } 29 }
17 30
31 TEST(RefCountedUnitTest, ScopedRefPtrMemberAccess) {
32 CheckDerivedMemberAccess check;
33 }
OLDNEW
« no previous file with comments | « base/ref_counted.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698