-
Notifications
You must be signed in to change notification settings - Fork 245
Add fake for GIDAuthorizationFlowProcessor #287
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Alex-4-Git
wants to merge
16
commits into
refactorGSI
Choose a base branch
from
pin-GIDAuthorizationFlowProcessor-fake
base: refactorGSI
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 12 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
1463c4a
Add GIDAuthorizationProcessor API and implementation.
Alex-4-Git e856b98
Merge branch 'refactorGSI' into pin-GIDAuthorizationFlowProcessor
Alex-4-Git 7003139
Use GIDAuthorizationFlowProcessor in GIDSignIn
Alex-4-Git 0e80a9d
Add test for GIDAuthorizationFlowProcessor.
Alex-4-Git ec80960
Improve style.
Alex-4-Git 3564b01
Add GIDFakeAuthorizationFlowProcessor
Alex-4-Git 25b266a
Merge branch 'refactorGSI' into pin-GIDAuthorizationFlowProcessor-fake
Alex-4-Git 69aa820
Blocked by another PR to create and test OIDAuthorizationRequest.
Alex-4-Git f7ce004
Merge branch 'refactorGSI' into pin-GIDAuthorizationFlowProcessor-fake
Alex-4-Git 2d60ea9
Fix GIDSignInTest
Alex-4-Git 89649b1
Improve style.
Alex-4-Git 7e76eae
More cleanup.
Alex-4-Git df7f780
Improve style.
Alex-4-Git 0ae1e7f
Uncommented the existing verification line.
henryhl22321 0b143d5
Remove macos-11 runner
mdmathias 21745e4
Update name of return button
mdmathias File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
48 changes: 48 additions & 0 deletions
48
...s/GIDAuthorizationFlowProcessor/Implementations/Fakes/GIDFakeAuthorizationFlowProcessor.h
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| /* | ||
| * Copyright 2023 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/GIDAuthorizationFlowProcessor/API/GIDAuthorizationFlowProcessor.h" | ||
|
|
||
| @class OIDAuthorizationResponse; | ||
|
|
||
| NS_ASSUME_NONNULL_BEGIN | ||
|
|
||
| /// The block type providing the response for the method `startWithOptions:emmSupport:completion:`. | ||
| /// | ||
| /// @param authorizationResponse The `OIDAuthorizationResponse` object returned on success. | ||
| /// @param error The error returned on failure. | ||
| typedef void(^GIDAuthorizationFlowProcessorFakeResponseProviderBlock) | ||
| (OIDAuthorizationResponse *_Nullable authorizationResponse, NSError *_Nullable error); | ||
|
|
||
| /// The block type setting up response value for the method | ||
| /// `startWithOptions:emmSupport:completion:`. | ||
| /// | ||
| /// @param responseProvider The block which provides the response. | ||
| typedef void (^GIDAuthorizationFlowProcessorTestBlock) | ||
| (GIDAuthorizationFlowProcessorFakeResponseProviderBlock responseProvider); | ||
|
|
||
| /// The fake implementation of the protocol `GIDAuthorizationFlowProcessor`. | ||
| @interface GIDFakeAuthorizationFlowProcessor : NSObject <GIDAuthorizationFlowProcessor> | ||
|
|
||
| /// The test block which provides the response value. | ||
| @property(nonatomic) GIDAuthorizationFlowProcessorTestBlock testBlock; | ||
|
|
||
| @end | ||
|
|
||
| NS_ASSUME_NONNULL_END | ||
|
|
||
52 changes: 52 additions & 0 deletions
52
...s/GIDAuthorizationFlowProcessor/Implementations/Fakes/GIDFakeAuthorizationFlowProcessor.m
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| /* | ||
| * Copyright 2023 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 "GoogleSignIn/Sources/GIDAuthorizationFlowProcessor/Implementations/Fakes/GIDFakeAuthorizationFlowProcessor.h" | ||
|
|
||
| #ifdef SWIFT_PACKAGE | ||
| @import AppAuth; | ||
| #else | ||
| #import <AppAuth/AppAuth.h> | ||
| #endif | ||
|
|
||
| @implementation GIDFakeAuthorizationFlowProcessor | ||
|
|
||
| - (void)startWithOptions:(GIDSignInInternalOptions *)options | ||
| emmSupport:(nullable NSString *)emmSupport | ||
| completion:(void (^)(OIDAuthorizationResponse *_Nullable authorizationResponse, | ||
| NSError *_Nullable error))completion { | ||
| NSAssert(self.testBlock != nil, @"Set the test block before invoking this method."); | ||
Alex-4-Git marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| self.testBlock(^(OIDAuthorizationResponse *authorizationResponse, NSError *error) { | ||
| completion(authorizationResponse, error); | ||
| }); | ||
| } | ||
|
|
||
| - (BOOL)isStarted { | ||
| NSAssert(NO, @"Not implemented."); | ||
| return YES; | ||
| } | ||
|
|
||
| - (BOOL)resumeExternalUserAgentFlowWithURL:(NSURL *)url { | ||
| NSAssert(NO, @"Not implemented."); | ||
| return YES; | ||
| } | ||
|
|
||
| - (void)cancelAuthenticationFlow { | ||
| NSAssert(NO, @"Not implemented."); | ||
| } | ||
|
|
||
| @end | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.