diff --git a/GoogleSignIn/Tests/Unit/GIDSignInTest.m b/GoogleSignIn/Tests/Unit/GIDSignInTest.m index 7d5195d8..ddf955a1 100644 --- a/GoogleSignIn/Tests/Unit/GIDSignInTest.m +++ b/GoogleSignIn/Tests/Unit/GIDSignInTest.m @@ -268,10 +268,8 @@ @interface GIDSignInTest : XCTestCase { // Status returned by saveAuthorization:toKeychainForName: BOOL _saveAuthorizationReturnValue; -#if TARGET_OS_IOS && !TARGET_OS_MACCATALYST // Test userDefaults for use with `GIDAppCheck` NSUserDefaults *_testUserDefaults; -#endif // TARGET_OS_IOS && !TARGET_OS_MACCATALYST } @end @@ -337,15 +335,12 @@ - (void)setUp { [_fakeMainBundle fakeAllSchemesSupported]; // Object under test - [[NSUserDefaults standardUserDefaults] setBool:YES forKey:kAppHasRunBeforeKey]; + _testUserDefaults = [[NSUserDefaults alloc] initWithSuiteName:kUserDefaultsSuiteName]; + [_testUserDefaults setBool:YES forKey:kAppHasRunBeforeKey]; _signIn = [[GIDSignIn alloc] initWithKeychainStore:_keychainStore]; _hint = nil; -#if TARGET_OS_IOS && !TARGET_OS_MACCATALYST - _testUserDefaults = [[NSUserDefaults alloc] initWithSuiteName:kUserDefaultsSuiteName]; -#endif // TARGET_OS_IOS && !TARGET_OS_MACCATALYST - __weak GIDSignInTest *weakSelf = self; _completion = ^(GIDSignInResult *_Nullable signInResult, NSError * _Nullable error) { GIDSignInTest *strongSelf = weakSelf; @@ -372,11 +367,7 @@ - (void)tearDown { OCMVerifyAll(_presentingWindow); #endif // TARGET_OS_IOS || TARGET_OS_MACCATALYST - [[NSUserDefaults standardUserDefaults] removeObjectForKey:kAppHasRunBeforeKey]; -#if TARGET_OS_IOS && !TARGET_OS_MACCATALYST - [_testUserDefaults removeObjectForKey:kGIDAppCheckPreparedKey]; - [_testUserDefaults removeSuiteNamed:kUserDefaultsSuiteName]; -#endif // TARGET_OS_IOS && !TARGET_OS_MACCATALYST + [_testUserDefaults removePersistentDomainForName:kUserDefaultsSuiteName]; [_fakeMainBundle stopFaking]; [super tearDown];