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

Side by Side Diff: base/mac/scoped_nsobject_unittest.mm

Issue 1563463002: Add a comment for the #if-0 block in scoped_nsobject_unittest.mm. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
« no previous file with comments | « no previous file | 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 <vector> 5 #include <vector>
6 6
7 #include "base/mac/scoped_nsautorelease_pool.h" 7 #include "base/mac/scoped_nsautorelease_pool.h"
8 #include "base/mac/scoped_nsobject.h" 8 #include "base/mac/scoped_nsobject.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 ASSERT_EQ(3u, [p6 retainCount]); 45 ASSERT_EQ(3u, [p6 retainCount]);
46 { 46 {
47 base::mac::ScopedNSAutoreleasePool pool; 47 base::mac::ScopedNSAutoreleasePool pool;
48 p6.autorelease(); 48 p6.autorelease();
49 ASSERT_EQ(nil, p6.get()); 49 ASSERT_EQ(nil, p6.get());
50 ASSERT_EQ(3u, [p1 retainCount]); 50 ASSERT_EQ(3u, [p1 retainCount]);
51 } 51 }
52 ASSERT_EQ(2u, [p1 retainCount]); 52 ASSERT_EQ(2u, [p1 retainCount]);
53 } 53 }
54 54
55 // Instantiating scoped_nsobject<> with T=NSAutoreleasePool should trip a
56 // static_assert.
55 #if 0 57 #if 0
56 TEST(ScopedNSObjectTest, FailToCreateScopedNSObjectAutoreleasePool) { 58 TEST(ScopedNSObjectTest, FailToCreateScopedNSObjectAutoreleasePool) {
57 base::scoped_nsobject<NSAutoreleasePool> pool; 59 base::scoped_nsobject<NSAutoreleasePool> pool;
58 } 60 }
59 #endif 61 #endif
60 62
61 TEST(ScopedNSObjectTest, ScopedNSObjectInContainer) { 63 TEST(ScopedNSObjectTest, ScopedNSObjectInContainer) {
62 base::scoped_nsobject<id> p([[NSObject alloc] init]); 64 base::scoped_nsobject<id> p([[NSObject alloc] init]);
63 ASSERT_TRUE(p.get()); 65 ASSERT_TRUE(p.get());
64 ASSERT_EQ(1u, [p retainCount]); 66 ASSERT_EQ(1u, [p retainCount]);
(...skipping 17 matching lines...) Expand all
82 base::scoped_nsobject<id> p2([[NSObject alloc] init]); 84 base::scoped_nsobject<id> p2([[NSObject alloc] init]);
83 ASSERT_TRUE(o1 != p2); 85 ASSERT_TRUE(o1 != p2);
84 ASSERT_FALSE(o1 == p2); 86 ASSERT_FALSE(o1 == p2);
85 id o2 = p2.get(); 87 id o2 = p2.get();
86 swap(p1, p2); 88 swap(p1, p2);
87 ASSERT_EQ(o2, p1.get()); 89 ASSERT_EQ(o2, p1.get());
88 ASSERT_EQ(o1, p2.get()); 90 ASSERT_EQ(o1, p2.get());
89 } 91 }
90 92
91 } // namespace 93 } // namespace
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698