Skip to content

Commit 1704e7f

Browse files
committed
update fake and create test
1 parent 19c1568 commit 1704e7f

8 files changed

Lines changed: 60 additions & 308 deletions

File tree

GoogleSignIn/Sources/GIDAuthStateMigration/Fake/GIDFakeAuthStateMigration.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,14 @@
1414
* limitations under the License.
1515
*/
1616

17-
#import "GoogleSignIn/Sources/GIDAuthStateMigration.h"
17+
#import "GoogleSignIn/Sources/GIDAuthStateMigration/GIDAuthStateMigration.h"
1818

1919
/// A fake |GIDAuthStateMigration| for testing.
2020
@interface GIDFakeAuthStateMigration : GIDAuthStateMigration
2121

22+
/// Callback that is called when `migrateIfNeededWithTokenURL` is invoked.
23+
@property (nonatomic, nullable) void (^migrationInvokedCallback)
24+
(NSURL * _Nullable tokenURL, NSString * _Nullable callbackPath, NSString * _Nullable keychainName,
25+
BOOL isFreshInstall);
26+
2227
@end

GoogleSignIn/Sources/GIDAuthStateMigration/Fake/GIDFakeAuthStateMigration.m

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,15 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
#import "GoogleSignIn/Tests/Unit/GIDFakeAuthStateMigration.h"
16+
#import "GoogleSignIn/Sources/GIDAuthStateMigration/Fake/GIDFakeAuthStateMigration.h"
1717

1818

1919
NS_ASSUME_NONNULL_BEGIN
2020

2121
@implementation GIDFakeAuthStateMigration
2222

23+
@synthesize migrationInvokedCallback = _migrationInvokedCallback;
24+
2325
- (instancetype)initWithKeychainStore:(GTMKeychainStore *)keychainStore {
2426
self = [super initWithKeychainStore:keychainStore];
2527
return self;
@@ -33,6 +35,9 @@ - (void)migrateIfNeededWithTokenURL:(NSURL *)tokenURL
3335
callbackPath:(NSString *)callbackPath
3436
keychainName:(NSString *)keychainName
3537
isFreshInstall:(BOOL)isFreshInstall {
38+
if (_migrationInvokedCallback) {
39+
_migrationInvokedCallback(tokenURL, callbackPath, keychainName, isFreshInstall);
40+
}
3641
return;
3742
}
3843

GoogleSignIn/Sources/GIDAuthStateMigration/GIDAuthStateMigration.m

Lines changed: 0 additions & 253 deletions
This file was deleted.

GoogleSignIn/Sources/GIDAuthStateMigration/Implementation/GIDAuthStateMigration.h

Lines changed: 0 additions & 38 deletions
This file was deleted.

0 commit comments

Comments
 (0)