aboutsummaryrefslogtreecommitdiffhomepage
path: root/Example
diff options
context:
space:
mode:
authorGravatar Paul Beusterien <paulbeusterien@google.com>2018-07-06 09:37:23 -0700
committerGravatar GitHub <noreply@github.com>2018-07-06 09:37:23 -0700
commit98b6eef71eac368692ae249f056a75d89ed0350d (patch)
tree0a4a16612d7bbb5eeba981b40564db3c2fc66833 /Example
parenta3f792f3f093e913be5823cb4df9dfeac7612a52 (diff)
Split GoogleUtilities from FirebaseCore (#1370)
Diffstat (limited to 'Example')
-rw-r--r--Example/Core/Tests/FIRAppEnvironmentUtilTest.m12
-rw-r--r--Example/Core/Tests/FIRLoggerTest.m39
-rw-r--r--Example/Core/Tests/FIRMutableDictionaryTest.m6
-rw-r--r--Example/Core/Tests/FIRNetworkTest.m57
-rw-r--r--Example/Core/Tests/FIRReachabilityCheckerTest.m76
-rw-r--r--Example/Firebase.xcodeproj/project.pbxproj40
-rw-r--r--Example/Messaging/Tests/FIRMessagingClientTest.m8
-rw-r--r--Example/Messaging/Tests/FIRMessagingConnectionTest.m3
-rw-r--r--Example/Messaging/Tests/FIRMessagingFakeSocket.m3
-rw-r--r--Example/Podfile3
10 files changed, 142 insertions, 105 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.");
}
diff --git a/Example/Firebase.xcodeproj/project.pbxproj b/Example/Firebase.xcodeproj/project.pbxproj
index 8d3c13b..bf041f3 100644
--- a/Example/Firebase.xcodeproj/project.pbxproj
+++ b/Example/Firebase.xcodeproj/project.pbxproj
@@ -4887,6 +4887,10 @@
INFOPLIST_FILE = "$(SRCROOT)/Core/App/macOS/Core-Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
MTL_ENABLE_DEBUG_INFO = YES;
+ OTHER_LDFLAGS = (
+ "$(inherited)",
+ "-ObjC",
+ );
PRODUCT_BUNDLE_IDENTIFIER = "com.google.Core-Example-macOS";
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = macosx;
@@ -4908,6 +4912,10 @@
INFOPLIST_FILE = "$(SRCROOT)/Core/App/macOS/Core-Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
MTL_ENABLE_DEBUG_INFO = NO;
+ OTHER_LDFLAGS = (
+ "$(inherited)",
+ "-ObjC",
+ );
PRODUCT_BUNDLE_IDENTIFIER = "com.google.Core-Example-macOS";
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = macosx;
@@ -4922,10 +4930,14 @@
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
DEBUG_INFORMATION_FORMAT = dwarf;
DEVELOPMENT_TEAM = "";
- HEADER_SEARCH_PATHS = "$(inherited)";
+ HEADER_SEARCH_PATHS = (
+ "$(inherited)",
+ "$(SRCROOT)/../Firebase/Utilities/Reachability",
+ );
INFOPLIST_FILE = "Core/Tests/Tests-Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
MTL_ENABLE_DEBUG_INFO = YES;
+ OTHER_LDFLAGS = "$(inherited)";
PRODUCT_BUNDLE_IDENTIFIER = "com.google.Core-Tests-macOS";
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = macosx;
@@ -4942,10 +4954,14 @@
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_TEAM = "";
- HEADER_SEARCH_PATHS = "$(inherited)";
+ HEADER_SEARCH_PATHS = (
+ "$(inherited)",
+ "$(SRCROOT)/../Firebase/Utilities/Reachability",
+ );
INFOPLIST_FILE = "Core/Tests/Tests-Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
MTL_ENABLE_DEBUG_INFO = NO;
+ OTHER_LDFLAGS = "$(inherited)";
PRODUCT_BUNDLE_IDENTIFIER = "com.google.Core-Tests-macOS";
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = macosx;
@@ -6267,6 +6283,10 @@
INFOPLIST_FILE = "$(SRCROOT)/Core/App/tvOS/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MTL_ENABLE_DEBUG_INFO = YES;
+ OTHER_LDFLAGS = (
+ "$(inherited)",
+ "-ObjC",
+ );
PRODUCT_BUNDLE_IDENTIFIER = "com.google.Core-Example-tvOS";
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = appletvos;
@@ -6299,6 +6319,10 @@
INFOPLIST_FILE = "$(SRCROOT)/Core/App/tvOS/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MTL_ENABLE_DEBUG_INFO = NO;
+ OTHER_LDFLAGS = (
+ "$(inherited)",
+ "-ObjC",
+ );
PRODUCT_BUNDLE_IDENTIFIER = "com.google.Core-Example-tvOS";
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = appletvos;
@@ -6326,9 +6350,14 @@
DEBUG_INFORMATION_FORMAT = dwarf;
DEVELOPMENT_TEAM = EQHXZ8M8AV;
GCC_C_LANGUAGE_STANDARD = gnu11;
+ HEADER_SEARCH_PATHS = (
+ "$(inherited)",
+ "$(SRCROOT)/../Firebase/Utilities/Reachability",
+ );
INFOPLIST_FILE = "Core/Tests/Tests-Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
MTL_ENABLE_DEBUG_INFO = YES;
+ OTHER_LDFLAGS = "$(inherited)";
PRODUCT_BUNDLE_IDENTIFIER = "com.google.Core-Example-tvOSTests";
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = appletvos;
@@ -6358,9 +6387,14 @@
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_TEAM = EQHXZ8M8AV;
GCC_C_LANGUAGE_STANDARD = gnu11;
+ HEADER_SEARCH_PATHS = (
+ "$(inherited)",
+ "$(SRCROOT)/../Firebase/Utilities/Reachability",
+ );
INFOPLIST_FILE = "Core/Tests/Tests-Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
MTL_ENABLE_DEBUG_INFO = NO;
+ OTHER_LDFLAGS = "$(inherited)";
PRODUCT_BUNDLE_IDENTIFIER = "com.google.Core-Example-tvOSTests";
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = appletvos;
@@ -6650,6 +6684,7 @@
HEADER_SEARCH_PATHS = (
"$(inherited)",
"${PODS_ROOT}/Headers/Private",
+ "$(SRCROOT)/../Firebase/Utilities/Reachability",
);
INFOPLIST_FILE = "Core/Tests/Tests-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 10.2;
@@ -6673,6 +6708,7 @@
HEADER_SEARCH_PATHS = (
"$(inherited)",
"${PODS_ROOT}/Headers/Private",
+ "$(SRCROOT)/../Firebase/Utilities/Reachability",
);
INFOPLIST_FILE = "Core/Tests/Tests-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 10.2;
diff --git a/Example/Messaging/Tests/FIRMessagingClientTest.m b/Example/Messaging/Tests/FIRMessagingClientTest.m
index 9c60d9c..738df05 100644
--- a/Example/Messaging/Tests/FIRMessagingClientTest.m
+++ b/Example/Messaging/Tests/FIRMessagingClientTest.m
@@ -31,7 +31,7 @@
#import "FIRMessagingUtilities.h"
#import "NSError+FIRMessaging.h"
-#import <FirebaseCore/FIRReachabilityChecker.h>
+#import <GoogleUtilities/GULReachabilityChecker.h>
static NSString *const kFIRMessagingUserDefaultsSuite = @"FIRMessagingClientTestUserDefaultsSuite";
@@ -104,7 +104,7 @@ static NSString *const kTopicToSubscribeTo = @"/topics/abcdef/hello-world";
[super setUp];
_mockClientDelegate =
OCMStrictProtocolMock(@protocol(FIRMessagingClientDelegate));
- _mockReachability = OCMClassMock([FIRReachabilityChecker class]);
+ _mockReachability = OCMClassMock([GULReachabilityChecker class]);
_mockRmqManager = OCMClassMock([FIRMessagingRmqManager class]);
_client = [[FIRMessagingClient alloc] initWithDelegate:_mockClientDelegate
reachability:_mockReachability
@@ -203,7 +203,7 @@ static NSString *const kTopicToSubscribeTo = @"/topics/abcdef/hello-world";
// the network is available
[[[self.mockReachability stub]
- andReturnValue:@(kFIRReachabilityViaWifi)] reachabilityStatus];
+ andReturnValue:@(kGULReachabilityViaWifi)] reachabilityStatus];
[self setupFakeConnectionWithClass:[FIRMessagingFakeFailConnection class]
withSetupCompletionHandler:^(FIRMessagingConnection *connection) {
@@ -241,7 +241,7 @@ static NSString *const kTopicToSubscribeTo = @"/topics/abcdef/hello-world";
// the network is available
[[[self.mockReachability stub]
- andReturnValue:@(kFIRReachabilityViaWifi)] reachabilityStatus];
+ andReturnValue:@(kGULReachabilityViaWifi)] reachabilityStatus];
XCTestExpectation *setupConnection =
[self expectationWithDescription:@"Fcm should successfully setup a connection"];
diff --git a/Example/Messaging/Tests/FIRMessagingConnectionTest.m b/Example/Messaging/Tests/FIRMessagingConnectionTest.m
index b770cf5..71da301 100644
--- a/Example/Messaging/Tests/FIRMessagingConnectionTest.m
+++ b/Example/Messaging/Tests/FIRMessagingConnectionTest.m
@@ -19,7 +19,6 @@
#import <OCMock/OCMock.h>
#import "Protos/GtalkCore.pbobjc.h"
-#import <GoogleToolboxForMac/GTMDefines.h>
#import "FIRMessagingClient.h"
#import "FIRMessagingConnection.h"
@@ -374,7 +373,7 @@ static FIRMessagingProtoTag currentProtoSendTag;
}
- (void)_sendData:(NSData *)data withTag:(int8_t)tag rmqId:(NSString *)rmqId {
- _GTMDevLog(@"FIRMessaging Socket: Send data with Tag: %d rmq: %@", tag, rmqId);
+ NSLog(@"FIRMessaging Socket: Send data with Tag: %d rmq: %@", tag, rmqId);
if (currentProtoSendTag > 0) {
XCTAssertEqual(tag, currentProtoSendTag);
}
diff --git a/Example/Messaging/Tests/FIRMessagingFakeSocket.m b/Example/Messaging/Tests/FIRMessagingFakeSocket.m
index cffe69a..c347d31 100644
--- a/Example/Messaging/Tests/FIRMessagingFakeSocket.m
+++ b/Example/Messaging/Tests/FIRMessagingFakeSocket.m
@@ -18,7 +18,6 @@
#import "FIRMessagingConstants.h"
#import "FIRMessagingDefines.h"
-#import <GoogleToolboxForMac/GTMDefines.h>
@interface FIRMessagingSecureSocket() <NSStreamDelegate>
@@ -78,7 +77,7 @@
}
- (void)openStream:(NSStream *)stream {
- _GTMDevAssert(stream, @"Cannot open nil stream");
+ NSAssert(stream, @"Cannot open nil stream");
if (stream) {
stream.delegate = self;
[stream scheduleInRunLoop:self.runLoop forMode:NSDefaultRunLoopMode];
diff --git a/Example/Podfile b/Example/Podfile
index 6c37a38..dc3acd0 100644
--- a/Example/Podfile
+++ b/Example/Podfile
@@ -5,6 +5,7 @@
use_frameworks!
pod 'FirebaseCore', :path => '../'
+pod 'GoogleUtilities', :path => '../'
target 'Core_Example_iOS' do
platform :ios, '8.0'
@@ -12,7 +13,7 @@ target 'Core_Example_iOS' do
# The next line is the forcing function for the Firebase pod. The Firebase
# version's subspecs should depend on the component versions in their
# corresponding podspec's.
- pod 'Firebase/Core', '5.4.0'
+ pod 'Firebase/CoreOnly', '5.4.0'
target 'Core_Tests_iOS' do
inherit! :search_paths