GIDFakeFetcherService.m 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. // Copyright 2021 Google LLC
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. #import "GoogleSignIn/Tests/Unit/GIDFakeFetcherService.h"
  15. #import "GoogleSignIn/Tests/Unit/GIDFakeFetcher.h"
  16. @implementation GIDFakeFetcherService {
  17. NSMutableArray *_fetchers;
  18. }
  19. @synthesize delegateQueue;
  20. @synthesize callbackQueue;
  21. @synthesize reuseSession;
  22. - (instancetype)init {
  23. self = [super init];
  24. if (self) {
  25. _fetchers = [[NSMutableArray alloc] init];
  26. }
  27. return self;
  28. }
  29. #pragma clang diagnostic push
  30. #pragma clang diagnostic ignored "-Wdeprecated"
  31. - (instancetype)initWithAuthorizer:(id<GTMFetcherAuthorizationProtocol>)authorizer {
  32. #pragma clang diagnostic pop
  33. self = [self init];
  34. if (self) {
  35. self.authorizer = authorizer;
  36. }
  37. return self;
  38. }
  39. - (BOOL)fetcherShouldBeginFetching:(GTMSessionFetcher *)fetcher {
  40. return YES;
  41. }
  42. - (void)fetcherDidCreateSession:(GTMSessionFetcher *)fetcher {
  43. }
  44. - (void)fetcherDidBeginFetching:(GTMSessionFetcher *)fetcher {
  45. }
  46. - (void)fetcherDidStop:(GTMSessionFetcher *)fetcher {
  47. }
  48. - (BOOL)isDelayingFetcher:(GTMSessionFetcher *)fetcher {
  49. return NO;
  50. }
  51. - (GTMSessionFetcher *)fetcherWithRequest:(NSURLRequest *)request {
  52. GIDFakeFetcher *fetcher = [[GIDFakeFetcher alloc] initWithRequest:request
  53. authorizer:self.authorizer];
  54. [_fetchers addObject:fetcher];
  55. return fetcher;
  56. }
  57. - (NSURLSession *)session {
  58. return nil;
  59. }
  60. - (NSURLSession *)sessionForFetcherCreation {
  61. return nil;
  62. }
  63. - (id<NSURLSessionDelegate>)sessionDelegate {
  64. return nil;
  65. }
  66. - (NSArray *)fetchers {
  67. return _fetchers;
  68. }
  69. - (NSDate *)stoppedAllFetchersDate {
  70. return nil;
  71. }
  72. @end