[Session restore] Rename group name Enabled to Restore.
[chromium-blink-merge.git] / third_party / ocmock / OCMock / OCMReturnValueProvider.m
blobd98b59c9956b19d5aa1bfc279e0d7ae30ded125d
1 //---------------------------------------------------------------------------------------
2 //  $Id$
3 //  Copyright (c) 2009 by Mulle Kybernetik. See License file for details.
4 //---------------------------------------------------------------------------------------
6 #import "NSMethodSignature+OCMAdditions.h"
7 #import "OCMReturnValueProvider.h"
10 @implementation OCMReturnValueProvider
12 - (id)initWithValue:(id)aValue
14         self = [super init];
15         returnValue = [aValue retain];
16         return self;
19 - (void)dealloc
21         [returnValue release];
22         [super dealloc];
25 - (void)handleInvocation:(NSInvocation *)anInvocation
27         const char *returnType = [[anInvocation methodSignature] methodReturnTypeWithoutQualifiers];
28         if(strcmp(returnType, @encode(id)) != 0)
29                 @throw [NSException exceptionWithName:NSInvalidArgumentException reason:@"Expected invocation with object return type. Did you mean to use andReturnValue: instead?" userInfo:nil];
30         [anInvocation setReturnValue:&returnValue];     
33 @end