فهرست منبع

Remove GIDFakeFetcher and GIDFakeFetcherService.

Use GTMSessionFetcherTestBlock to provide value returned from GTMSessionFetcher. We no longer need our own fakes.
pinlu 3 سال پیش
والد
کامیت
e69f9ad1c0

+ 0 - 33
GoogleSignIn/Tests/Unit/GIDFakeFetcher.h

@@ -1,33 +0,0 @@
-/*
- * Copyright 2021 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.
- */
-
-#ifdef SWIFT_PACKAGE
-@import GTMSessionFetcherCore;
-#else
-#import <GTMSessionFetcher/GTMSessionFetcher.h>
-#endif
-
-// A fake |GTMHTTPFetcher| for testing.
-@interface GIDFakeFetcher : GTMSessionFetcher
-
-// The URL of the fetching request.
-- (NSURL *)requestURL;
-
-// Emulates server returning with data and/or error.
-- (void)didFinishWithData:(NSData *)data error:(NSError *)error;
-
-- (instancetype)initWithRequest:(NSURLRequest *)request;
-@end

+ 0 - 54
GoogleSignIn/Tests/Unit/GIDFakeFetcher.m

@@ -1,54 +0,0 @@
-// Copyright 2021 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/Tests/Unit/GIDFakeFetcher.h"
-
-typedef void (^FetchCompletionHandler)(NSData *, NSError *);
-
-@implementation GIDFakeFetcher {
-  FetchCompletionHandler _handler;
-  NSURL *_requestURL;
-}
-
-- (instancetype)initWithRequest:(NSURLRequest *)request {
-  self = [super initWithRequest:request configuration:nil];
-  if (self) {
-    _requestURL = [[request URL] copy];
-  }
-  return self;
-}
-
-
-- (void)beginFetchWithDelegate:(id)delegate didFinishSelector:(SEL)finishedSEL {
-  [NSException raise:@"NotImplementedException" format:@"Implement this method if it is used"];
-}
-
-- (void)beginFetchWithCompletionHandler:(FetchCompletionHandler)handler {
-  if (_handler) {
-    [NSException raise:NSInvalidArgumentException format:@"Attempted start fetch again"];
-  }
-  _handler = [handler copy];
-}
-
-- (NSURL *)requestURL {
-  return _requestURL;
-}
-
-- (void)didFinishWithData:(NSData *)data error:(NSError *)error {
-  FetchCompletionHandler handler = _handler;
-  _handler = nil;
-  handler(data, error);
-}
-
-@end

+ 0 - 29
GoogleSignIn/Tests/Unit/GIDFakeFetcherService.h

@@ -1,29 +0,0 @@
-/*
- * Copyright 2021 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.
- */
-
-#ifdef SWIFT_PACKAGE
-@import GTMSessionFetcherCore;
-#else
-#import <GTMSessionFetcher/GTMSessionFetcher.h>
-#endif
-
-// A fake |GTMHTTPFetcherService| for testing.
-@interface GIDFakeFetcherService : NSObject<GTMSessionFetcherServiceProtocol>
-
-// Returns the list of |GPPFakeFetcher| objects that have been created.
-- (NSArray *)fetchers;
-
-@end

+ 0 - 78
GoogleSignIn/Tests/Unit/GIDFakeFetcherService.m

@@ -1,78 +0,0 @@
-// Copyright 2021 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/Tests/Unit/GIDFakeFetcherService.h"
-
-#import "GoogleSignIn/Tests/Unit/GIDFakeFetcher.h"
-
-@implementation GIDFakeFetcherService {
-  NSMutableArray *_fetchers;
-}
-
-@synthesize delegateQueue;
-@synthesize callbackQueue;
-@synthesize reuseSession;
-
-- (instancetype)init {
-  self = [super init];
-  if (self) {
-    _fetchers = [[NSMutableArray alloc] init];
-  }
-  return self;
-}
-
-- (BOOL)fetcherShouldBeginFetching:(GTMSessionFetcher *)fetcher {
-  return YES;
-}
-
-- (void)fetcherDidCreateSession:(GTMSessionFetcher *)fetcher {
-}
-
-- (void)fetcherDidBeginFetching:(GTMSessionFetcher *)fetcher {
-}
-
-- (void)fetcherDidStop:(GTMSessionFetcher *)fetcher {
-}
-
-- (BOOL)isDelayingFetcher:(GTMSessionFetcher *)fetcher {
-  return NO;
-}
-
-- (GTMSessionFetcher *)fetcherWithRequest:(NSURLRequest *)request {
-  GIDFakeFetcher *fetcher = [[GIDFakeFetcher alloc] initWithRequest:request];
-  [_fetchers addObject:fetcher];
-  return fetcher;
-}
-
-- (NSURLSession *)session {
-  return nil;
-}
-
-- (NSURLSession *)sessionForFetcherCreation {
-  return nil;
-}
-
-- (id<NSURLSessionDelegate>)sessionDelegate {
-  return nil;
-}
-
-- (NSArray *)fetchers {
-  return _fetchers;
-}
-
-- (NSDate *)stoppedAllFetchersDate {
-  return nil;
-}
-
-@end