aboutsummaryrefslogtreecommitdiffhomepage
path: root/Example/Messaging/Tests/FIRMessagingTest.m
diff options
context:
space:
mode:
Diffstat (limited to 'Example/Messaging/Tests/FIRMessagingTest.m')
-rw-r--r--Example/Messaging/Tests/FIRMessagingTest.m40
1 files changed, 40 insertions, 0 deletions
diff --git a/Example/Messaging/Tests/FIRMessagingTest.m b/Example/Messaging/Tests/FIRMessagingTest.m
index adc830d..61ff136 100644
--- a/Example/Messaging/Tests/FIRMessagingTest.m
+++ b/Example/Messaging/Tests/FIRMessagingTest.m
@@ -75,6 +75,46 @@ extern NSString *const kFIRMessagingFCMTokenFetchAPNSOption;
XCTAssertTrue(_messaging.isAutoInitEnabled);
}
+- (void)testAutoInitEnableFlagOverrideGlobalTrue {
+ OCMStub([self.mockMessaging isGlobalAutomaticDataCollectionEnabled]).andReturn(YES);
+ id bundleMock = OCMPartialMock([NSBundle mainBundle]);
+ OCMStub([bundleMock objectForInfoDictionaryKey:kFIRMessagingPlistAutoInitEnabled]).andReturn(nil);
+ XCTAssertTrue(self.messaging.isAutoInitEnabled);
+
+ self.messaging.autoInitEnabled = NO;
+ XCTAssertFalse(self.messaging.isAutoInitEnabled);
+ [bundleMock stopMocking];
+}
+
+- (void)testAutoInitEnableFlagOverrideGlobalFalse {
+ OCMStub([self.mockMessaging isGlobalAutomaticDataCollectionEnabled]).andReturn(YES);
+ id bundleMock = OCMPartialMock([NSBundle mainBundle]);
+ OCMStub([bundleMock objectForInfoDictionaryKey:kFIRMessagingPlistAutoInitEnabled]).andReturn(nil);
+ XCTAssertTrue(self.messaging.isAutoInitEnabled);
+
+ self.messaging.autoInitEnabled = NO;
+ XCTAssertFalse(self.messaging.isAutoInitEnabled);
+ [bundleMock stopMocking];
+}
+
+- (void)testAutoInitEnableGlobalDefaultTrue {
+ OCMStub([self.mockMessaging isGlobalAutomaticDataCollectionEnabled]).andReturn(YES);
+ id bundleMock = OCMPartialMock([NSBundle mainBundle]);
+ OCMStub([bundleMock objectForInfoDictionaryKey:kFIRMessagingPlistAutoInitEnabled]).andReturn(nil);
+
+ XCTAssertTrue(self.messaging.isAutoInitEnabled);
+ [bundleMock stopMocking];
+}
+
+- (void)testAutoInitEnableGlobalDefaultFalse {
+ OCMStub([self.mockMessaging isGlobalAutomaticDataCollectionEnabled]).andReturn(NO);
+ id bundleMock = OCMPartialMock([NSBundle mainBundle]);
+ OCMStub([bundleMock objectForInfoDictionaryKey:kFIRMessagingPlistAutoInitEnabled]).andReturn(nil);
+
+ XCTAssertFalse(self.messaging.isAutoInitEnabled);
+ [bundleMock stopMocking];
+}
+
#pragma mark - Direct Channel Establishment Testing
// Should connect with valid token and application in foreground