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

Unified Diff: ios/chrome/test/ocmock/OCMockObject+CrOCMockAdditions.mm

Issue 2580333003: Upstream Chrome on iOS source code [10/11]. (Closed)
Patch Set: 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 side-by-side diff with in-line comments
Download patch
Index: ios/chrome/test/ocmock/OCMockObject+CrOCMockAdditions.mm
diff --git a/ios/chrome/test/ocmock/OCMockObject+CrOCMockAdditions.mm b/ios/chrome/test/ocmock/OCMockObject+CrOCMockAdditions.mm
new file mode 100644
index 0000000000000000000000000000000000000000..5ddea6d63abaf099282fb3aec5ee87113a6843ef
--- /dev/null
+++ b/ios/chrome/test/ocmock/OCMockObject+CrOCMockAdditions.mm
@@ -0,0 +1,39 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#import "ios/chrome/test/ocmock/OCMockObject+CrOCMockAdditions.h"
+
+@implementation OCMockObject (CrOCMockAdditions)
+
+- (BOOL)isStubbed:(SEL)selector {
+ for (OCMockRecorder* recorder in recorders) {
+ NSMethodSignature* signature = [self methodSignatureForSelector:selector];
+ NSInvocation* invocation =
+ [NSInvocation invocationWithMethodSignature:signature];
+ [invocation setSelector:selector];
+ if ([recorder matchesInvocation:invocation]) {
+ return YES;
+ }
+ }
+ return NO;
+}
+
+- (void)removeStub:(SEL)selector {
+ OCMockRecorder* stubRecorder = nil;
+ for (OCMockRecorder* recorder in recorders) {
+ NSMethodSignature* signature = [self methodSignatureForSelector:selector];
+ NSInvocation* invocation =
+ [NSInvocation invocationWithMethodSignature:signature];
+ [invocation setSelector:selector];
+ if ([recorder matchesInvocation:invocation]) {
+ stubRecorder = recorder;
+ break;
+ }
+ }
+ if (stubRecorder) {
+ [recorders removeObject:stubRecorder];
+ }
+}
+
+@end
« no previous file with comments | « ios/chrome/test/ocmock/OCMockObject+CrOCMockAdditions.h ('k') | ios/chrome/test/ocmock/scoped_mock_object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698