aboutsummaryrefslogtreecommitdiffhomepage
path: root/Example/Messaging
diff options
context:
space:
mode:
authorGravatar Chen Liang <chliang@google.com>2018-04-19 17:03:45 -0700
committerGravatar GitHub <noreply@github.com>2018-04-19 17:03:45 -0700
commit58b0aefc66772977752d01e35927e9eab3ee775f (patch)
tree0ac9fef1bc5fbd2537f10ece2c03b647445cf631 /Example/Messaging
parent9a3dbe937f4ca96561374c5d297aab6ba585d225 (diff)
replace the private OCMock method with a public one, and also fix the EXC_BAD_ACCESSw (#1149)
Diffstat (limited to 'Example/Messaging')
-rw-r--r--Example/Messaging/Tests/FIRMessagingTest.m13
1 files changed, 4 insertions, 9 deletions
diff --git a/Example/Messaging/Tests/FIRMessagingTest.m b/Example/Messaging/Tests/FIRMessagingTest.m
index c2a136a..adc830d 100644
--- a/Example/Messaging/Tests/FIRMessagingTest.m
+++ b/Example/Messaging/Tests/FIRMessagingTest.m
@@ -61,11 +61,8 @@ extern NSString *const kFIRMessagingFCMTokenFetchAPNSOption;
}
- (void)tearDown {
- _messaging = nil;
[_mockMessaging stopMocking];
- _mockMessaging = nil;
[_mockInstanceID stopMocking];
- _mockInstanceID = nil;
[super tearDown];
}
@@ -135,7 +132,6 @@ extern NSString *const kFIRMessagingFCMTokenFetchAPNSOption;
#pragma mark - FCM Token Fetching and Deleting
-#ifdef NEED_WORKAROUND_FOR_PRIVATE_OCMOCK_getArgumentAtIndexAsObject
- (void)testAPNSTokenIncludedInOptionsIfAvailableDuringTokenFetch {
self.messaging.apnsTokenData =
[@"PRETENDING_TO_BE_A_DEVICE_TOKEN" dataUsingEncoding:NSUTF8StringEncoding];
@@ -143,8 +139,8 @@ extern NSString *const kFIRMessagingFCMTokenFetchAPNSOption;
[self expectationWithDescription:@"Included APNS Token data in options dict."];
// Inspect the 'options' dictionary to tell whether our expectation was fulfilled
[[[self.mockInstanceID stub] andDo:^(NSInvocation *invocation) {
- // Calling getArgument:atIndex: directly leads to an EXC_BAD_ACCESS; use OCMock's wrapper.
- NSDictionary *options = [invocation getArgumentAtIndexAsObject:4];
+ NSDictionary *options;
+ [invocation getArgument:&options atIndex:4];
if (options[@"apns_token"] != nil) {
[expectation fulfill];
}
@@ -160,8 +156,8 @@ extern NSString *const kFIRMessagingFCMTokenFetchAPNSOption;
[self expectationWithDescription:@"Included APNS Token data not included in options dict."];
// Inspect the 'options' dictionary to tell whether our expectation was fulfilled
[[[self.mockInstanceID stub] andDo:^(NSInvocation *invocation) {
- // Calling getArgument:atIndex: directly leads to an EXC_BAD_ACCESS; use OCMock's wrapper.
- NSDictionary *options = [invocation getArgumentAtIndexAsObject:4];
+ NSDictionary *options;
+ [invocation getArgument:&options atIndex:4];
if (options[@"apns_token"] == nil) {
[expectation fulfill];
}
@@ -171,7 +167,6 @@ extern NSString *const kFIRMessagingFCMTokenFetchAPNSOption;
NSError * _Nullable error) {}];
[self waitForExpectationsWithTimeout:0.1 handler:nil];
}
-#endif
- (void)testReturnsErrorWhenFetchingTokenWithoutSenderID {
XCTestExpectation *expectation =