Skip to content

Commit ff0ea54

Browse files
Enabling watchOS unit test (#7480)
1 parent 80a4512 commit ff0ea54

File tree

7 files changed

+13
-10
lines changed

7 files changed

+13
-10
lines changed

.github/workflows/messaging.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,17 @@ jobs:
5757
# Don't run on private repo unless it is a PR.
5858
if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request'
5959
runs-on: macOS-latest
60+
strategy:
61+
matrix:
62+
target: [iOS, watchOS]
6063
steps:
6164
- uses: actions/checkout@v2
6265
- name: Xcode 12
6366
run: sudo xcode-select -s /Applications/Xcode_12.app/Contents/Developer
6467
- name: Initialize xcodebuild
6568
run: xcodebuild -list
66-
- name: iOS Unit Tests
67-
run: scripts/third_party/travis/retry.sh ./scripts/build.sh MessagingUnit iOS spm
69+
- name: Unit Tests
70+
run: scripts/third_party/travis/retry.sh ./scripts/build.sh MessagingUnit ${{ matrix.target }} spm
6871

6972
spm-cron:
7073
# Don't run on private repo.

FirebaseMessaging/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# unreleased
2+
- [fixed] Fixed an issue that when checking storage size before writing to the disk, the client was checking the document folder that is no longer used. (#7480)
3+
14
# 2021-02 -- v7.6.0
25
- [fixed] Fixed build warnings introduced with Xcode 12.5. (#7433)
36

FirebaseMessaging/Sources/FIRMessaging.m

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,6 @@ - (void)start {
231231
[self setupNotificationListeners];
232232
[self setupTopics];
233233

234-
#if !TARGET_OS_WATCH
235234
// Print the library version for logging.
236235
NSString *currentLibraryVersion = FIRFirebaseVersion();
237236
FIRMessagingLoggerInfo(kFIRMessagingMessageCodeMessagingPrintLibraryVersion,
@@ -245,8 +244,6 @@ - (void)start {
245244
// setup FIRMessaging objects
246245
[self setupRmqManager];
247246
[self setupSyncMessageManager];
248-
249-
#endif
250247
}
251248

252249
- (void)setupFileManagerSubDirectory {

FirebaseMessaging/Sources/FIRMessagingUtilities.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ int64_t FIRMessagingCurrentTimestampInMilliseconds(void) {
6868

6969
uint64_t FIRMessagingGetFreeDiskSpaceInMB(void) {
7070
NSError *error;
71-
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
71+
NSArray *paths =
72+
NSSearchPathForDirectoriesInDomains(FIRMessagingSupportedDirectory(), NSUserDomainMask, YES);
7273

7374
NSDictionary *attributesMap =
7475
[[NSFileManager defaultManager] attributesOfFileSystemForPath:[paths lastObject]

FirebaseMessaging/Tests/UnitTests/FIRMessagingExtensionHelperTest.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
API_AVAILABLE(macos(10.14), ios(10.0))
2424
typedef void (^FIRMessagingContentHandler)(UNNotificationContent *content);
2525

26-
#if TARGET_OS_IOS || TARGET_OS_OSX
26+
#if TARGET_OS_IOS || TARGET_OS_OSX || TARGET_OS_WATCH
2727
static NSString *const kFCMPayloadOptionsName = @"fcm_options";
2828
static NSString *const kFCMPayloadOptionsImageURLName = @"image";
2929
static NSString *const kValidImageURL =

FirebaseMessaging/Tests/UnitTests/FIRMessagingHandlingTest.m

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,10 +171,8 @@ - (void)testAPNSContentAvailableContextualNotification {
171171
OCMReject([_testUtil.mockMessaging handleIncomingLinkIfNeededFromMessage:notificationPayload]);
172172
OCMReject([_mockMessagingAnalytics logMessage:notificationPayload toAnalytics:[OCMArg any]]);
173173

174-
#if !(SWIFT_PACKAGE && TARGET_OS_TV) // Not enough space.
175174
XCTAssertEqualObjects(@(FIRMessagingMessageStatusNew),
176175
@([_testUtil.messaging appDidReceiveMessage:notificationPayload].status));
177-
#endif
178176
OCMVerifyAll(_testUtil.mockMessaging);
179177
}
180178

FirebaseMessaging/Tests/UnitTests/FIRMessagingRemoteNotificationsProxyTest.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ - (void)tearDown {
182182
}
183183

184184
#pragma mark - Method Swizzling Tests
185-
185+
#if !TARGET_OS_WATCH // TODO(chliangGoogle) Figure out why WKExtension is not recognized here.
186186
- (void)testSwizzlingNonAppDelegate {
187187
RandomObject *invalidAppDelegate = [[RandomObject alloc] init];
188188
[[GULAppDelegateSwizzler sharedApplication]
@@ -194,6 +194,7 @@ - (void)testSwizzlingNonAppDelegate {
194194
[invalidAppDelegate application:[GULAppDelegateSwizzler sharedApplication]
195195
didReceiveRemoteNotification:@{}];
196196
}
197+
#endif
197198

198199
#if !SWIFT_PACKAGE
199200
// The next 3 tests depend on a sharedApplication which is not available in the Swift PM test env.

0 commit comments

Comments
 (0)