Skip to content

Commit 89649b1

Browse files
committed
Improve style.
1 parent 2d60ea9 commit 89649b1

File tree

3 files changed

+31
-21
lines changed

3 files changed

+31
-21
lines changed

GoogleSignIn/Sources/GIDAuthorizationFlowProcessor/Implementations/Fakes/GIDFakeAuthorizationFlowProcessor.h

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,14 @@
1818

1919
#import "GoogleSignIn/Sources/GIDAuthorizationFlowProcessor/API/GIDAuthorizationFlowProcessor.h"
2020

21-
#ifdef SWIFT_PACKAGE
22-
@import AppAuth;
23-
#else
24-
#import <AppAuth/AppAuth.h>
25-
#endif
21+
@class OIDAuthorizationResponse;
2622

2723
NS_ASSUME_NONNULL_BEGIN
2824

2925
/// The block type providing the response for the method `startWithOptions:emmSupport:completion:`.
3026
///
31-
/// @param authorizationResponse The OIDAuthorizationResponse object returned if succeeded.
32-
/// @param error The error returned if failed.
27+
/// @param authorizationResponse The `OIDAuthorizationResponse` object returned on success.
28+
/// @param error The error returned on failure.
3329
typedef void(^GIDAuthorizationFlowProcessorFakeResponseProviderBlock)
3430
(OIDAuthorizationResponse *_Nullable authorizationResponse, NSError *_Nullable error);
3531

@@ -40,12 +36,12 @@ typedef void(^GIDAuthorizationFlowProcessorFakeResponseProviderBlock)
4036
typedef void (^GIDAuthorizationFlowProcessorTestBlock)
4137
(GIDAuthorizationFlowProcessorFakeResponseProviderBlock responseProvider);
4238

39+
/// The fake implementation of the protocol `GIDAuthorizationFlowProcessor`.
4340
@interface GIDFakeAuthorizationFlowProcessor : NSObject <GIDAuthorizationFlowProcessor>
4441

4542
/// The test block which provides the response value.
4643
@property(nonatomic) GIDAuthorizationFlowProcessorTestBlock testBlock;
4744

48-
4945
@end
5046

5147
NS_ASSUME_NONNULL_END

GoogleSignIn/Sources/GIDAuthorizationFlowProcessor/Implementations/Fakes/GIDFakeAuthorizationFlowProcessor.m

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,27 @@
1+
/*
2+
* Copyright 2023 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
117
#import "GoogleSignIn/Sources/GIDAuthorizationFlowProcessor/Implementations/Fakes/GIDFakeAuthorizationFlowProcessor.h"
218

19+
#ifdef SWIFT_PACKAGE
20+
@import AppAuth;
21+
#else
22+
#import <AppAuth/AppAuth.h>
23+
#endif
24+
325
@implementation GIDFakeAuthorizationFlowProcessor
426

527
- (void)startWithOptions:(GIDSignInInternalOptions *)options
@@ -8,7 +30,6 @@ - (void)startWithOptions:(GIDSignInInternalOptions *)options
830
NSError *_Nullable error))completion {
931
NSAssert(self.testBlock != nil, @"Set the test block before invoking this method.");
1032

11-
1233
self.testBlock(^(OIDAuthorizationResponse *authorizationResponse, NSError *error) {
1334
completion(authorizationResponse, error);
1435
});

GoogleSignIn/Tests/Unit/GIDSignInTest.m

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
// Test module imports
2727
@import GoogleSignIn;
2828

29+
#import "GoogleSignIn/Sources/GIDAuthorizationFlowProcessor/API/GIDAuthorizationFlowProcessor.h"
2930
#import "GoogleSignIn/Sources/GIDAuthorizationFlowProcessor/Implementations/Fakes/GIDFakeAuthorizationFlowProcessor.h"
3031
#import "GoogleSignIn/Sources/GIDEMMSupport.h"
3132
#import "GoogleSignIn/Sources/GIDGoogleUser_Private.h"
@@ -192,7 +193,7 @@ @interface GIDSignInTest : XCTestCase {
192193
// Fake for `GIDHTTPFetcher`.
193194
GIDFakeHTTPFetcher *_httpFetcher;
194195

195-
// Fake for `GIDAuthorizationFlowProcessor`
196+
// Fake for `GIDAuthorizationFlowProcessor`.
196197
GIDFakeAuthorizationFlowProcessor *_authorizationFlowProcessor;
197198

198199
// Fake for `GIDProfileDataFetcher`.
@@ -281,14 +282,6 @@ - (void)setUp {
281282
OCMStub([_authorization initWithAuthState:OCMOCK_ANY]).andReturn(_authorization);
282283
_user = OCMStrictClassMock([GIDGoogleUser class]);
283284
_oidAuthorizationService = OCMStrictClassMock([OIDAuthorizationService class]);
284-
// OCMStub([_oidAuthorizationService
285-
// presentAuthorizationRequest:OCMOCK_ANY
286-
//#if TARGET_OS_IOS || TARGET_OS_MACCATALYST
287-
// presentingViewController:SAVE_TO_ARG_BLOCK(self->_savedPresentingViewController)
288-
//#elif TARGET_OS_OSX
289-
// presentingWindow:SAVE_TO_ARG_BLOCK(self->_savedPresentingWindow)
290-
//#endif // TARGET_OS_IOS || TARGET_OS_MACCATALYST
291-
// callback:COPY_TO_ARG_BLOCK(self->_savedAuthorizationCallback)]);
292285
OCMStub([self->_oidAuthorizationService
293286
performTokenRequest:SAVE_TO_ARG_BLOCK(self->_savedTokenRequest)
294287
callback:COPY_TO_ARG_BLOCK(self->_savedTokenCallback)]);
@@ -1054,9 +1047,9 @@ - (void)OAuthLoginWithAddScopesFlow:(BOOL)addScopesFlow
10541047
// Set the response for `GIDProfileDataFetcher`.
10551048
GIDProfileDataFetcherTestBlock profileDataFetcherTestBlock =
10561049
^(GIDProfileDataFetcherFakeResponseProvider responseProvider) {
1057-
GIDProfileData *profileData = [GIDProfileData testInstance];
1058-
responseProvider(profileData, nil);
1059-
};
1050+
GIDProfileData *profileData = [GIDProfileData testInstance];
1051+
responseProvider(profileData, nil);
1052+
};
10601053

10611054
_profileDataFetcher.testBlock = profileDataFetcherTestBlock;
10621055

0 commit comments

Comments
 (0)