GIDFakeProfileDataFetcher.m 1.2 KB

1234567891011121314151617181920212223242526272829303132333435
  1. #import "GoogleSignIn/Sources/GIDProfileDataFetcher/Implementations/Fakes/GIDFakeProfileDataFetcher.h"
  2. #import "GoogleSignIn/Sources/Public/GoogleSignIn/GIDProfileData.h"
  3. #ifdef SWIFT_PACKAGE
  4. @import AppAuth;
  5. #else
  6. #import <AppAuth/AppAuth.h>
  7. #endif
  8. NS_ASSUME_NONNULL_BEGIN
  9. @implementation GIDFakeProfileDataFetcher
  10. - (void)fetchProfileDataWithAuthState:(OIDAuthState *)authState
  11. completion:(void (^)(GIDProfileData *_Nullable profileData,
  12. NSError *_Nullable error))completion {
  13. NSAssert(self.testBlock != nil, @"Set the test block before invoking this method.");
  14. self.testBlock(^(GIDProfileData *_Nullable profileData, NSError *_Nullable error) {
  15. completion(profileData, error);
  16. });
  17. }
  18. - (nullable GIDProfileData *)fetchProfileDataWithIDToken:(OIDIDToken *)idToken {
  19. NSAssert(self.testBlock != nil, @"Set the test block before invoking this method.");
  20. __block GIDProfileData *profileDataToReturn;
  21. self.testBlock(^(GIDProfileData *_Nullable profileData, NSError *_Nullable error) {
  22. profileDataToReturn = profileData;
  23. });
  24. return profileDataToReturn;
  25. }
  26. @end
  27. NS_ASSUME_NONNULL_END