OLD | NEW |
(Empty) | |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #import "ios/chrome/test/ocmock/OCMockObject+CrOCMockAdditions.h" |
| 6 |
| 7 @implementation OCMockObject (CrOCMockAdditions) |
| 8 |
| 9 - (BOOL)isStubbed:(SEL)selector { |
| 10 for (OCMockRecorder* recorder in recorders) { |
| 11 NSMethodSignature* signature = [self methodSignatureForSelector:selector]; |
| 12 NSInvocation* invocation = |
| 13 [NSInvocation invocationWithMethodSignature:signature]; |
| 14 [invocation setSelector:selector]; |
| 15 if ([recorder matchesInvocation:invocation]) { |
| 16 return YES; |
| 17 } |
| 18 } |
| 19 return NO; |
| 20 } |
| 21 |
| 22 - (void)removeStub:(SEL)selector { |
| 23 OCMockRecorder* stubRecorder = nil; |
| 24 for (OCMockRecorder* recorder in recorders) { |
| 25 NSMethodSignature* signature = [self methodSignatureForSelector:selector]; |
| 26 NSInvocation* invocation = |
| 27 [NSInvocation invocationWithMethodSignature:signature]; |
| 28 [invocation setSelector:selector]; |
| 29 if ([recorder matchesInvocation:invocation]) { |
| 30 stubRecorder = recorder; |
| 31 break; |
| 32 } |
| 33 } |
| 34 if (stubRecorder) { |
| 35 [recorders removeObject:stubRecorder]; |
| 36 } |
| 37 } |
| 38 |
| 39 @end |
OLD | NEW |