Просмотр исходного кода

Add tests for valid params and vc

Matt Mathias 1 год назад
Родитель
Сommit
180642eed6
16 измененных файлов с 234 добавлено и 26 удалено
  1. 12 5
      GoogleSignIn/Sources/GIDAuthorization.m
  2. 7 3
      GoogleSignIn/Sources/GIDAuthorizationFlow/API/GIDAuthorizationFlowCoordinator.h
  3. 42 0
      GoogleSignIn/Sources/GIDAuthorizationFlow/Implementations/Fake/GIDAuthorizationFlowFake.h
  4. 85 0
      GoogleSignIn/Sources/GIDAuthorizationFlow/Implementations/Fake/GIDAuthorizationFlowFake.m
  5. 1 1
      GoogleSignIn/Sources/GIDAuthorizationFlow/Implementations/GIDAuthorizationFlow.h
  6. 8 8
      GoogleSignIn/Sources/GIDAuthorizationFlow/Implementations/GIDAuthorizationFlow.m
  7. 0 0
      GoogleSignIn/Sources/GIDAuthorizationFlow/Implementations/Operations/GIDAuthorizationCompletionOperation.h
  8. 2 2
      GoogleSignIn/Sources/GIDAuthorizationFlow/Implementations/Operations/GIDAuthorizationCompletionOperation.m
  9. 0 0
      GoogleSignIn/Sources/GIDAuthorizationFlow/Implementations/Operations/GIDDecodeIDTokenOperation.h
  10. 1 1
      GoogleSignIn/Sources/GIDAuthorizationFlow/Implementations/Operations/GIDDecodeIDTokenOperation.m
  11. 0 0
      GoogleSignIn/Sources/GIDAuthorizationFlow/Implementations/Operations/GIDSaveAuthOperation.h
  12. 1 1
      GoogleSignIn/Sources/GIDAuthorizationFlow/Implementations/Operations/GIDSaveAuthOperation.m
  13. 0 0
      GoogleSignIn/Sources/GIDAuthorizationFlow/Implementations/Operations/GIDTokenFetchOperation.h
  14. 0 0
      GoogleSignIn/Sources/GIDAuthorizationFlow/Implementations/Operations/GIDTokenFetchOperation.m
  15. 16 5
      GoogleSignIn/Sources/GIDAuthorization_Private.h
  16. 59 0
      GoogleSignIn/Tests/Unit/GIDAuthorizationTests/GIDAuthorizationTest.m

+ 12 - 5
GoogleSignIn/Sources/GIDAuthorization.m

@@ -18,7 +18,8 @@
 #import "GoogleSignIn/Sources/Public/GoogleSignIn/GIDConfiguration.h"
 #import "GoogleSignIn/Sources/Public/GoogleSignIn/GIDGoogleUser.h"
 
-#import "GoogleSignIn/Sources/GIDAuthorizationFlow/GIDAuthorizationFlow.h"
+#import "GoogleSignIn/Sources/GIDAuthorizationFlow/API/GIDAuthorizationFlowCoordinator.h"
+#import "GoogleSignIn/Sources/GIDAuthorizationFlow/Implementations/GIDAuthorizationFlow.h"
 #import "GoogleSignIn/Sources/GIDAuthorization_Private.h"
 #import "GoogleSignIn/Sources/GIDConfiguration_Private.h"
 #import "GoogleSignIn/Sources/GIDEMMSupport.h"
@@ -80,23 +81,28 @@ static NSString *const kTokenURLTemplate = @"https://%@/token";
   return [self initWithKeychainStore:keychainStore configuration:nil];
 }
 
-- (instancetype)initWithKeychainStore:(GTMKeychainStore *)keychainStore
+- (instancetype)initWithKeychainStore:(nullable GTMKeychainStore *)keychainStore
                         configuration:(nullable GIDConfiguration *)configuration {
   return [self initWithKeychainStore:keychainStore
                        configuration:configuration
         authorizationFlowCoordinator:nil];
 }
 
