|
39 | 39 | #endif // TARGET_OS_IOS && !TARGET_OS_MACCATALYST |
40 | 40 |
|
41 | 41 | #import "GoogleSignIn/Tests/Unit/GIDFakeMainBundle.h" |
| 42 | +#import "GoogleSignIn/Tests/Unit/GIDProfileData+Testing.h" |
42 | 43 | #import "GoogleSignIn/Tests/Unit/OIDAuthorizationResponse+Testing.h" |
43 | 44 | #import "GoogleSignIn/Tests/Unit/OIDTokenResponse+Testing.h" |
44 | 45 |
|
|
132 | 133 | static NSString * const kIDTokenExpirationKey = @"idTokenExp"; |
133 | 134 | static NSString * const kScopeKey = @"scope"; |
134 | 135 |
|
135 | | -// Basic profile (Fat ID Token / userinfo endpoint) keys |
136 | | -static NSString *const kBasicProfilePictureKey = @"picture"; |
137 | | -static NSString *const kBasicProfileNameKey = @"name"; |
138 | | -static NSString *const kBasicProfileGivenNameKey = @"given_name"; |
139 | | -static NSString *const kBasicProfileFamilyNameKey = @"family_name"; |
140 | | - |
141 | | -static NSString * const kCustomKeychainName = @"CUSTOM_KEYCHAIN_NAME"; |
142 | | -static NSString * const kAddActivity = @"http://schemas.google.com/AddActivity"; |
143 | 136 | static NSString * const kErrorDomain = @"ERROR_DOMAIN"; |
144 | 137 | static NSInteger const kErrorCode = 212; |
145 | 138 |
|
@@ -1181,7 +1174,15 @@ - (void)OAuthLoginWithAddScopesFlow:(BOOL)addScopesFlow |
1181 | 1174 | refreshToken:kRefreshToken |
1182 | 1175 | codeVerifier:nil |
1183 | 1176 | additionalParameters:tokenResponse.request.additionalParameters]; |
1184 | | - |
| 1177 | + |
| 1178 | + // Set the response for GIDProfileDataFetcher. |
| 1179 | + GIDProfileDataFetcherTestBlock testBlock = ^(GIDProfileDataFetcherFakeResponse response) { |
| 1180 | + GIDProfileData *profileData = [GIDProfileData testInstance]; |
| 1181 | + response(profileData, nil); |
| 1182 | + }; |
| 1183 | + |
| 1184 | + [_profileDataFetcher setTestBlock:testBlock]; |
| 1185 | + |
1185 | 1186 | if (restoredSignIn) { |
1186 | 1187 | // maybeFetchToken |
1187 | 1188 | [[[_authState expect] andReturn:tokenResponse] lastTokenResponse]; |
@@ -1307,9 +1308,6 @@ - (void)OAuthLoginWithAddScopesFlow:(BOOL)addScopesFlow |
1307 | 1308 | return; |
1308 | 1309 | } |
1309 | 1310 |
|
1310 | | - // DecodeIdTokenCallback |
1311 | | - [[[_authState expect] andReturn:tokenResponse] lastTokenResponse]; |
1312 | | - |
1313 | 1311 | // SaveAuthCallback |
1314 | 1312 | __block OIDAuthState *authState; |
1315 | 1313 | __block OIDTokenResponse *updatedTokenResponse; |
@@ -1363,10 +1361,7 @@ - (void)OAuthLoginWithAddScopesFlow:(BOOL)addScopesFlow |
1363 | 1361 | XCTAssertNotNil(authState); |
1364 | 1362 | } |
1365 | 1363 | // Check fat ID token decoding |
1366 | | - XCTAssertEqualObjects(profileData.name, kFatName); |
1367 | | - XCTAssertEqualObjects(profileData.givenName, kFatGivenName); |
1368 | | - XCTAssertEqualObjects(profileData.familyName, kFatFamilyName); |
1369 | | - XCTAssertTrue(profileData.hasImage); |
| 1364 | + XCTAssertEqualObjects(profileData, [GIDProfileData testInstance]); |
1370 | 1365 |
|
1371 | 1366 | // If attempt to authenticate again, will reuse existing auth object. |
1372 | 1367 | _completionCalled = NO; |
|
0 commit comments