Fix undefined variable when running bisect (path_to_file -> config_file_path).
[chromium-blink-merge.git] / third_party / ocmock / OCMock / OCProtocolMockObject.m
blob19e25e8796801126d4bb61b8dffbd86a168ee73c
1 //---------------------------------------------------------------------------------------
2 //  $Id$
3 //  Copyright (c) 2005-2008 by Mulle Kybernetik. See License file for details.
4 //---------------------------------------------------------------------------------------
6 #import <objc/runtime.h>
7 #import "NSMethodSignature+OCMAdditions.h"
8 #import "OCProtocolMockObject.h"
10 @implementation OCProtocolMockObject
12 #pragma mark  Initialisers, description, accessors, etc.
14 - (id)initWithProtocol:(Protocol *)aProtocol
16         [super init];
17         mockedProtocol = aProtocol;
18         return self;
21 - (NSString *)description
23     const char* name = protocol_getName(mockedProtocol);
24     return [NSString stringWithFormat:@"OCMockObject[%s]", name];
27 #pragma mark  Proxy API
29 - (NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector
31         struct objc_method_description methodDescription = protocol_getMethodDescription(mockedProtocol, aSelector, YES, YES);
32     if(methodDescription.name == NULL) 
33         {
34         methodDescription = protocol_getMethodDescription(mockedProtocol, aSelector, NO, YES);
35     }
36     if(methodDescription.name == NULL) 
37         {
38         return nil;
39     }
40         return [NSMethodSignature signatureWithObjCTypes:methodDescription.types];
43 - (BOOL)conformsToProtocol:(Protocol *)aProtocol
45     return protocol_conformsToProtocol(mockedProtocol, aProtocol);
48 - (BOOL)respondsToSelector:(SEL)selector
50     return ([self methodSignatureForSelector:selector] != nil);
53 @end