Skip to content

Commit 188ddce

Browse files
authored
Fix Catalyst tests for #7050 (#7065)
1 parent 781c8b8 commit 188ddce

File tree

6 files changed

+17
-99
lines changed

6 files changed

+17
-99
lines changed

.github/workflows/auth.yml

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -67,26 +67,11 @@ jobs:
6767
# Don't run on private repo unless it is a PR.
6868
if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request'
6969
runs-on: macOS-latest
70-
steps:
71-
- uses: actions/checkout@v2
72-
- name: Xcode 12
73-
run: sudo xcode-select -s /Applications/Xcode_12.app/Contents/Developer
74-
- name: Initialize xcodebuild
75-
run: xcodebuild -list
76-
- name: iOS Unit Tests
77-
run: scripts/third_party/travis/retry.sh ./scripts/build.sh AuthUnit iOS spm
78-
79-
spm-cron:
80-
# Don't run on private repo.
81-
if: github.event_name == 'schedule' && github.repository == 'Firebase/firebase-ios-sdk'
82-
runs-on: macOS-latest
8370
strategy:
8471
matrix:
85-
target: [tvOS, macOS, catalyst]
72+
target: [iOS, tvOS, macOS, catalyst]
8673
steps:
8774
- uses: actions/checkout@v2
88-
- name: Xcode 12
89-
run: sudo xcode-select -s /Applications/Xcode_12.app/Contents/Developer
9075
- name: Initialize xcodebuild
9176
run: xcodebuild -list
9277
- name: Unit Tests

FirebaseAuth.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ supports email and password accounts, as well as several 3rd party authenticatio
5050

