shell_auth_service_fake.m 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. // Copyright 2018 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #import "ios/web_view/shell/shell_auth_service.h"
  5. #if !defined(__has_feature) || !__has_feature(objc_arc)
  6. #error "This file requires ARC support."
  7. #endif
  8. // Fake implementation of ShellAuthService.
  9. @implementation ShellAuthService
  10. - (NSArray<CWVIdentity*>*)identities {
  11. return @[];
  12. }
  13. #pragma mark CWVSyncControllerDataSource
  14. - (void)fetchAccessTokenForIdentity:(CWVIdentity*)identity
  15. scopes:(NSArray<NSString*>*)scopes
  16. completionHandler:
  17. (void (^)(NSString* _Nullable accessToken,
  18. NSDate* _Nullable expirationDate,
  19. NSError* _Nullable error))completionHandler {
  20. // Always returns an error.
  21. if (completionHandler) {
  22. completionHandler(
  23. nil, nil,
  24. [NSError errorWithDomain:@"org.chromium.chromewebview.shell"
  25. code:0
  26. userInfo:nil]);
  27. }
  28. }
  29. - (NSArray<CWVIdentity*>*)allKnownIdentities {
  30. return [self identities];
  31. }
  32. - (CWVSyncError)syncErrorForNSError:(NSError*)error
  33. identity:(CWVIdentity*)identity {
  34. return CWVSyncErrorUnexpectedServiceResponse;
  35. }
  36. @end