1616
1717#import " GoogleSignIn/Sources/GIDAuthStateMigration/GIDAuthStateMigration.h"
1818#import " GoogleSignIn/Sources/GIDSignInCallbackSchemes.h"
19- #if TARGET_OS_OSX || TARGET_OS_MACCATALYST
19+ #if TARGET_OS_OSX
2020#import " GoogleSignIn/Tests/Unit/OIDAuthState+Testing.h"
21- #endif // TARGET_OS_OSX || TARGET_OS_MACCATALYST
21+ #endif // TARGET_OS_OSX
2222
2323@import GTMAppAuth;
2424
@@ -84,9 +84,9 @@ @implementation GIDAuthStateMigrationTest {
8484 id _mockNSBundle;
8585 id _mockGIDSignInCallbackSchemes;
8686 id _mockGTMOAuth2Compatibility;
87- #if TARGET_OS_OSX || TARGET_OS_MACCATALYST
87+ #if TARGET_OS_OSX
8888 id _realLegacyGTMKeychainStore;
89- #endif // TARGET_OS_OSX || TARGET_OS_MACCATALYST
89+ #endif // TARGET_OS_OSX
9090}
9191
9292- (void )setUp {
@@ -100,12 +100,12 @@ - (void)setUp {
100100 _mockNSBundle = OCMStrictClassMock ([NSBundle class ]);
101101 _mockGIDSignInCallbackSchemes = OCMStrictClassMock ([GIDSignInCallbackSchemes class ]);
102102 _mockGTMOAuth2Compatibility = OCMStrictClassMock ([GTMOAuth2Compatibility class ]);
103- #if TARGET_OS_OSX || TARGET_OS_MACCATALYST
103+ #if TARGET_OS_OSX
104104 GTMKeychainAttribute *fileBasedKeychain = [GTMKeychainAttribute useFileBasedKeychain ];
105105 NSSet *attributes = [NSSet setWithArray: @[fileBasedKeychain]];
106106 _realLegacyGTMKeychainStore = [[GTMKeychainStore alloc ] initWithItemName: kKeychainName
107107 keychainAttributes: attributes];
108- #endif // TARGET_OS_OSX || TARGET_OS_MACCATALYST
108+ #endif // TARGET_OS_OSX
109109}
110110
111111- (void )tearDown {
@@ -125,16 +125,16 @@ - (void)tearDown {
125125 [_mockGIDSignInCallbackSchemes stopMocking ];
126126 [_mockGTMOAuth2Compatibility verify ];
127127 [_mockGTMOAuth2Compatibility stopMocking ];
128- #if TARGET_OS_OSX || TARGET_OS_MACCATALYST
128+ #if TARGET_OS_OSX
129129 [_realLegacyGTMKeychainStore removeAuthSessionWithError: nil ];
130- #endif // TARGET_OS_OSX || TARGET_OS_MACCATALYST
130+ #endif // TARGET_OS_OSX
131131
132132 [super tearDown ];
133133}
134134
135135#pragma mark - Tests
136136
137- #if TARGET_OS_OSX || TARGET_OS_MACCATALYST
137+ #if TARGET_OS_OSX
138138- (void )testMigrateIfNeeded_NoPreviousMigration_DataProtectedMigration {
139139 [[[_mockUserDefaults stub ] andReturn: _mockUserDefaults] standardUserDefaults ];
140140 [[[_mockUserDefaults expect ] andReturnValue: @NO ] boolForKey: kDataProtectedMigrationCheckPerformedKey ];
@@ -182,7 +182,7 @@ - (void)testMigrateIfNeeded_KeychainFailure_DataProtectedMigration {
182182 XCTAssertNil ([_realLegacyGTMKeychainStore retrieveAuthSessionWithError: nil ]);
183183}
184184
185- #else
185+ #elif TARGET_OS_IOS && !TARGET_OS_MACCATALYST
186186- (void )testMigrateIfNeeded_NoPreviousMigration_GTMAppAuthMigration {
187187 [[[_mockUserDefaults stub ] andReturn: _mockUserDefaults] standardUserDefaults ];
188188 [[[_mockUserDefaults expect ] andReturnValue: @NO ] boolForKey: kGTMAppAuthMigrationCheckPerformedKey ];
@@ -238,17 +238,17 @@ - (void)testExtractAuthorization_HostedDomain {
238238
239239 XCTAssertNotNil (authorization);
240240}
241- #endif // TARGET_OS_OSX || TARGET_OS_MACCATALYST
241+ #endif // TARGET_OS_OSX
242242
243243- (void )testMigrateIfNeeded_HasPreviousMigration {
244244 [[[_mockUserDefaults stub ] andReturn: _mockUserDefaults] standardUserDefaults ];
245- #if TARGET_OS_OSX || TARGET_OS_MACCATALYST
245+ #if TARGET_OS_OSX
246246 [[[_mockUserDefaults expect ] andReturnValue: @YES ] boolForKey: kDataProtectedMigrationCheckPerformedKey ];
247247 [[_mockUserDefaults reject ] setBool: YES forKey: kDataProtectedMigrationCheckPerformedKey ];
248- #else
248+ #elif TARGET_OS_IOS && !TARGET_OS_MACCATALYST
249249 [[[_mockUserDefaults expect ] andReturnValue: @YES ] boolForKey: kGTMAppAuthMigrationCheckPerformedKey ];
250250 [[_mockUserDefaults reject ] setBool: YES forKey: kGTMAppAuthMigrationCheckPerformedKey ];
251- #endif // TARGET_OS_OSX || TARGET_OS_MACCATALYST
251+ #endif // TARGET_OS_OSX
252252
253253 GIDAuthStateMigration *migration =
254254 [[GIDAuthStateMigration alloc ] initWithKeychainStore: _mockGTMKeychainStore];
@@ -259,11 +259,11 @@ - (void)testMigrateIfNeeded_HasPreviousMigration {
259259
260260- (void )testMigrateIfNeeded_isFreshInstall {
261261 [[[_mockUserDefaults stub ] andReturn: _mockUserDefaults] standardUserDefaults ];
262- #if TARGET_OS_OSX || TARGET_OS_MACCATALYST
262+ #if TARGET_OS_OSX
263263 [[_mockUserDefaults expect ] setBool: YES forKey: kDataProtectedMigrationCheckPerformedKey ];
264- #else
264+ #elif TARGET_OS_IOS && !TARGET_OS_MACCATALYST
265265 [[_mockUserDefaults expect ] setBool: YES forKey: kGTMAppAuthMigrationCheckPerformedKey ];
266- #endif // TARGET_OS_OSX || TARGET_OS_MACCATALYST
266+ #endif // TARGET_OS_OSX
267267
268268 GIDAuthStateMigration *migration =
269269 [[GIDAuthStateMigration alloc ] initWithKeychainStore: _mockGTMKeychainStore];
0 commit comments