OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #import "base/ios/crb_protocol_observers.h" | 5 #import "base/ios/crb_protocol_observers.h" |
6 #include "base/ios/weak_nsobject.h" | 6 #include "base/ios/weak_nsobject.h" |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/mac/scoped_nsautorelease_pool.h" | 8 #include "base/mac/scoped_nsautorelease_pool.h" |
9 #include "base/mac/scoped_nsobject.h" | 9 #include "base/mac/scoped_nsobject.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 } | 248 } |
249 | 249 |
250 - (void)reset { | 250 - (void)reset { |
251 [super reset]; | 251 [super reset]; |
252 _optionalMethodInvoked = NO; | 252 _optionalMethodInvoked = NO; |
253 } | 253 } |
254 | 254 |
255 @end | 255 @end |
256 | 256 |
257 @implementation TestMutateObserver { | 257 @implementation TestMutateObserver { |
258 __weak id _observers; | 258 id _observers; // weak |
259 } | 259 } |
260 | 260 |
261 - (instancetype)initWithObserver:(CRBProtocolObservers*)observers { | 261 - (instancetype)initWithObserver:(CRBProtocolObservers*)observers { |
262 self = [super init]; | 262 self = [super init]; |
263 if (self) { | 263 if (self) { |
264 _observers = observers; | 264 _observers = observers; |
265 } | 265 } |
266 return self; | 266 return self; |
267 } | 267 } |
268 | 268 |
(...skipping 12 matching lines...) Expand all Loading... |
281 | 281 |
282 - (void)nestedMutateByAddingObserver:(id<TestObserver>)observer { | 282 - (void)nestedMutateByAddingObserver:(id<TestObserver>)observer { |
283 [_observers mutateByAddingObserver:observer]; | 283 [_observers mutateByAddingObserver:observer]; |
284 } | 284 } |
285 | 285 |
286 - (void)nestedMutateByRemovingObserver:(id<TestObserver>)observer { | 286 - (void)nestedMutateByRemovingObserver:(id<TestObserver>)observer { |
287 [_observers mutateByRemovingObserver:observer]; | 287 [_observers mutateByRemovingObserver:observer]; |
288 } | 288 } |
289 | 289 |
290 @end | 290 @end |
OLD | NEW |