20
20
21
21
#import " FIRMessaging.h"
22
22
#import " FIRMessagingInstanceIDProxy.h"
23
+ #import " FIRMessaging_Private.h"
23
24
24
25
extern NSString *const kFIRMessagingFCMTokenFetchAPNSOption ;
25
26
@@ -28,6 +29,7 @@ @interface FIRMessaging ()
28
29
@property (nonatomic , readwrite , strong ) NSString *defaultFcmToken;
29
30
@property (nonatomic , readwrite , strong ) NSData *apnsTokenData;
30
31
@property (nonatomic , readwrite , strong ) FIRMessagingInstanceIDProxy *instanceIDProxy;
32
+ @property (nonatomic , readwrite , strong ) NSUserDefaults *messagingUserDefaults;
31
33
32
34
- (instancetype )initPrivately ;
33
35
// Direct Channel Methods
@@ -52,6 +54,9 @@ - (void)setUp {
52
54
_mockMessaging = OCMPartialMock (self.messaging );
53
55
_mockInstanceIDProxy = OCMPartialMock (self.messaging .instanceIDProxy );
54
56
self.messaging .instanceIDProxy = _mockInstanceIDProxy;
57
+ [self .messaging.messagingUserDefaults removePersistentDomainForName: kFIRMessagingSuiteName ];
58
+ self.messaging .messagingUserDefaults =
59
+ [[NSUserDefaults alloc ] initWithSuiteName: kFIRMessagingSuiteName ];
55
60
}
56
61
57
62
- (void )tearDown {
@@ -60,6 +65,15 @@ - (void)tearDown {
60
65
[super tearDown ];
61
66
}
62
67
68
+ - (void )testAutoInitEnableFlag {
69
+ // Should read from Info.plist
70
+ XCTAssertFalse (_messaging.isAutoInitEnabled );
71
+
72
+ // Now set the flag should overwrite Info.plist value.
73
+ _messaging.autoInitEnabled = YES ;
74
+ XCTAssertTrue (_messaging.isAutoInitEnabled );
75
+ }
76
+
63
77
#pragma mark - Direct Channel Establishment Testing
64
78
65
79
// Should connect with valid token and application in foreground
0 commit comments