Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2011 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 #include "third_party/ocmock/ocmock_extensions.h" | |
| 6 | |
| 7 #define CR_OCMOCK_RETURN_IMPL(type_name, type) \ | |
| 8 - (id)andReturn##type_name:(type)value { \ | |
|
TVL
2011/05/20 16:07:05
indent?
| |
| 9 return [self andReturnValue:OCMOCK_VALUE(value)]; \ | |
| 10 } | |
| 11 | |
| 12 @implementation OCMockRecorder(CrExtensions) | |
| 13 CR_OCMOCK_RETURN_IMPL(Pointer, const void*); | |
|
TVL
2011/05/20 16:07:05
blank line?
| |
| 14 CR_OCMOCK_RETURN_IMPL(Char, char); | |
| 15 CR_OCMOCK_RETURN_IMPL(UnsignedChar, unsigned char); | |
| 16 CR_OCMOCK_RETURN_IMPL(Short, short); | |
| 17 CR_OCMOCK_RETURN_IMPL(UnsignedShort, unsigned short); | |
| 18 CR_OCMOCK_RETURN_IMPL(Int, int); | |
| 19 CR_OCMOCK_RETURN_IMPL(UnsignedInt, unsigned int); | |
| 20 CR_OCMOCK_RETURN_IMPL(Long, long); | |
| 21 CR_OCMOCK_RETURN_IMPL(UnsignedLong, unsigned long); | |
| 22 CR_OCMOCK_RETURN_IMPL(LongLong, long long); | |
| 23 CR_OCMOCK_RETURN_IMPL(UnsignedLongLong, unsigned long long); | |
| 24 CR_OCMOCK_RETURN_IMPL(Float, float); | |
| 25 CR_OCMOCK_RETURN_IMPL(Double, double); | |
| 26 CR_OCMOCK_RETURN_IMPL(Bool, BOOL); | |
| 27 CR_OCMOCK_RETURN_IMPL(Integer, NSInteger); | |
| 28 CR_OCMOCK_RETURN_IMPL(UnsignedInteger, NSUInteger); | |
| 29 | |
| 30 - (id)andReturnNSRect:(NSRect)rect { | |
| 31 return [self andReturnValue:[NSValue valueWithRect:rect]]; | |
| 32 } | |
| 33 | |
| 34 - (id)andReturnCGRect:(CGRect)rect { | |
| 35 return [self andReturnNSRect:NSRectFromCGRect(rect)]; | |
| 36 } | |
| 37 | |
| 38 - (id)andReturnNSPoint:(NSPoint)point { | |
| 39 return [self andReturnValue:[NSValue valueWithPoint:point]]; | |
| 40 } | |
| 41 | |
| 42 - (id)andReturnCGPoint:(CGPoint)point { | |
| 43 return [self andReturnNSPoint:NSPointFromCGPoint(point)]; | |
| 44 } | |
| 45 | |
| 46 @end | |
| 47 | |
| 48 @implementation cr_OCMConformToProtocolConstraint | |
| 49 | |
| 50 - (id)initWithProtocol:(Protocol*)protocol { | |
| 51 if (self == [super init]) { | |
| 52 protocol_ = protocol; | |
| 53 } | |
| 54 return self; | |
| 55 } | |
| 56 | |
| 57 - (BOOL)evaluate:(id)value { | |
| 58 return [value conformsToProtocol:protocol_]; | |
|
TVL
2011/05/20 16:07:05
fix indent
| |
| 59 } | |
| 60 | |
| 61 @end | |
| 62 | |
| 63 @implementation OCMArg(CrExtensions) | |
| 64 | |
| 65 + (id)conformsToProtocol:(Protocol*)protocol { | |
| 66 return [[[cr_OCMConformToProtocolConstraint alloc] initWithProtocol:protocol] | |
| 67 autorelease]; | |
| 68 } | |
| 69 | |
| 70 @end | |
| OLD | NEW |