diff options
Diffstat (limited to 'Example/Core')
-rw-r--r-- | Example/Core/Tests/FIRAppEnvironmentUtilTest.m | 12 | ||||
-rw-r--r-- | Example/Core/Tests/FIRLoggerTest.m | 39 | ||||
-rw-r--r-- | Example/Core/Tests/FIRMutableDictionaryTest.m | 6 | ||||
-rw-r--r-- | Example/Core/Tests/FIRNetworkTest.m | 57 | ||||
-rw-r--r-- | Example/Core/Tests/FIRReachabilityCheckerTest.m | 76 |
5 files changed, 96 insertions, 94 deletions
diff --git a/Example/Core/Tests/FIRAppEnvironmentUtilTest.m b/Example/Core/Tests/FIRAppEnvironmentUtilTest.m index 2469e8d..4ac2ef5 100644 --- a/Example/Core/Tests/FIRAppEnvironmentUtilTest.m +++ b/Example/Core/Tests/FIRAppEnvironmentUtilTest.m @@ -15,17 +15,17 @@ #import <Foundation/Foundation.h> #import <XCTest/XCTest.h> -#import <FirebaseCore/FIRAppEnvironmentUtil.h> +#import <GoogleUtilities/GULAppEnvironmentUtil.h> #import "FIRTestCase.h" -@interface FIRAppEnvironmentUtilTest : FIRTestCase +@interface GULAppEnvironmentUtilTest : FIRTestCase @property(nonatomic) id processInfoMock; @end -@implementation FIRAppEnvironmentUtilTest +@implementation GULAppEnvironmentUtilTest - (void)setUp { [super setUp]; @@ -43,21 +43,21 @@ NSOperatingSystemVersion osTen = {.majorVersion = 10, .minorVersion = 0, .patchVersion = 0}; OCMStub([self.processInfoMock operatingSystemVersion]).andReturn(osTen); - XCTAssertTrue([[FIRAppEnvironmentUtil systemVersion] isEqualToString:@"10.0"]); + XCTAssertTrue([[GULAppEnvironmentUtil systemVersion] isEqualToString:@"10.0"]); } - (void)testSystemVersionInfoMajorMinor { NSOperatingSystemVersion osTenTwo = {.majorVersion = 10, .minorVersion = 2, .patchVersion = 0}; OCMStub([self.processInfoMock operatingSystemVersion]).andReturn(osTenTwo); - XCTAssertTrue([[FIRAppEnvironmentUtil systemVersion] isEqualToString:@"10.2"]); + XCTAssertTrue([[GULAppEnvironmentUtil systemVersion] isEqualToString:@"10.2"]); } - (void)testSystemVersionInfoMajorMinorPatch { NSOperatingSystemVersion osTenTwoOne = {.majorVersion = 10, .minorVersion = 2, .patchVersion = 1}; OCMStub([self.processInfoMock operatingSystemVersion]).andReturn(osTenTwoOne); - XCTAssertTrue([[FIRAppEnvironmentUtil systemVersion] isEqualToString:@"10.2.1"]); + XCTAssertTrue([[GULAppEnvironmentUtil systemVersion] isEqualToString:@"10.2.1"]); } @end diff --git a/Example/Core/Tests/FIRLoggerTest.m b/Example/Core/Tests/FIRLoggerTest.m index b871244..f179bde 100644 --- a/Example/Core/Tests/FIRLoggerTest.m +++ b/Example/Core/Tests/FIRLoggerTest.m @@ -17,7 +17,10 @@ #import "FIRTestCase.h" +// TODO - FIRLoggerTest should be split into a separate FIRLoggerTest and GULLoggerTest. +// No test should include both includes. #import <FirebaseCore/FIRLogger.h> +#import <GoogleUtilities/GULLogger.h> #import <asl.h> @@ -25,19 +28,19 @@ extern NSString *const kFIRDisableDebugModeApplicationArgument; extern NSString *const kFIREnableDebugModeApplicationArgument; -extern NSString *const kFIRPersistedDebugModeKey; +extern NSString *const kGULPersistedDebugModeKey; -extern const char *kFIRLoggerASLClientFacilityName; +extern const char *kGULLoggerASLClientFacilityName; extern void FIRResetLogger(void); extern void FIRSetLoggerUserDefaults(NSUserDefaults *defaults); -extern aslclient getFIRLoggerClient(void); +extern aslclient getGULLoggerClient(void); -extern dispatch_queue_t getFIRClientQueue(void); +extern dispatch_queue_t getGULClientQueue(void); -extern BOOL getFIRLoggerDebugMode(void); +extern BOOL getGULLoggerDebugMode(void); static NSString *const kMessageCode = @"I-COR000001"; @@ -95,9 +98,11 @@ static NSString *const kMessageCode = @"I-COR000001"; FIRLogError(kFIRLoggerCore, kMessageCode, @"Some error."); // Assert. - NSNumber *debugMode = [self.defaults objectForKey:kFIRPersistedDebugModeKey]; +#if MAKE_THREAD_SAFE + NSNumber *debugMode = [self.defaults objectForKey:kGULPersistedDebugModeKey]; XCTAssertNil(debugMode); - XCTAssertFalse(getFIRLoggerDebugMode()); + XCTAssertFalse(getGULLoggerDebugMode()); +#endif // Stop. [processInfoMock stopMocking]; @@ -112,10 +117,12 @@ static NSString *const kMessageCode = @"I-COR000001"; // Test. FIRLogError(kFIRLoggerCore, kMessageCode, @"Some error."); +#ifdef MAKE_THREAD_SAFE // Assert. - NSNumber *debugMode = [self.defaults objectForKey:kFIRPersistedDebugModeKey]; + NSNumber *debugMode = [self.defaults objectForKey:kGULPersistedDebugModeKey]; XCTAssertTrue(debugMode.boolValue); - XCTAssertTrue(getFIRLoggerDebugMode()); + XCTAssertTrue(getGULLoggerDebugMode()); +#endif // Stop. [processInfoMock stopMocking]; @@ -124,15 +131,17 @@ static NSString *const kMessageCode = @"I-COR000001"; - (void)testInitializeASLForDebugModeWithUserDefaults { // Stub. NSNumber *debugMode = @YES; - [self.defaults setBool:debugMode.boolValue forKey:kFIRPersistedDebugModeKey]; + [self.defaults setBool:debugMode.boolValue forKey:kGULPersistedDebugModeKey]; // Test. FIRLogError(kFIRLoggerCore, kMessageCode, @"Some error."); // Assert. - debugMode = [self.defaults objectForKey:kFIRPersistedDebugModeKey]; + debugMode = [self.defaults objectForKey:kGULPersistedDebugModeKey]; XCTAssertTrue(debugMode.boolValue); - XCTAssertTrue(getFIRLoggerDebugMode()); +#if MAKE_THREAD_SAFE + XCTAssertTrue(getGULLoggerDebugMode()); +#endif } - (void)testMessageCodeFormat { @@ -240,7 +249,7 @@ static NSString *const kMessageCode = @"I-COR000001"; - (void)drainFIRClientQueue { dispatch_semaphore_t workerSemaphore = dispatch_semaphore_create(0); - dispatch_async(getFIRClientQueue(), ^{ + dispatch_async(getGULClientQueue(), ^{ dispatch_semaphore_signal(workerSemaphore); }); dispatch_semaphore_wait(workerSemaphore, DISPATCH_TIME_FOREVER); @@ -250,8 +259,8 @@ static NSString *const kMessageCode = @"I-COR000001"; #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" aslmsg query = asl_new(ASL_TYPE_QUERY); - asl_set_query(query, ASL_KEY_FACILITY, kFIRLoggerASLClientFacilityName, ASL_QUERY_OP_EQUAL); - aslresponse r = asl_search(getFIRLoggerClient(), query); + asl_set_query(query, ASL_KEY_FACILITY, kGULLoggerASLClientFacilityName, ASL_QUERY_OP_EQUAL); + aslresponse r = asl_search(getGULLoggerClient(), query); asl_free(query); aslmsg m; const char *val; diff --git a/Example/Core/Tests/FIRMutableDictionaryTest.m b/Example/Core/Tests/FIRMutableDictionaryTest.m index 56c079c..f6be760 100644 --- a/Example/Core/Tests/FIRMutableDictionaryTest.m +++ b/Example/Core/Tests/FIRMutableDictionaryTest.m @@ -14,7 +14,7 @@ #import "FIRTestCase.h" -#import <FirebaseCore/FIRMutableDictionary.h> +#import <GoogleUtilities/GULMutableDictionary.h> const static NSString *const kKey = @"testKey1"; const static NSString *const kValue = @"testValue1"; @@ -22,14 +22,14 @@ const static NSString *const kKey2 = @"testKey2"; const static NSString *const kValue2 = @"testValue2"; @interface FIRMutableDictionaryTest : FIRTestCase -@property(nonatomic) FIRMutableDictionary *dictionary; +@property(nonatomic) GULMutableDictionary *dictionary; @end @implementation FIRMutableDictionaryTest - (void)setUp { [super setUp]; - self.dictionary = [[FIRMutableDictionary alloc] init]; + self.dictionary = [[GULMutableDictionary alloc] init]; } - (void)tearDown { diff --git a/Example/Core/Tests/FIRNetworkTest.m b/Example/Core/Tests/FIRNetworkTest.m index ba288d6..a1410ee 100644 --- a/Example/Core/Tests/FIRNetworkTest.m +++ b/Example/Core/Tests/FIRNetworkTest.m @@ -16,29 +16,29 @@ #import "GTMHTTPServer.h" -#import <FirebaseCore/FIRNetwork.h> -#import <FirebaseCore/FIRReachabilityChecker.h> -#import <GoogleToolboxForMac/GTMNSData+zlib.h> +#import <GoogleUtilities/GULNSData+zlib.h> +#import <GoogleUtilities/GULNetwork.h> +#import <GoogleUtilities/GULReachabilityChecker.h> -@interface FIRNetwork () +@interface GULNetwork () -- (void)reachability:(FIRReachabilityChecker *)reachability - statusChanged:(FIRReachabilityStatus)status; +- (void)reachability:(GULReachabilityChecker *)reachability + statusChanged:(GULReachabilityStatus)status; @end -@interface FIRNetworkURLSession () +@interface GULNetworkURLSession () - (void)maybeRemoveTempFilesAtURL:(NSURL *)tempFile expiringTime:(NSTimeInterval)expiringTime; @end -@interface FIRNetworkTest : FIRTestCase <FIRNetworkReachabilityDelegate> +@interface GULNetworkTest : FIRTestCase <GULNetworkReachabilityDelegate> @end -@implementation FIRNetworkTest { +@implementation GULNetworkTest { dispatch_queue_t _backgroundQueue; - FIRNetwork *_network; + GULNetwork *_network; /// Fake Server. GTMHTTPServer *_httpServer; @@ -48,7 +48,7 @@ // For network reachability test. BOOL _fakeNetworkIsReachable; BOOL _currentNetworkStatus; - FIRReachabilityStatus _fakeReachabilityStatus; + GULReachabilityStatus _fakeReachabilityStatus; } #pragma mark - Setup and teardown @@ -66,7 +66,7 @@ NSError *error = nil; XCTAssertTrue([_httpServer start:&error], @"Failed to start HTTP server: %@", error); - _network = [[FIRNetwork alloc] init]; + _network = [[GULNetwork alloc] init]; _backgroundQueue = dispatch_queue_create("Test queue", DISPATCH_QUEUE_SERIAL); _request = nil; @@ -97,14 +97,14 @@ // Fake scenario with connectivity. _fakeNetworkIsReachable = YES; - _fakeReachabilityStatus = kFIRReachabilityViaWifi; + _fakeReachabilityStatus = kGULReachabilityViaWifi; [_network reachability:reachabilityMock statusChanged:[reachabilityMock reachabilityStatus]]; XCTAssertTrue([_network isNetworkConnected]); XCTAssertEqual(_currentNetworkStatus, _fakeNetworkIsReachable); // Fake scenario without connectivity. _fakeNetworkIsReachable = NO; - _fakeReachabilityStatus = kFIRReachabilityNotReachable; + _fakeReachabilityStatus = kGULReachabilityNotReachable; [_network reachability:reachabilityMock statusChanged:[reachabilityMock reachabilityStatus]]; XCTAssertFalse([_network isNetworkConnected]); XCTAssertEqual(_currentNetworkStatus, _fakeNetworkIsReachable); @@ -119,6 +119,7 @@ XCTestExpectation *expectation = [self expectationWithDescription:@"Expect block is called"]; NSData *uncompressedData = [@"Google" dataUsingEncoding:NSUTF8StringEncoding]; + NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"http://localhost:%d/2", _httpServer.port]]; _statusCode = 200; @@ -181,7 +182,7 @@ queue:_backgroundQueue usingBackgroundSession:NO completionHandler:^(NSHTTPURLResponse *response, NSData *data, NSError *error) { - XCTAssertEqual(error.code, FIRErrorCodeNetworkInvalidURL); + XCTAssertEqual(error.code, GULErrorCodeNetworkInvalidURL); XCTAssertFalse(_network.hasUploadInProgress, "There must be no pending request"); [expectation fulfill]; }]; @@ -203,7 +204,7 @@ queue:_backgroundQueue usingBackgroundSession:NO completionHandler:^(NSHTTPURLResponse *response, NSData *data, NSError *error) { - XCTAssertEqual(error.code, FIRErrorCodeNetworkInvalidURL); + XCTAssertEqual(error.code, GULErrorCodeNetworkInvalidURL); XCTAssertFalse(_network.hasUploadInProgress, "There must be no pending request"); [expectation fulfill]; }]; @@ -367,7 +368,7 @@ queue:_backgroundQueue usingBackgroundSession:YES completionHandler:^(NSHTTPURLResponse *response, NSData *data, NSError *error) { - XCTAssertEqual(error.code, FIRErrorCodeNetworkInvalidURL); + XCTAssertEqual(error.code, GULErrorCodeNetworkInvalidURL); XCTAssertFalse(_network.hasUploadInProgress, "There must be no pending request"); [expectation fulfill]; }]; @@ -389,7 +390,7 @@ queue:_backgroundQueue usingBackgroundSession:YES completionHandler:^(NSHTTPURLResponse *response, NSData *data, NSError *error) { - XCTAssertEqual(error.code, FIRErrorCodeNetworkInvalidURL); + XCTAssertEqual(error.code, GULErrorCodeNetworkInvalidURL); XCTAssertFalse(_network.hasUploadInProgress, "There must be no pending request"); [expectation fulfill]; }]; @@ -551,7 +552,7 @@ queue:_backgroundQueue usingBackgroundSession:NO completionHandler:^(NSHTTPURLResponse *response, NSData *data, NSError *error) { - XCTAssertEqual(error.code, FIRErrorCodeNetworkInvalidURL); + XCTAssertEqual(error.code, GULErrorCodeNetworkInvalidURL); XCTAssertFalse(_network.hasUploadInProgress, "There must be no pending request"); [expectation fulfill]; }]; @@ -572,7 +573,7 @@ queue:_backgroundQueue usingBackgroundSession:NO completionHandler:^(NSHTTPURLResponse *response, NSData *data, NSError *error) { - XCTAssertEqual(error.code, FIRErrorCodeNetworkInvalidURL); + XCTAssertEqual(error.code, GULErrorCodeNetworkInvalidURL); XCTAssertFalse(_network.hasUploadInProgress, "There must be no pending request"); [expectation fulfill]; }]; @@ -746,7 +747,7 @@ queue:_backgroundQueue usingBackgroundSession:YES completionHandler:^(NSHTTPURLResponse *response, NSData *data, NSError *error) { - XCTAssertEqual(error.code, FIRErrorCodeNetworkInvalidURL); + XCTAssertEqual(error.code, GULErrorCodeNetworkInvalidURL); XCTAssertFalse(_network.hasUploadInProgress, "There must be no pending request"); [expectation fulfill]; }]; @@ -767,7 +768,7 @@ queue:_backgroundQueue usingBackgroundSession:YES completionHandler:^(NSHTTPURLResponse *response, NSData *data, NSError *error) { - XCTAssertEqual(error.code, FIRErrorCodeNetworkInvalidURL); + XCTAssertEqual(error.code, GULErrorCodeNetworkInvalidURL); XCTAssertFalse(_network.hasUploadInProgress, "There must be no pending request"); [expectation fulfill]; }]; @@ -881,14 +882,14 @@ NSError *writeError = nil; NSFileManager *fileManager = [NSFileManager defaultManager]; - FIRNetworkURLSession *session = [[FIRNetworkURLSession alloc] - initWithNetworkLoggerDelegate:(id<FIRNetworkLoggerDelegate>)_network]; + GULNetworkURLSession *session = [[GULNetworkURLSession alloc] + initWithNetworkLoggerDelegate:(id<GULNetworkLoggerDelegate>)_network]; NSArray *paths = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES); NSString *applicationSupportDirectory = paths.firstObject; NSArray *tempPathComponents = @[ - applicationSupportDirectory, kFIRNetworkApplicationSupportSubdirectory, - @"FIRNetworkTemporaryDirectory" + applicationSupportDirectory, kGULNetworkApplicationSupportSubdirectory, + @"GULNetworkTemporaryDirectory" ]; NSURL *folderURL = [NSURL fileURLWithPathComponents:tempPathComponents]; [fileManager createDirectoryAtURL:folderURL @@ -946,7 +947,7 @@ // Test whether the request is compressed correctly. NSData *requestBody = [_request body]; - NSData *decompressedRequestData = [NSData gtm_dataByInflatingData:requestBody error:NULL]; + NSData *decompressedRequestData = [NSData gul_dataByInflatingGzippedData:requestBody error:NULL]; NSString *requestString = [[NSString alloc] initWithData:decompressedRequestData encoding:NSUTF8StringEncoding]; XCTAssertEqualObjects(requestString, @"Google", @"Request is not compressed correctly."); @@ -979,7 +980,7 @@ return _fakeNetworkIsReachable; } -- (FIRReachabilityStatus)reachabilityStatus { +- (GULReachabilityStatus)reachabilityStatus { return _fakeReachabilityStatus; } diff --git a/Example/Core/Tests/FIRReachabilityCheckerTest.m b/Example/Core/Tests/FIRReachabilityCheckerTest.m index 7b6b068..2f447d3 100644 --- a/Example/Core/Tests/FIRReachabilityCheckerTest.m +++ b/Example/Core/Tests/FIRReachabilityCheckerTest.m @@ -14,12 +14,12 @@ #import "FIRTestCase.h" -#import <FirebaseCore/FIRReachabilityChecker+Internal.h> -#import <FirebaseCore/FIRReachabilityChecker.h> +#import <GoogleUtilities/GULReachabilityChecker.h> +#import "GULReachabilityChecker+Internal.h" -@interface FIRReachabilityCheckerTest : FIRTestCase <FIRReachabilityDelegate> { +@interface GULReachabilityCheckerTest : FIRTestCase <GULReachabilityDelegate> { @private - FIRReachabilityChecker *checker_; + GULReachabilityChecker *checker_; NSMutableArray *statuses_; BOOL createFail_; BOOL setCallbackFail_; @@ -42,7 +42,7 @@ static NSString *const kHostname = @"www.google.com"; static const void *kFakeReachabilityObject = (const void *)0x8badf00d; -static FIRReachabilityCheckerTest *FakeReachabilityTest = nil; +static GULReachabilityCheckerTest *FakeReachabilityTest = nil; static struct { int callsMade; @@ -87,12 +87,12 @@ static void ReachabilityRelease(CFTypeRef reachability) { [FakeReachabilityTest releaseReachability:reachability]; } -static const struct FIRReachabilityApi kTestReachabilityApi = { +static const struct GULReachabilityApi kTestReachabilityApi = { ReachabilityCreateWithName, ReachabilitySetCallback, ReachabilityScheduleWithRunLoop, ReachabilityUnscheduleFromRunLoop, ReachabilityRelease, }; -@implementation FIRReachabilityCheckerTest +@implementation GULReachabilityCheckerTest - (void)resetFakeReachability { FakeReachabilityTest = self; @@ -114,9 +114,7 @@ static const struct FIRReachabilityApi kTestReachabilityApi = { setCallbackFail_ = NO; scheduleUnscheduleFail_ = NO; - checker_ = [[FIRReachabilityChecker alloc] initWithReachabilityDelegate:self - loggerDelegate:nil - withHost:kHostname]; + checker_ = [[GULReachabilityChecker alloc] initWithReachabilityDelegate:self withHost:kHostname]; statuses_ = [[NSMutableArray alloc] init]; } @@ -180,8 +178,8 @@ static const struct FIRReachabilityApi kTestReachabilityApi = { FakeReachability.releaseCall = ++FakeReachability.callsMade; } -- (void)reachability:(FIRReachabilityChecker *)reachability - statusChanged:(FIRReachabilityStatus)status { +- (void)reachability:(GULReachabilityChecker *)reachability + statusChanged:(GULReachabilityStatus)status { [statuses_ addObject:[NSNumber numberWithInt:(int)status]]; } @@ -192,28 +190,28 @@ static const struct FIRReachabilityApi kTestReachabilityApi = { XCTAssertEqual([checker_ reachabilityApi], &kTestReachabilityApi, @""); XCTAssertFalse(checker_.isActive, @""); - XCTAssertEqual(checker_.reachabilityStatus, kFIRReachabilityUnknown, @""); + XCTAssertEqual(checker_.reachabilityStatus, kGULReachabilityUnknown, @""); XCTAssertTrue([checker_ start], @""); XCTAssertTrue(checker_.isActive, @""); XCTAssertEqual([statuses_ count], (NSUInteger)0, @""); - XCTAssertEqual(checker_.reachabilityStatus, kFIRReachabilityUnknown, @""); + XCTAssertEqual(checker_.reachabilityStatus, kGULReachabilityUnknown, @""); FakeReachability.callback(kFakeReachabilityObject, 0, FakeReachability.callbackInfo); XCTAssertEqual([statuses_ count], (NSUInteger)1, @""); XCTAssertEqual([(NSNumber *)[statuses_ objectAtIndex:0] intValue], - (int)kFIRReachabilityNotReachable, @""); - XCTAssertEqual(checker_.reachabilityStatus, kFIRReachabilityNotReachable, @""); + (int)kGULReachabilityNotReachable, @""); + XCTAssertEqual(checker_.reachabilityStatus, kGULReachabilityNotReachable, @""); FakeReachability.callback(kFakeReachabilityObject, kSCNetworkReachabilityFlagsReachable, FakeReachability.callbackInfo); XCTAssertEqual([statuses_ count], (NSUInteger)2, @""); - XCTAssertEqual([(NSNumber *)[statuses_ objectAtIndex:1] intValue], (int)kFIRReachabilityViaWifi, + XCTAssertEqual([(NSNumber *)[statuses_ objectAtIndex:1] intValue], (int)kGULReachabilityViaWifi, @""); - XCTAssertEqual(checker_.reachabilityStatus, kFIRReachabilityViaWifi, @""); + XCTAssertEqual(checker_.reachabilityStatus, kGULReachabilityViaWifi, @""); FakeReachability.callback( kFakeReachabilityObject, @@ -222,8 +220,8 @@ static const struct FIRReachabilityApi kTestReachabilityApi = { XCTAssertEqual([statuses_ count], (NSUInteger)3, @""); XCTAssertEqual([(NSNumber *)[statuses_ objectAtIndex:2] intValue], - (int)kFIRReachabilityNotReachable, @""); - XCTAssertEqual(checker_.reachabilityStatus, kFIRReachabilityNotReachable, @""); + (int)kGULReachabilityNotReachable, @""); + XCTAssertEqual(checker_.reachabilityStatus, kGULReachabilityNotReachable, @""); #if TARGET_OS_IOS || TARGET_OS_TV FakeReachability.callback( @@ -233,22 +231,22 @@ static const struct FIRReachabilityApi kTestReachabilityApi = { XCTAssertEqual([statuses_ count], (NSUInteger)4, @""); XCTAssertEqual([(NSNumber *)[statuses_ objectAtIndex:3] intValue], - (int)kFIRReachabilityViaCellular, @""); - XCTAssertEqual(checker_.reachabilityStatus, kFIRReachabilityViaCellular, @""); + (int)kGULReachabilityViaCellular, @""); + XCTAssertEqual(checker_.reachabilityStatus, kGULReachabilityViaCellular, @""); FakeReachability.callback(kFakeReachabilityObject, kSCNetworkReachabilityFlagsIsWWAN, FakeReachability.callbackInfo); XCTAssertEqual([statuses_ count], (NSUInteger)5, @""); XCTAssertEqual([(NSNumber *)[statuses_ objectAtIndex:4] intValue], - (int)kFIRReachabilityNotReachable, @""); - XCTAssertEqual(checker_.reachabilityStatus, kFIRReachabilityNotReachable, @""); + (int)kGULReachabilityNotReachable, @""); + XCTAssertEqual(checker_.reachabilityStatus, kGULReachabilityNotReachable, @""); #endif [checker_ stop]; XCTAssertFalse(checker_.isActive, @""); - XCTAssertEqual(checker_.reachabilityStatus, kFIRReachabilityUnknown, @""); + XCTAssertEqual(checker_.reachabilityStatus, kGULReachabilityUnknown, @""); XCTAssertEqual(FakeReachability.callsMade, 5, @""); @@ -266,17 +264,17 @@ static const struct FIRReachabilityApi kTestReachabilityApi = { createFail_ = YES; XCTAssertFalse(checker_.isActive, @""); - XCTAssertEqual(checker_.reachabilityStatus, kFIRReachabilityUnknown, @""); + XCTAssertEqual(checker_.reachabilityStatus, kGULReachabilityUnknown, @""); XCTAssertFalse([checker_ start], @""); XCTAssertFalse(checker_.isActive, @""); - XCTAssertEqual(checker_.reachabilityStatus, kFIRReachabilityUnknown, @""); + XCTAssertEqual(checker_.reachabilityStatus, kGULReachabilityUnknown, @""); [checker_ stop]; XCTAssertFalse(checker_.isActive, @""); - XCTAssertEqual(checker_.reachabilityStatus, kFIRReachabilityUnknown, @""); + XCTAssertEqual(checker_.reachabilityStatus, kGULReachabilityUnknown, @""); XCTAssertEqual(FakeReachability.callsMade, 1, @""); @@ -296,17 +294,17 @@ static const struct FIRReachabilityApi kTestReachabilityApi = { setCallbackFail_ = YES; XCTAssertFalse(checker_.isActive, @""); - XCTAssertEqual(checker_.reachabilityStatus, kFIRReachabilityUnknown, @""); + XCTAssertEqual(checker_.reachabilityStatus, kGULReachabilityUnknown, @""); XCTAssertFalse([checker_ start], @""); XCTAssertFalse(checker_.isActive, @""); - XCTAssertEqual(checker_.reachabilityStatus, kFIRReachabilityUnknown, @""); + XCTAssertEqual(checker_.reachabilityStatus, kGULReachabilityUnknown, @""); [checker_ stop]; XCTAssertFalse(checker_.isActive, @""); - XCTAssertEqual(checker_.reachabilityStatus, kFIRReachabilityUnknown, @""); + XCTAssertEqual(checker_.reachabilityStatus, kGULReachabilityUnknown, @""); XCTAssertEqual(FakeReachability.callsMade, 3, @""); @@ -326,17 +324,17 @@ static const struct FIRReachabilityApi kTestReachabilityApi = { scheduleUnscheduleFail_ = YES; XCTAssertFalse(checker_.isActive, @""); - XCTAssertEqual(checker_.reachabilityStatus, kFIRReachabilityUnknown, @""); + XCTAssertEqual(checker_.reachabilityStatus, kGULReachabilityUnknown, @""); XCTAssertFalse([checker_ start], @""); XCTAssertFalse(checker_.isActive, @""); - XCTAssertEqual(checker_.reachabilityStatus, kFIRReachabilityUnknown, @""); + XCTAssertEqual(checker_.reachabilityStatus, kGULReachabilityUnknown, @""); [checker_ stop]; XCTAssertFalse(checker_.isActive, @""); - XCTAssertEqual(checker_.reachabilityStatus, kFIRReachabilityUnknown, @""); + XCTAssertEqual(checker_.reachabilityStatus, kGULReachabilityUnknown, @""); XCTAssertEqual(FakeReachability.callsMade, 4, @""); @@ -350,15 +348,9 @@ static const struct FIRReachabilityApi kTestReachabilityApi = { } - (void)testBadHost { - XCTAssertNil([[FIRReachabilityChecker alloc] - initWithReachabilityDelegate:self - loggerDelegate:(id<FIRNetworkLoggerDelegate>)self - withHost:nil], + XCTAssertNil([[GULReachabilityChecker alloc] initWithReachabilityDelegate:self withHost:nil], @"Creating a checker with nil hostname must fail."); - XCTAssertNil([[FIRReachabilityChecker alloc] - initWithReachabilityDelegate:self - loggerDelegate:(id<FIRNetworkLoggerDelegate>)self - withHost:@""], + XCTAssertNil([[GULReachabilityChecker alloc] initWithReachabilityDelegate:self withHost:@""], @"Creating a checker with empty hostname must fail."); } |