5151
s.test_spec 'unit' do |unit_tests|
5252
# Unit tests can't run on watchOS.
53-
unit_tests.platforms = {:ios => '8.0', :osx => '10.11', :tvos => '10.0'}
53+
unit_tests.platforms = {:ios => '10.0', :osx => '10.12', :tvos => '10.0'}
5454
unit_tests.source_files = 'FirebaseAuth/Tests/Unit/*.[mh]'
5555
unit_tests.osx.exclude_files = [
5656
'FirebaseAuth/Tests/Unit/FIRAuthAPNSTokenManagerTests.m',

FirebaseAuth/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# 7.3.0
2+
- [fixed] Catalyst browser issue with `verifyPhoneNumber` API. (#7049)
3+
14
# 7.1.0
25
- [fixed] Fixed completion handler issue in `application(_:didReceiveRemoteNotification:fetchCompletionHandler:)` method. (#6863)
36

FirebaseAuth/Tests/Unit/FIRAuthNotificationManagerTests.m

Lines changed: 0 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -84,24 +84,6 @@ - (void)application:(UIApplication *)application
8484

8585
@end
8686

87-
/** @class FIRAuthLegacyForwardingDelegate
88-
@brief A fake UIApplicationDelegate that implements the legacy deegate method to receive
89-
notification.
90-
*/
91-
@interface FIRAuthLegacyForwardingDelegate : FIRAuthFakeForwardingDelegate
92-
@end
93-
@implementation FIRAuthLegacyForwardingDelegate
94-
95-
- (void)application:(UIApplication *)application
96-
didReceiveRemoteNotification:(NSDictionary *)userInfo {
97-
self.notificationReceived = YES;
98-
if (self.forwardsNotification) {
99-
self.notificationhandled = [self.notificationManager canHandleNotification:userInfo];
100-
}
101-
}
102-
103-
@end
104-
10587
/** @class FIRAuthNotificationManagerTests
10688
@brief Unit tests for @c FIRAuthNotificationManager .
10789
*/
@@ -127,11 +109,6 @@ @implementation FIRAuthNotificationManagerTests {
127109
@brief The modern fake UIApplicationDelegate for testing.
128110
*/
129111
FIRAuthModernForwardingDelegate *_modernDelegate;
130-
131-
/** @var _legacyDelegate
132-
@brief The legacy fake UIApplicationDelegate for testing.
133-
*/
134-
FIRAuthLegacyForwardingDelegate *_legacyDelegate;
135112
}
136113

137114
- (void)setUp {
@@ -142,8 +119,6 @@ - (void)setUp {
142119
appCredentialManager:_mockAppCredentialManager];
143120
_modernDelegate = [[FIRAuthModernForwardingDelegate alloc] init];
144121
_modernDelegate.notificationManager = _notificationManager;
145-
_legacyDelegate = [[FIRAuthLegacyForwardingDelegate alloc] init];
146-
_legacyDelegate.notificationManager = _notificationManager;
147122
}
148123

149124
/** @fn testForwardingModernDelegate
@@ -153,27 +128,13 @@ - (void)testForwardingModernDelegate {
153128
[self verifyForwarding:YES delegate:_modernDelegate];
154129
}
155130

156-
/** @fn testForwardingLegacyDelegate
157-
@brief Tests checking notification forwarding on legacy fake delegate.
158-
*/
159-
- (void)testForwardingLegacyDelegate {
160-
[self verifyForwarding:YES delegate:_legacyDelegate];
161-
}
162-
163131
/** @fn testNotForwardingModernDelegate
164132
@brief Tests checking notification not forwarding on modern fake delegate.
165133
*/
166134
- (void)testNotForwardingModernDelegate {
167135
[self verifyForwarding:NO delegate:_modernDelegate];
168136
}
169137

170-
/** @fn testNotForwardingLegacyDelegate
171-
@brief Tests checking notification not forwarding on legacy fake delegate.
172-
*/
173-
- (void)testNotForwardingLegacyDelegate {
174-
[self verifyForwarding:NO delegate:_legacyDelegate];
175-
}
176-
177138
/** @fn verifyForwarding:delegate:
178139
@brief Tests checking notification forwarding on a particular delegate.
179140
@param forwarding Whether the notification is being forwarded or not.
@@ -212,31 +173,6 @@ - (void)testCachedResult {
212173
XCTAssertFalse(delegate.notificationReceived);
213174
}
214175

215-
/** @fn testMultipleCallbacks
216-
@brief Test multiple callbacks are handled correctly.
217-
*/
218-
- (void)testMultipleCallbacks {
219-
FIRAuthFakeForwardingDelegate *delegate = _legacyDelegate;
220-
delegate.forwardsNotification = YES;
221-
OCMStub([_mockApplication delegate]).andReturn(delegate);
222-
XCTestExpectation *expectation1 = [self expectationWithDescription:@"callback1"];
223-
[_notificationManager
224-
checkNotificationForwardingWithCallback:^(BOOL isNotificationBeingForwarded) {
225-
XCTAssertTrue(isNotificationBeingForwarded);
226-
[expectation1 fulfill];
227-
}];
228-
XCTestExpectation *expectation2 = [self expectationWithDescription:@"callback2"];
229-
[_notificationManager
230-
checkNotificationForwardingWithCallback:^(BOOL isNotificationBeingForwarded) {
231-
XCTAssertTrue(isNotificationBeingForwarded);
232-
[expectation2 fulfill];
233-
}];
234-
XCTAssertFalse(delegate.notificationReceived);
235-
[self waitForExpectationsWithTimeout:_notificationManager.timeout * .5 handler:nil];
236-
XCTAssertTrue(delegate.notificationReceived);
237-
XCTAssertTrue(delegate.notificationhandled);
238-
}
239-
240176
/** @fn testPassingToCredentialManager
241177
@brief Test notification with the right structure is passed to credential manager.
242178
*/

FirebaseAuth/Tests/Unit/FIRAuthTests.m

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -259,13 +259,6 @@ - (BOOL)application:(UIApplication *)app
259259
return NO;
260260
}
261261

262-
- (BOOL)application:(UIApplication *)application
263-
openURL:(NSURL *)url
264-
sourceApplication:(nullable NSString *)sourceApplication
265-
annotation:(id)annotation {
266-
return NO;
267-
}
268-
269262
@end
270263

271264
#endif // TARGET_OS_IOS

FirebaseAuth/Tests/Unit/FIRAuthURLPresenterTests.m

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -101,17 +101,18 @@ - (void)testFIRAuthURLPresenterUsingDefaultUIDelegate:(BOOL)usesDefaultUIDelegat
101101
[invocation getArgument:&unretainedArgument atIndex:2];
102102

103103
id presentViewController = unretainedArgument;
104-
if (@available(iOS 9.0, *)) { // SFSafariViewController is available
105-
SFSafariViewController *viewController = presentViewController;
106-
XCTAssertTrue([viewController isKindOfClass:[SFSafariViewController class]]);
107-
XCTAssertEqual(viewController.delegate, presenter);
108-
} else {
109-
UINavigationController *navigationController = presentViewController;
110-
XCTAssertTrue([navigationController isKindOfClass:[UINavigationController class]]);
111-
FIRAuthWebViewController *webViewController =
112-
navigationController.viewControllers.firstObject;
113-
XCTAssertTrue([webViewController isKindOfClass:[FIRAuthWebViewController class]]);
114-
}
104+
#if TARGET_OS_MACCATALYST
105+
// SFSafariViewController is not available
106+
UINavigationController *navigationController = presentViewController;
107+
XCTAssertTrue([navigationController isKindOfClass:[UINavigationController class]]);
108+
FIRAuthWebViewController *webViewController =
109+
navigationController.viewControllers.firstObject;
110+
XCTAssertTrue([webViewController isKindOfClass:[FIRAuthWebViewController class]]);
111+
#else
112+
SFSafariViewController *viewController = presentViewController;
113+
XCTAssertTrue([viewController isKindOfClass:[SFSafariViewController class]]);
114+
XCTAssertEqual(viewController.delegate, presenter);
115+
#endif
115116
[UIPresentationExpectation fulfill];
116117
});
117118

0 commit comments

Comments
 (0)