-- (instancetype)initWithKeychainStore:(GTMKeychainStore *)keychainStore
+- (instancetype)initWithKeychainStore:(nullable GTMKeychainStore *)keychainStore
                         configuration:(nullable GIDConfiguration *)configuration
          authorizationFlowCoordinator:(nullable id<GIDAuthorizationFlowCoordinator>)authFlow {
   self = [super init];
   if (self) {
-    _keychainStore = keychainStore;
+    GTMKeychainStore *defaultStore = [[GTMKeychainStore alloc] initWithItemName:kGSIServiceName];
+    GTMKeychainStore *store = keychainStore ?: defaultStore;
+    _keychainStore = store;
     NSBundle *mainBundle = [NSBundle mainBundle];
     GIDConfiguration *defaultConfiguration = [GIDConfiguration configurationFromBundle:mainBundle];
     _currentConfiguration = configuration ?: defaultConfiguration;
     _authFlow = authFlow;
+    // FIXME: This should be cleaner
+    _authFlow.configuration = _currentConfiguration;
+    _currentOptions = _authFlow.options;
     
     NSString *authorizationEnpointURL = [NSString stringWithFormat:kAuthorizationURLTemplate,
                                          [GIDSignInPreferences googleAuthorizationServer]];
@@ -107,7 +113,6 @@ static NSString *const kTokenURLTemplate = @"https://%@/token";
     _appAuthConfiguration =
       [[OIDServiceConfiguration alloc] initWithAuthorizationEndpoint:authEndpoint
                                                        tokenEndpoint:tokenEndpoint];
-    _authFlow.configuration = _currentConfiguration;
     _authFlow.serviceConfiguration = _appAuthConfiguration;
   }
   return self;
@@ -132,6 +137,7 @@ static NSString *const kTokenURLTemplate = @"https://%@/token";
 
 #pragma mark - Signing In
 
+// FIXME: Do not pass options here; put this on `GIDAuthorizationFlow`
 - (void)signInWithOptions:(GIDSignInInternalOptions *)options {
   // Options for continuation are not the options we want to cache. The purpose of caching the
   // options in the first place is to provide continuation flows with a starting place from which to
@@ -190,6 +196,7 @@ static NSString *const kTokenURLTemplate = @"https://%@/token";
 
 #pragma mark - Authorization Flow
 
+// FIXME: Do not pass options here
 - (void)authenticateWithOptions:(GIDSignInInternalOptions *)options {
   // If this is an interactive flow, we're not going to try to restore any saved auth state.
   if (options.interactive) {

+ 7 - 3
GoogleSignIn/Sources/GIDAuthorizationFlow/GIDAuthorizationFlowCoordinator.h → GoogleSignIn/Sources/GIDAuthorizationFlow/API/GIDAuthorizationFlowCoordinator.h

@@ -38,9 +38,13 @@ NS_ASSUME_NONNULL_BEGIN
 
 - (void)authorize;
 - (void)authorizeInteractively;
-//- (void)processAuthorizationResponse:(nullable OIDAuthorizationResponse *)authorizationResponse
-//                               error:(nullable NSError *)error
-//                          emmSupport:(nullable NSString *)emmSupport;
+- (instancetype)initWithSignInOptions:(nullable GIDSignInInternalOptions *)options
+                            authState:(nullable OIDAuthState *)authState
+                          profileData:(nullable GIDProfileData *)profileData
+                           googleUser:(nullable GIDGoogleUser *)googleUser
+             externalUserAgentSession:(nullable id<OIDExternalUserAgentSession>)userAgentSession
+                           emmSupport:(nullable NSString *)emmSupport
+                                error:(nullable NSError *)error;
 
 @end
 

+ 42 - 0
GoogleSignIn/Sources/GIDAuthorizationFlow/Implementations/Fake/GIDAuthorizationFlowFake.h

@@ -0,0 +1,42 @@
+/*
+ * Copyright 2025 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#import <Foundation/Foundation.h>
+#import "GoogleSignIn/Sources/GIDAuthorizationFlow/API/GIDAuthorizationFlowCoordinator.h"
+
+@class GIDConfiguration;
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface GIDAuthorizationFlowFake : NSObject <GIDAuthorizationFlowCoordinator>
+
+@property(nonatomic, strong, nullable) OIDAuthState *authState;
+@property(nonatomic, strong, nullable) GIDProfileData *profileData;
+@property(nonatomic, strong, nullable) GIDSignInInternalOptions *options;
+@property(nonatomic, strong, nullable) GIDGoogleUser *googleUser;
+@property(nonatomic, strong, nullable) id<OIDExternalUserAgentSession> currentUserAgentSession;
+@property(nonatomic, copy, nullable) NSString *emmSupport;
+@property(nonatomic, strong, nullable) NSError *error;
+
+@property(nonatomic, strong, nullable) GIDConfiguration *configuration;
+@property(nonatomic, strong, nullable) OIDServiceConfiguration *serviceConfiguration;
+
++ (instancetype)fakeWithDefaultOptions;
++ (instancetype)fakeWithDefaultOptionsConfiguration:(GIDConfiguration *)configuration;
+
+@end
+
+NS_ASSUME_NONNULL_END

+ 85 - 0
GoogleSignIn/Sources/GIDAuthorizationFlow/Implementations/Fake/GIDAuthorizationFlowFake.m

@@ -0,0 +1,85 @@
+/*
+ * Copyright 2025 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#import "GIDAuthorizationFlowFake.h"
+#import "GoogleSignIn/Sources/Public/GoogleSignIn/GIDConfiguration.h"
+#import "GoogleSignIn/Sources/GIDSignInInternalOptions.h"
+#import "GoogleSignIn/Sources/GIDConfiguration_Private.h"
+
+@implementation GIDAuthorizationFlowFake
+
++ (instancetype)fakeWithDefaultOptions {
+  UIViewController *vc = [[UIViewController alloc] init];
+  GIDSignInInternalOptions *options = [GIDSignInInternalOptions defaultOptionsWithConfiguration:nil
+                                                                       presentingViewController:vc
+                                                                                      loginHint:nil
+                                                                                  addScopesFlow:NO
+                                                                                     completion:nil];
+  return [[self alloc] initWithSignInOptions:options
+                                   authState:nil
+                                 profileData:nil
+                                  googleUser:nil
+                    externalUserAgentSession:nil
+                                  emmSupport:nil
+                                       error:nil];
+}
+
++ (instancetype)fakeWithDefaultOptionsConfiguration:(GIDConfiguration *)configuration {
+  UIViewController *vc = [[UIViewController alloc] init];
+  GIDSignInInternalOptions *options =
+    [GIDSignInInternalOptions defaultOptionsWithConfiguration:configuration
+                                     presentingViewController:vc
+                                                    loginHint:nil
+                                                addScopesFlow:NO
+                                                   completion:nil];
+  return [[self alloc] initWithSignInOptions:options
+                                   authState:nil
+                                 profileData:nil
+                                  googleUser:nil
+                    externalUserAgentSession:nil
+                                  emmSupport:nil
+                                       error:nil];
+
+}
+
+- (instancetype)initWithSignInOptions:(GIDSignInInternalOptions *)options
+                            authState:(OIDAuthState *)authState
+                          profileData:(nullable GIDProfileData *)profileData
+                           googleUser:(nullable GIDGoogleUser *)googleUser
+             externalUserAgentSession:(nullable id<OIDExternalUserAgentSession>)userAgentSession
+                           emmSupport:(nullable NSString *)emmSupport
+                                error:(nullable NSError *)error {
+  self = [super init];
+  if (self) {
+    _options = options;
+    _authState = authState;
+    _profileData = profileData;
+    _googleUser = googleUser;
+    _currentUserAgentSession = userAgentSession;
+    _error = error;
+    _emmSupport = emmSupport;
+  }
+  return self;
+}
+- (void)authorize {
+  // TODO: Implement
+}
+
+- (void)authorizeInteractively {
+  // TODO: Implement
+}
+
+@end

+ 1 - 1
GoogleSignIn/Sources/GIDAuthorizationFlow/GIDAuthorizationFlow.h → GoogleSignIn/Sources/GIDAuthorizationFlow/Implementations/GIDAuthorizationFlow.h

@@ -16,7 +16,7 @@
 
 #import <Foundation/Foundation.h>
 #import "GoogleSignIn/Sources/GIDCallbackQueue.h"
-#import "GoogleSignIn/Sources/GIDAuthorizationFlow/GIDAuthorizationFlowCoordinator.h"
+#import "GoogleSignIn/Sources/GIDAuthorizationFlow/API/GIDAuthorizationFlowCoordinator.h"
 
 @class GIDConfiguration;
 @class GIDProfileData;

+ 8 - 8
GoogleSignIn/Sources/GIDAuthorizationFlow/GIDAuthorizationFlow.m → GoogleSignIn/Sources/GIDAuthorizationFlow/Implementations/GIDAuthorizationFlow.m

@@ -18,10 +18,10 @@
 #import "GoogleSignIn/Sources/Public/GoogleSignIn/GIDSignIn.h"
 #import "GoogleSignIn/Sources/Public/GoogleSignIn/GIDConfiguration.h"
 
-#import "GoogleSignIn/Sources/GIDAuthorizationFlow/Operations/GIDSaveAuthOperation.h"
-#import "GoogleSignIn/Sources/GIDAuthorizationFlow/Operations/GIDTokenFetchOperation.h"
-#import "GoogleSignIn/Sources/GIDAuthorizationFlow/Operations/GIDDecodeIDTokenOperation.h"
-#import "GoogleSignIn/Sources/GIDAuthorizationFlow/Operations/GIDAuthorizationCompletionOperation.h"
+#import "GoogleSignIn/Sources/GIDAuthorizationFlow/Implementations/Operations/GIDSaveAuthOperation.h"
+#import "GoogleSignIn/Sources/GIDAuthorizationFlow/Implementations/Operations/GIDTokenFetchOperation.h"
+#import "GoogleSignIn/Sources/GIDAuthorizationFlow/Implementations/Operations/GIDDecodeIDTokenOperation.h"
+#import "GoogleSignIn/Sources/GIDAuthorizationFlow/Implementations/Operations/GIDAuthorizationCompletionOperation.h"
 
 #import "GoogleSignIn/Sources/GIDEMMErrorHandler.h"
 #import "GoogleSignIn/Sources/GIDEMMSupport.h"
@@ -68,10 +68,10 @@
 
 - (void)authorize {
   GIDTokenFetchOperation *tokenFetch =
-  [[GIDTokenFetchOperation alloc] initWithAuthState:self.authState
-                                            options:self.options
-                                         emmSupport:self.emmSupport
-                                              error:self.error];
+    [[GIDTokenFetchOperation alloc] initWithAuthState:self.authState
+                                              options:self.options
+                                           emmSupport:self.emmSupport
+                                                error:self.error];
   GIDDecodeIDTokenOperation *idToken = [[GIDDecodeIDTokenOperation alloc] init];
   [idToken addDependency:tokenFetch];
   GIDSaveAuthOperation *saveAuth = [[GIDSaveAuthOperation alloc] init];

+ 0 - 0
GoogleSignIn/Sources/GIDAuthorizationFlow/Operations/GIDAuthorizationCompletionOperation.h → GoogleSignIn/Sources/GIDAuthorizationFlow/Implementations/Operations/GIDAuthorizationCompletionOperation.h


+ 2 - 2
GoogleSignIn/Sources/GIDAuthorizationFlow/Operations/GIDAuthorizationCompletionOperation.m → GoogleSignIn/Sources/GIDAuthorizationFlow/Implementations/Operations/GIDAuthorizationCompletionOperation.m

@@ -9,9 +9,9 @@
 
 #import "GoogleSignIn/Sources/GIDSignIn_Private.h"
 #import "GoogleSignIn/Sources/GIDSignInResult_Private.h"
-#import "GoogleSignIn/Sources/GIDAuthorizationFlow/Operations/GIDSaveAuthOperation.h"
+#import "GoogleSignIn/Sources/GIDAuthorizationFlow/Implementations/Operations/GIDSaveAuthOperation.h"
 #import "GoogleSignIn/Sources/GIDSignInInternalOptions.h"
-#import "GoogleSignIn/Sources/GIDAuthorizationFlow/GIDAuthorizationFlow.h"
+#import "GoogleSignIn/Sources/GIDAuthorizationFlow/Implementations/GIDAuthorizationFlow.h"
 
 #ifdef SWIFT_PACKAGE
 @import AppAuth;

+ 0 - 0
GoogleSignIn/Sources/GIDAuthorizationFlow/Operations/GIDDecodeIDTokenOperation.h → GoogleSignIn/Sources/GIDAuthorizationFlow/Implementations/Operations/GIDDecodeIDTokenOperation.h


+ 1 - 1
GoogleSignIn/Sources/GIDAuthorizationFlow/Operations/GIDDecodeIDTokenOperation.m → GoogleSignIn/Sources/GIDAuthorizationFlow/Implementations/Operations/GIDDecodeIDTokenOperation.m

@@ -8,7 +8,7 @@
 #import "GIDDecodeIDTokenOperation.h"
 #import "GoogleSignIn/Sources/Public/GoogleSignIn/GIDProfileData.h"
 
-#import "GoogleSignIn/Sources/GIDAuthorizationFlow/Operations/GIDTokenFetchOperation.h"
+#import "GoogleSignIn/Sources/GIDAuthorizationFlow/Implementations/Operations/GIDTokenFetchOperation.h"
 #import "GoogleSignIn/Sources/GIDProfileData_Private.h"
 #import "GoogleSignIn/Sources/GIDSignInConstants.h"
 #import "GoogleSignIn/Sources/GIDSignInPreferences.h"

+ 0 - 0
GoogleSignIn/Sources/GIDAuthorizationFlow/Operations/GIDSaveAuthOperation.h → GoogleSignIn/Sources/GIDAuthorizationFlow/Implementations/Operations/GIDSaveAuthOperation.h


+ 1 - 1
GoogleSignIn/Sources/GIDAuthorizationFlow/Operations/GIDSaveAuthOperation.m → GoogleSignIn/Sources/GIDAuthorizationFlow/Implementations/Operations/GIDSaveAuthOperation.m

@@ -10,7 +10,7 @@
 #import "GoogleSignIn/Sources/Public/GoogleSignIn/GIDSignIn.h"
 #import "GoogleSignIn/Sources/Public/GoogleSignIn/GIDGoogleUser.h"
 
-#import "GoogleSignIn/Sources/GIDAuthorizationFlow/Operations/GIDDecodeIDTokenOperation.h"
+#import "GoogleSignIn/Sources/GIDAuthorizationFlow/Implementations/Operations/GIDDecodeIDTokenOperation.h"
 #import "GoogleSignIn/Sources/GIDGoogleUser_Private.h"
 #import "GoogleSignIn/Sources/GIDSignInConstants.h"
 #import "GoogleSignIn/Sources/GIDSignInInternalOptions.h"

+ 0 - 0
GoogleSignIn/Sources/GIDAuthorizationFlow/Operations/GIDTokenFetchOperation.h → GoogleSignIn/Sources/GIDAuthorizationFlow/Implementations/Operations/GIDTokenFetchOperation.h


+ 0 - 0
GoogleSignIn/Sources/GIDAuthorizationFlow/Operations/GIDTokenFetchOperation.m → GoogleSignIn/Sources/GIDAuthorizationFlow/Implementations/Operations/GIDTokenFetchOperation.m


+ 16 - 5
GoogleSignIn/Sources/GIDAuthorization_Private.h

@@ -32,15 +32,15 @@ NS_ASSUME_NONNULL_BEGIN
 
 /// Private initializer taking a `GTMKeychainStore` and a `GIDConfiguration`.
 ///
-/// If `configuration` is nil, then a default configuration is generated from values in the `Info.plist`.
-- (instancetype)initWithKeychainStore:(GTMKeychainStore *)keychainStore
+/// If `keychainStore` or `configuration` are nil, then a default is generated.
+- (instancetype)initWithKeychainStore:(nullable GTMKeychainStore *)keychainStore
                         configuration:(nullable GIDConfiguration *)configuration;
 
 /// Private initializer taking a `GTMKeychainStore`, `GIDConfiguration` and a `GIDAuthorizationFlowCoordinator`.
 ///
-/// If `configuration` is nil, then a default configuration is generated from values in the `Info.plist`. If a nil
+/// If `keychainStore` or `configuration` are nil, then a default is generated. If a nil
 /// `GIDAuthorizationFlowCoordinator` conforming instance is provided, then one will be created during the authorization flow.
-- (instancetype)initWithKeychainStore:(GTMKeychainStore *)keychainStore
+- (instancetype)initWithKeychainStore:(nullable GTMKeychainStore *)keychainStore
                         configuration:(nullable GIDConfiguration *)configuration
          authorizationFlowCoordinator:(nullable id<GIDAuthorizationFlowCoordinator>)authFlow;
 
@@ -54,6 +54,16 @@ NS_ASSUME_NONNULL_BEGIN
 /// Authenticates in with the provided options.
 - (void)signInWithOptions:(GIDSignInInternalOptions *)options;
 
+/// Asserts that the current `GIDConfiguration` contains a a client ID.
+///
+/// Throws an exception if no client ID is found in the configuration.
+- (void)assertValidParameters;
+
+/// Asserts that the current `GIDSignInInternalOptions` has a valid presenting controller.
+///
+/// Throws an exception if the current options do not contain a presenting controller.
+- (void)assertValidPresentingController;
+
 /// The current configuration used for authorization.
 @property(nonatomic, nullable) GIDConfiguration *currentConfiguration;
 
@@ -62,7 +72,8 @@ NS_ASSUME_NONNULL_BEGIN
 
 /// Options used when sign-in flows are resumed via the handling of a URL.
 ///
-/// Options are set when a sign-in flow is begun via |signInWithOptions:| when the options passed don't represent a sign in continuation.
+/// Options are set when a sign-in flow is begun via `signInWithOptions:` when the options passed don't represent a sign in
+/// continuation.
 @property(nonatomic, nullable) GIDSignInInternalOptions *currentOptions;
 
 /// The `GIDAuthorizationFlowCoordinator` conforming type managing the authorization flow.

+ 59 - 0
GoogleSignIn/Tests/Unit/GIDAuthorizationTests/GIDAuthorizationTest.m

@@ -0,0 +1,59 @@
+//
+//  GIDAuthorizationTest.m
+//  GoogleSignIn
+//
+//  Created by Matt Mathias on 4/7/25.
+//
+
+#import <XCTest/XCTest.h>
+#import "GoogleSignIn/Sources/Public/GoogleSignIn/GIDAuthorization.h"
+#import "GoogleSignIn/Sources/GIDAuthorization_Private.h"
+#import "GoogleSignIn/Tests/Unit/GIDConfiguration+Testing.h"
+#import "GoogleSignIn/Tests/Unit/OIDAuthorizationRequest+Testing.h"
+
+#import "GoogleSignIn/Sources/GIDAuthorizationFlow/Implementations/Fake/GIDAuthorizationFlowFake.h"
+
+@interface GIDAuthorizationTest : XCTestCase
+
+@end
+
+@implementation GIDAuthorizationTest
+
+- (void)testAuthorizationConfigurationAssertValidParameters {
+  GIDConfiguration *configuration =
+    [[GIDConfiguration alloc] initWithClientID:OIDAuthorizationRequestTestingClientID
+                                serverClientID:kServerClientID
+                                  hostedDomain:kHostedDomain
+                                   openIDRealm:kOpenIDRealm];
+  GIDAuthorizationFlowFake *fakeFlow =
+    [GIDAuthorizationFlowFake fakeWithDefaultOptionsConfiguration:configuration];
+  GIDAuthorization *authorization =
+    [[GIDAuthorization alloc] initWithKeychainStore:nil
+                                      configuration:configuration
+                       authorizationFlowCoordinator:fakeFlow];
+  
+  @try {
+    [authorization assertValidParameters];
+  }
+  @catch (NSException *exception) {
+    XCTFail(@"`authorization` should have valid parameters.");
+  }
+  @finally {}
+}
+
+- (void)testAuthorizationConfigurationAssertValidPresentingController {
+  GIDAuthorizationFlowFake *fakeFlow = [GIDAuthorizationFlowFake fakeWithDefaultOptions];
+  GIDAuthorization *authorization =
+    [[GIDAuthorization alloc] initWithKeychainStore:nil
+                                      configuration:nil
+                       authorizationFlowCoordinator:fakeFlow];
+  @try {
+    [authorization assertValidPresentingController];
+  }
+  @catch (NSException *exception) {
+    XCTFail(@"`authorization` should have a valid presenting controller.");
+  }
+  @finally {}
+}
+
+@end