pinlu 3 лет назад
Родитель
Сommit
ec80960856

+ 1 - 0
GoogleSignIn/Sources/GIDAuthorizationFlowProcessor/API/GIDAuthorizationFlowProcessor.h

@@ -30,6 +30,7 @@ NS_ASSUME_NONNULL_BEGIN
 ///
 /// @param options The @GIDSignInInternalOptions object to provide serverClientID, hostedDomain,
 ///     clientID, scopes, loginHint and extraParams.
+/// @param emmSupport The EMM support info string.
 /// @param completion The block that is called on completion asynchronously.
 - (void)startWithOptions:(GIDSignInInternalOptions *)options
               emmSupport:(nullable NSString *)emmSupport

+ 1 - 4
GoogleSignIn/Sources/GIDAuthorizationFlowProcessor/Implementations/GIDAuthorizationFlowProcessor.m

@@ -45,8 +45,6 @@ static NSString *const kHostedDomainParameter = @"hd";
   OIDServiceConfiguration *_appAuthConfiguration;
 }
 
-@synthesize start;
-
 # pragma mark - Public API
 
 - (BOOL)isStarted {
@@ -74,7 +72,6 @@ static NSString *const kHostedDomainParameter = @"hd";
   if (options.configuration.hostedDomain) {
     additionalParameters[kHostedDomainParameter] = options.configuration.hostedDomain;
   }
-
 #if TARGET_OS_IOS && !TARGET_OS_MACCATALYST
   [additionalParameters addEntriesFromDictionary:
       [GIDEMMSupport parametersWithParameters:options.extraParams
@@ -91,7 +88,6 @@ static NSString *const kHostedDomainParameter = @"hd";
   OIDServiceConfiguration *appAuthConfiguration =
       [[OIDServiceConfiguration alloc] initWithAuthorizationEndpoint:authorizationEndpointURL
                                                        tokenEndpoint:tokenEndpointURL];
-
   OIDAuthorizationRequest *request =
       [[OIDAuthorizationRequest alloc] initWithConfiguration:appAuthConfiguration
                                                     clientId:options.configuration.clientID
@@ -99,6 +95,7 @@ static NSString *const kHostedDomainParameter = @"hd";
                                                  redirectURL:redirectURL
                                                 responseType:OIDResponseTypeCode
                                         additionalParameters:additionalParameters];
+  
   _currentAuthorizationFlow = [OIDAuthorizationService
       presentAuthorizationRequest:request
 #if TARGET_OS_IOS || TARGET_OS_MACCATALYST

+ 1 - 1
GoogleSignIn/Sources/GIDSignIn.m

@@ -452,7 +452,7 @@ static NSString *const kConfigOpenIDRealmKey = @"GIDOpenIDRealm";
   id<GIDKeychainHandler> keychainHandler = [[GIDKeychainHandler alloc] init];
   id<GIDHTTPFetcher> httpFetcher = [[GIDHTTPFetcher alloc] init];
   id<GIDAuthorizationFlowProcessor> authorizationFlowProcessor =
-  [[GIDAuthorizationFlowProcessor alloc] init];
+      [[GIDAuthorizationFlowProcessor alloc] init];
   return [self initWithKeychainHandler:keychainHandler
                            httpFetcher:httpFetcher
             authorizationFlowProcessor:authorizationFlowProcessor];

+ 7 - 7
GoogleSignIn/Tests/Unit/GIDAuthorizationFlowProcessorTest.m

@@ -60,7 +60,7 @@ static NSInteger const kErrorCode = 400;
           ]).andReturn(_externalUserAgentSession);
 }
 
-- (void)testStartAndCancelAuthorizationFlow {
+- (void)testStartAndCancelAuthorizationFlow_success {
   XCTestExpectation *expectation = [self expectationWithDescription:@"completion is invoked."];
   GIDSignInInternalOptions *options = [[GIDSignInInternalOptions alloc] init];
   [_authorizationFlowProcessor startWithOptions:options
@@ -77,8 +77,6 @@ static NSInteger const kErrorCode = 400;
 }
 
 - (void)testStartAndResumeAuthorizationFlow_success {
-  OCMStub([_externalUserAgentSession resumeExternalUserAgentFlowWithURL:[OCMArg any]])
-    .andReturn(YES);
   XCTestExpectation *expectation = [self expectationWithDescription:@"completion is invoked."];
   GIDSignInInternalOptions *options = [[GIDSignInInternalOptions alloc] init];
   [_authorizationFlowProcessor startWithOptions:options
@@ -90,14 +88,14 @@ static NSInteger const kErrorCode = 400;
   [self waitForExpectationsWithTimeout:1 handler:nil];
   XCTAssertTrue(_authorizationFlowProcessor.isStarted);
   
+  OCMStub([_externalUserAgentSession resumeExternalUserAgentFlowWithURL:[OCMArg any]])
+      .andReturn(YES);
   NSURL *url = [[NSURL alloc] initWithString:kFakeURL];
   [_authorizationFlowProcessor resumeExternalUserAgentFlowWithURL:url];
   XCTAssertFalse(_authorizationFlowProcessor.isStarted);
 }
 
-- (void)testStartAndResumeAuthorizationFlow_fail {
-  OCMStub([_externalUserAgentSession resumeExternalUserAgentFlowWithURL:[OCMArg any]])
-    .andReturn(NO);
+- (void)testStartAndFailToResumeAuthorizationFlow {
   XCTestExpectation *expectation = [self expectationWithDescription:@"completion is invoked."];
   GIDSignInInternalOptions *options = [[GIDSignInInternalOptions alloc] init];
   [_authorizationFlowProcessor startWithOptions:options
@@ -108,7 +106,9 @@ static NSInteger const kErrorCode = 400;
   }];
   [self waitForExpectationsWithTimeout:1 handler:nil];
   XCTAssertTrue(_authorizationFlowProcessor.isStarted);
-  
+ 
+  OCMStub([_externalUserAgentSession resumeExternalUserAgentFlowWithURL:[OCMArg any]])
+      .andReturn(NO);
   NSURL *url = [[NSURL alloc] initWithString:kFakeURL];
   [_authorizationFlowProcessor resumeExternalUserAgentFlowWithURL:url];
   XCTAssertTrue(_authorizationFlowProcessor.isStarted);