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

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

Issue 2522943003: [iOS/ARC] Fix a violation of ODR in base::BindBlock under ARC. (Closed)
Patch Set: Use EXPECT_NSEQ instead of EXPECT_EQ/EXPECT_TRUE. Created 4 years 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
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 #import <CoreFoundation/CoreFoundation.h> 7 #import <CoreFoundation/CoreFoundation.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #import "base/mac/scoped_nsobject.h" 10 #import "base/mac/scoped_nsobject.h"
11 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
12 12
13 #if !defined(__has_feature) || !__has_feature(objc_arc) 13 #if !defined(__has_feature) || !__has_feature(objc_arc)
14 #error "This file requires ARC support." 14 #error "This file requires ARC support."
15 #endif 15 #endif
16 16
17 // This free-function is there to ensure that the object file in not discarded
18 // at link time when building with gyp (it is required because targets is built
19 // as a static library with gyp and not source set which cause the object file
20 // to be discarded if no symbol is used). Remove once gyp support is dropped.
21 void ScopedNSObjectUnittestArcLinkerWorkaround() {}
22
23 namespace { 17 namespace {
24 18
25 template <typename NST> 19 template <typename NST>
26 CFIndex GetRetainCount(const base::scoped_nsobject<NST>& nst) { 20 CFIndex GetRetainCount(const base::scoped_nsobject<NST>& nst) {
27 @autoreleasepool { 21 @autoreleasepool {
28 return CFGetRetainCount((__bridge CFTypeRef)nst.get()) - 1; 22 return CFGetRetainCount((__bridge CFTypeRef)nst.get()) - 1;
29 } 23 }
30 } 24 }
31 25
32 #if __has_feature(objc_arc_weak) 26 #if __has_feature(objc_arc_weak)
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 base::scoped_nsobject<id> p2([[NSObject alloc] init]); 122 base::scoped_nsobject<id> p2([[NSObject alloc] init]);
129 EXPECT_TRUE(o1 != p2); 123 EXPECT_TRUE(o1 != p2);
130 EXPECT_FALSE(o1 == p2); 124 EXPECT_FALSE(o1 == p2);
131 id o2 = p2.get(); 125 id o2 = p2.get();
132 swap(p1, p2); 126 swap(p1, p2);
133 EXPECT_EQ(o2, p1.get()); 127 EXPECT_EQ(o2, p1.get());
134 EXPECT_EQ(o1, p2.get()); 128 EXPECT_EQ(o1, p2.get());
135 } 129 }
136 130
137 } // namespace 131 } // namespace
OLDNEW
« no previous file with comments | « base/mac/scoped_nsobject_unittest.mm ('k') | ios/chrome/browser/browser_state/off_the_record_chrome_browser_state_io_data.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698