ocmock_extensions.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. #ifndef THIRD_PARTY_OCMOCK_OCMOCK_EXTENSIONS_H_
  5. #define THIRD_PARTY_OCMOCK_OCMOCK_EXTENSIONS_H_
  6. #import <Foundation/Foundation.h>
  7. #import "third_party/ocmock/OCMock/OCMock.h"
  8. // Some enhancements to OCMock to make it easier to write mocks.
  9. // Pointers to objects still have to be handled with
  10. // - (id)andReturnValue:OCMOCK_VALUE(blah)
  11. // to keep the types working correctly.
  12. @interface OCMStubRecorder(CrExtensions)
  13. - (id)andReturnChar:(char)value;
  14. - (id)andReturnUnsignedChar:(unsigned char)value;
  15. - (id)andReturnShort:(short)value;
  16. - (id)andReturnUnsignedShort:(unsigned short)value;
  17. - (id)andReturnInt:(int)value;
  18. - (id)andReturnUnsignedInt:(unsigned int)value;
  19. - (id)andReturnLong:(long)value;
  20. - (id)andReturnUnsignedLong:(unsigned long)value;
  21. - (id)andReturnLongLong:(long long)value;
  22. - (id)andReturnUnsignedLongLong:(unsigned long long)value;
  23. - (id)andReturnFloat:(float)value;
  24. - (id)andReturnDouble:(double)value;
  25. - (id)andReturnBool:(BOOL)value;
  26. - (id)andReturnInteger:(NSInteger)value;
  27. - (id)andReturnUnsignedInteger:(NSUInteger)value;
  28. #if !TARGET_OS_IPHONE
  29. - (id)andReturnCGFloat:(CGFloat)value;
  30. - (id)andReturnNSRect:(NSRect)rect;
  31. - (id)andReturnCGRect:(CGRect)rect;
  32. - (id)andReturnNSPoint:(NSPoint)point;
  33. - (id)andReturnCGPoint:(CGPoint)point;
  34. #endif
  35. @end
  36. // A constraint for verifying that something conforms to a protocol.
  37. @interface cr_OCMConformToProtocolConstraint : OCMConstraint {
  38. @private
  39. Protocol* protocol_;
  40. }
  41. - (id)initWithProtocol:(Protocol*)protocol;
  42. @end
  43. @interface OCMArg(CrExtensions)
  44. + (id)conformsToProtocol:(Protocol*)protocol;
  45. @end
  46. #endif // THIRD_PARTY_OCMOCK_OCMOCK_EXTENSIONS_H_