| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #import "ios/chrome/test/ocmock/OCMockObject+BreakpadControllerTesting.h" | 5 #import "ios/chrome/test/ocmock/OCMockObject+BreakpadControllerTesting.h" |
| 6 | 6 |
| 7 #import "breakpad/src/client/ios/BreakpadController.h" | 7 #import "breakpad/src/client/ios/BreakpadController.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 #import "third_party/ocmock/OCMock/OCMock.h" | 9 #import "third_party/ocmock/OCMock/OCMock.h" |
| 10 | 10 |
| 11 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 12 #error "This file requires ARC support." |
| 13 #endif |
| 14 |
| 11 @implementation OCMockObject (BreakpadControllerTesting) | 15 @implementation OCMockObject (BreakpadControllerTesting) |
| 12 | 16 |
| 13 - (void)cr_expectGetCrashReportCount:(int)crashReportCount { | 17 - (void)cr_expectGetCrashReportCount:(int)crashReportCount { |
| 14 id invocationBlock = ^(NSInvocation* invocation) { | 18 id invocationBlock = ^(NSInvocation* invocation) { |
| 15 void (^block)(int); | 19 __unsafe_unretained void (^block)(int); |
| 16 [invocation getArgument:&block atIndex:2]; | 20 [invocation getArgument:&block atIndex:2]; |
| 17 if (!block) { | 21 if (!block) { |
| 18 ADD_FAILURE(); | 22 ADD_FAILURE(); |
| 19 return; | 23 return; |
| 20 } | 24 } |
| 21 block(crashReportCount); | 25 block(crashReportCount); |
| 22 }; | 26 }; |
| 23 BreakpadController* breakpadController = | 27 BreakpadController* breakpadController = |
| 24 static_cast<BreakpadController*>([[self expect] andDo:invocationBlock]); | 28 static_cast<BreakpadController*>([[self expect] andDo:invocationBlock]); |
| 25 [breakpadController getCrashReportCount:[OCMArg isNotNil]]; | 29 [breakpadController getCrashReportCount:[OCMArg isNotNil]]; |
| 26 } | 30 } |
| 27 | 31 |
| 28 @end | 32 @end |
| OLD | NEW |