aboutsummaryrefslogtreecommitdiffhomepage
path: root/Example
diff options
context:
space:
mode:
authorGravatar Paul Beusterien <paulbeusterien@google.com>2017-07-27 11:02:39 -0700
committerGravatar GitHub <noreply@github.com>2017-07-27 11:02:39 -0700
commit0abd3444344ea134b0593fcaaf428e82cd190e12 (patch)
tree2a3edd3751d3de661fe1a12c6e5b2aa4e10bb110 /Example
parent94dd3c50ad22533f97f59988a1dc01277f29ed6d (diff)
Add clang-format options and script; apply to FirebaseCore (#151)
Diffstat (limited to 'Example')
-rw-r--r--Example/Core/App/iOS/FIRAppDelegate.h2
-rw-r--r--Example/Core/App/iOS/FIRAppDelegate.m47
-rw-r--r--Example/Core/App/iOS/FIRViewController.m14
-rw-r--r--Example/Core/App/iOS/main.m9
-rw-r--r--Example/Core/App/macOS/FIRAppDelegate.h2
-rw-r--r--Example/Core/App/macOS/FIRAppDelegate.m6
-rw-r--r--Example/Core/App/macOS/FIRViewController.h2
-rw-r--r--Example/Core/App/macOS/FIRViewController.m10
-rw-r--r--Example/Core/App/macOS/main.m4
-rw-r--r--Example/Core/Tests/FIRAppAssociationRegistrationUnitTests.m70
-rw-r--r--Example/Core/Tests/FIRAppTest.m131
-rw-r--r--Example/Core/Tests/FIRBundleUtilTest.m24
-rw-r--r--Example/Core/Tests/FIRLoggerTest.m13
-rw-r--r--Example/Core/Tests/FIROptionsTest.m35
-rw-r--r--Example/Shared/FIRSampleAppUtilities.h4
-rw-r--r--Example/Shared/FIRSampleAppUtilities.m27
16 files changed, 193 insertions, 207 deletions
diff --git a/Example/Core/App/iOS/FIRAppDelegate.h b/Example/Core/App/iOS/FIRAppDelegate.h
index e3fba8f..1eb5040 100644
--- a/Example/Core/App/iOS/FIRAppDelegate.h
+++ b/Example/Core/App/iOS/FIRAppDelegate.h
@@ -18,6 +18,6 @@
@interface FIRAppDelegate : UIResponder <UIApplicationDelegate>
-@property (strong, nonatomic) UIWindow *window;
+@property(strong, nonatomic) UIWindow *window;
@end
diff --git a/Example/Core/App/iOS/FIRAppDelegate.m b/Example/Core/App/iOS/FIRAppDelegate.m
index 8819126..34c2e0a 100644
--- a/Example/Core/App/iOS/FIRAppDelegate.m
+++ b/Example/Core/App/iOS/FIRAppDelegate.m
@@ -12,43 +12,46 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-#import "FIRAppDelegate.h"
-
@import FirebaseCommunity;
+#import "FIRAppDelegate.h"
@implementation FIRAppDelegate
-- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
-{
+- (BOOL)application:(UIApplication *)application
+ didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[FIRApp configure];
- return YES;
+ return YES;
}
-- (void)applicationWillResignActive:(UIApplication *)application
-{
- // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
- // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
+- (void)applicationWillResignActive:(UIApplication *)application {
+ // Sent when the application is about to move from active to inactive state. This can occur for
+ // certain types of temporary interruptions (such as an incoming phone call or SMS message) or
+ // when the user quits the application and it begins the transition to the background state.
+ // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame
+ // rates. Games should use this method to pause the game.
}
-- (void)applicationDidEnterBackground:(UIApplication *)application
-{
- // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
- // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
+- (void)applicationDidEnterBackground:(UIApplication *)application {
+ // Use this method to release shared resources, save user data, invalidate timers, and store
+ // enough application state information to restore your application to its current state in case
+ // it is terminated later.
+ // If your application supports background execution, this method is called instead of
+ // applicationWillTerminate: when the user quits.
}
-- (void)applicationWillEnterForeground:(UIApplication *)application
-{
- // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
+- (void)applicationWillEnterForeground:(UIApplication *)application {
+ // Called as part of the transition from the background to the inactive state; here you can undo
+ // many of the changes made on entering the background.
}
-- (void)applicationDidBecomeActive:(UIApplication *)application
-{
- // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
+- (void)applicationDidBecomeActive:(UIApplication *)application {
+ // Restart any tasks that were paused (or not yet started) while the application was inactive. If
+ // the application was previously in the background, optionally refresh the user interface.
}
-- (void)applicationWillTerminate:(UIApplication *)application
-{
- // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
+- (void)applicationWillTerminate:(UIApplication *)application {
+ // Called when the application is about to terminate. Save data if appropriate. See also
+ // applicationDidEnterBackground:.
}
@end
diff --git a/Example/Core/App/iOS/FIRViewController.m b/Example/Core/App/iOS/FIRViewController.m
index 901accf..027aabf 100644
--- a/Example/Core/App/iOS/FIRViewController.m
+++ b/Example/Core/App/iOS/FIRViewController.m
@@ -20,16 +20,14 @@
@implementation FIRViewController
-- (void)viewDidLoad
-{
- [super viewDidLoad];
- // Do any additional setup after loading the view, typically from a nib.
+- (void)viewDidLoad {
+ [super viewDidLoad];
+ // Do any additional setup after loading the view, typically from a nib.
}
-- (void)didReceiveMemoryWarning
-{
- [super didReceiveMemoryWarning];
- // Dispose of any resources that can be recreated.
+- (void)didReceiveMemoryWarning {
+ [super didReceiveMemoryWarning];
+ // Dispose of any resources that can be recreated.
}
@end
diff --git a/Example/Core/App/iOS/main.m b/Example/Core/App/iOS/main.m
index 03b5c12..39c05a5 100644
--- a/Example/Core/App/iOS/main.m
+++ b/Example/Core/App/iOS/main.m
@@ -15,9 +15,8 @@
@import UIKit;
#import "FIRAppDelegate.h"
-int main(int argc, char * argv[])
-{
- @autoreleasepool {
- return UIApplicationMain(argc, argv, nil, NSStringFromClass([FIRAppDelegate class]));
- }
+int main(int argc, char* argv[]) {
+ @autoreleasepool {
+ return UIApplicationMain(argc, argv, nil, NSStringFromClass([FIRAppDelegate class]));
+ }
}
diff --git a/Example/Core/App/macOS/FIRAppDelegate.h b/Example/Core/App/macOS/FIRAppDelegate.h
index e637ef9..96400bd 100644
--- a/Example/Core/App/macOS/FIRAppDelegate.h
+++ b/Example/Core/App/macOS/FIRAppDelegate.h
@@ -18,6 +18,4 @@
@interface FIRAppDelegate : NSObject <NSApplicationDelegate>
-
@end
-
diff --git a/Example/Core/App/macOS/FIRAppDelegate.m b/Example/Core/App/macOS/FIRAppDelegate.m
index 9a363a6..1eb675e 100644
--- a/Example/Core/App/macOS/FIRAppDelegate.m
+++ b/Example/Core/App/macOS/FIRAppDelegate.m
@@ -23,13 +23,11 @@
@implementation FIRAppDelegate
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
- // Insert code here to initialize your application
+ // Insert code here to initialize your application
}
-
- (void)applicationWillTerminate:(NSNotification *)aNotification {
- // Insert code here to tear down your application
+ // Insert code here to tear down your application
}
-
@end
diff --git a/Example/Core/App/macOS/FIRViewController.h b/Example/Core/App/macOS/FIRViewController.h
index efee5d5..72497a3 100644
--- a/Example/Core/App/macOS/FIRViewController.h
+++ b/Example/Core/App/macOS/FIRViewController.h
@@ -18,6 +18,4 @@
@interface FIRViewController : NSViewController
-
@end
-
diff --git a/Example/Core/App/macOS/FIRViewController.m b/Example/Core/App/macOS/FIRViewController.m
index 08c5bb5..616257f 100644
--- a/Example/Core/App/macOS/FIRViewController.m
+++ b/Example/Core/App/macOS/FIRViewController.m
@@ -19,17 +19,15 @@
@implementation FIRViewController
- (void)viewDidLoad {
- [super viewDidLoad];
+ [super viewDidLoad];
- // Do any additional setup after loading the view.
+ // Do any additional setup after loading the view.
}
-
- (void)setRepresentedObject:(id)representedObject {
- [super setRepresentedObject:representedObject];
+ [super setRepresentedObject:representedObject];
- // Update the view, if already loaded.
+ // Update the view, if already loaded.
}
-
@end
diff --git a/Example/Core/App/macOS/main.m b/Example/Core/App/macOS/main.m
index e8858a6..65a9352 100644
--- a/Example/Core/App/macOS/main.m
+++ b/Example/Core/App/macOS/main.m
@@ -16,6 +16,4 @@
#import <Cocoa/Cocoa.h>
-int main(int argc, const char * argv[]) {
- return NSApplicationMain(argc, argv);
-}
+int main(int argc, const char* argv[]) { return NSApplicationMain(argc, argv); }
diff --git a/Example/Core/Tests/FIRAppAssociationRegistrationUnitTests.m b/Example/Core/Tests/FIRAppAssociationRegistrationUnitTests.m
index dd6a91a..186e61b 100644
--- a/Example/Core/Tests/FIRAppAssociationRegistrationUnitTests.m
+++ b/Example/Core/Tests/FIRAppAssociationRegistrationUnitTests.m
@@ -34,9 +34,7 @@ static NSString *kKey2 = @"key2";
/** @var gCreateNewObject
@brief A block that returns a new object everytime it is called.
*/
-static id _Nullable (^gCreateNewObject)() = ^id _Nullable() {
- return [[NSObject alloc] init];
-};
+static id _Nullable (^gCreateNewObject)() = ^id _Nullable() { return [[NSObject alloc] init]; };
/** @class FIRAppAssociationRegistrationTests
@brief Tests for @c FIRAppAssociationRegistration
@@ -52,8 +50,8 @@ static id _Nullable (^gCreateNewObject)() = ^id _Nullable() {
id result = [FIRAppAssociationRegistration registeredObjectWithHost:host
key:kKey
creationBlock:^id _Nullable() {
- return obj;
- }];
+ return obj;
+ }];
XCTAssertEqual(obj, result);
}
@@ -62,8 +60,8 @@ static id _Nullable (^gCreateNewObject)() = ^id _Nullable() {
id obj = [FIRAppAssociationRegistration registeredObjectWithHost:host
key:kKey
creationBlock:^id _Nullable() {
- return nil;
- }];
+ return nil;
+ }];
XCTAssertNil(obj);
}
@@ -76,10 +74,10 @@ static id _Nullable (^gCreateNewObject)() = ^id _Nullable() {
[FIRAppAssociationRegistration registeredObjectWithHost:host
key:kKey
creationBlock:^id _Nullable() {
- id obj = gCreateNewObject();
- weakObj = obj;
- return obj;
- }];
+ id obj = gCreateNewObject();
+ weakObj = obj;
+ return obj;
+ }];
// Verify that neither the host nor the object is released yet, i.e., the host owns the object
// because nothing else retains the object.
XCTAssertNotNil(weakHost);
@@ -139,14 +137,15 @@ static id _Nullable (^gCreateNewObject)() = ^id _Nullable() {
- (void)testReentrySameHostSameKey {
id host = gCreateNewObject();
- XCTAssertThrows([FIRAppAssociationRegistration registeredObjectWithHost:host
- key:kKey
- creationBlock:^id _Nullable() {
- [FIRAppAssociationRegistration registeredObjectWithHost:host
- key:kKey
- creationBlock:gCreateNewObject];
- return gCreateNewObject();
- }]);
+ XCTAssertThrows([FIRAppAssociationRegistration
+ registeredObjectWithHost:host
+ key:kKey
+ creationBlock:^id _Nullable() {
+ [FIRAppAssociationRegistration registeredObjectWithHost:host
+ key:kKey
+ creationBlock:gCreateNewObject];
+ return gCreateNewObject();
+ }]);
}
- (void)testReentrySameHostDifferentKey {
@@ -154,11 +153,12 @@ static id _Nullable (^gCreateNewObject)() = ^id _Nullable() {
[FIRAppAssociationRegistration registeredObjectWithHost:host
key:kKey1
creationBlock:^id _Nullable() {
- [FIRAppAssociationRegistration registeredObjectWithHost:host
- key:kKey2
- creationBlock:gCreateNewObject];
- return gCreateNewObject();
- }];
+ [FIRAppAssociationRegistration
+ registeredObjectWithHost:host
+ key:kKey2
+ creationBlock:gCreateNewObject];
+ return gCreateNewObject();
+ }];
// Expect no exception raised.
}
@@ -168,11 +168,12 @@ static id _Nullable (^gCreateNewObject)() = ^id _Nullable() {
[FIRAppAssociationRegistration registeredObjectWithHost:host1
key:kKey
creationBlock:^id _Nullable() {
- [FIRAppAssociationRegistration registeredObjectWithHost:host2
- key:kKey
- creationBlock:gCreateNewObject];
- return gCreateNewObject();
- }];
+ [FIRAppAssociationRegistration
+ registeredObjectWithHost:host2
+ key:kKey
+ creationBlock:gCreateNewObject];
+ return gCreateNewObject();
+ }];
// Expect no exception raised.
}
@@ -182,11 +183,12 @@ static id _Nullable (^gCreateNewObject)() = ^id _Nullable() {
[FIRAppAssociationRegistration registeredObjectWithHost:host1
key:kKey1
creationBlock:^id _Nullable() {
- [FIRAppAssociationRegistration registeredObjectWithHost:host2
- key:kKey2
- creationBlock:gCreateNewObject];
- return gCreateNewObject();
- }];
+ [FIRAppAssociationRegistration
+ registeredObjectWithHost:host2
+ key:kKey2
+ creationBlock:gCreateNewObject];
+ return gCreateNewObject();
+ }];
// Expect no exception raised.
}
diff --git a/Example/Core/Tests/FIRAppTest.m b/Example/Core/Tests/FIRAppTest.m
index ab83eea..a4f6803 100644
--- a/Example/Core/Tests/FIRAppTest.m
+++ b/Example/Core/Tests/FIRAppTest.m
@@ -12,9 +12,10 @@
// See the License for the specific language governing permissions and
// limitations under the License.
+#import "FIRTestCase.h"
+
#import "FirebaseCommunity/FIRAppInternal.h"
#import "FirebaseCommunity/FIROptionsInternal.h"
-#import "FIRTestCase.h"
NSString *const kFIRTestAppName1 = @"test_app_name_1";
NSString *const kFIRTestAppName2 = @"test-app-name-2";
@@ -43,7 +44,6 @@ NSString *const kFIRTestAppName2 = @"test-app-name-2";
@end
-
@interface FIRAppTest : FIRTestCase
@property(nonatomic) id appClassMock;
@@ -73,8 +73,8 @@ NSString *const kFIRTestAppName2 = @"test-app-name-2";
}
- (void)testConfigure {
- NSDictionary *expectedUserInfo = [self expectedUserInfoWithAppName:kFIRDefaultAppName
- isDefaultApp:YES];
+ NSDictionary *expectedUserInfo =
+ [self expectedUserInfoWithAppName:kFIRDefaultAppName isDefaultApp:YES];
OCMExpect([self.notificationCenterMock postNotificationName:kFIRAppReadyToConfigureSDKNotification
object:[FIRApp class]
userInfo:expectedUserInfo]);
@@ -99,8 +99,8 @@ NSString *const kFIRTestAppName2 = @"test-app-name-2";
XCTAssertThrows([FIRApp configureWithOptions:nil]);
XCTAssertTrue([FIRApp allApps].count == 0);
- NSDictionary *expectedUserInfo = [self expectedUserInfoWithAppName:kFIRDefaultAppName
- isDefaultApp:YES];
+ NSDictionary *expectedUserInfo =
+ [self expectedUserInfoWithAppName:kFIRDefaultAppName isDefaultApp:YES];
OCMExpect([self.notificationCenterMock postNotificationName:kFIRAppReadyToConfigureSDKNotification
object:[FIRApp class]
userInfo:expectedUserInfo]);
@@ -128,8 +128,8 @@ NSString *const kFIRTestAppName2 = @"test-app-name-2";
storageBucket:nil
deepLinkURLScheme:nil];
- NSDictionary *expectedUserInfo = [self expectedUserInfoWithAppName:kFIRDefaultAppName
- isDefaultApp:YES];
+ NSDictionary *expectedUserInfo =
+ [self expectedUserInfoWithAppName:kFIRDefaultAppName isDefaultApp:YES];
OCMExpect([self.notificationCenterMock postNotificationName:kFIRAppReadyToConfigureSDKNotification
object:[FIRApp class]
userInfo:expectedUserInfo]);
@@ -149,12 +149,12 @@ NSString *const kFIRTestAppName2 = @"test-app-name-2";
XCTAssertThrows([FIRApp configureWithName:nil options:[FIROptions defaultOptions]]);
XCTAssertThrows([FIRApp configureWithName:kFIRTestAppName1 options:nil]);
XCTAssertThrows([FIRApp configureWithName:@"" options:[FIROptions defaultOptions]]);
- XCTAssertThrows([FIRApp configureWithName:kFIRDefaultAppName
- options:[FIROptions defaultOptions]]);
+ XCTAssertThrows(
+ [FIRApp configureWithName:kFIRDefaultAppName options:[FIROptions defaultOptions]]);
XCTAssertTrue([FIRApp allApps].count == 0);
- NSDictionary *expectedUserInfo = [self expectedUserInfoWithAppName:kFIRTestAppName1
- isDefaultApp:NO];
+ NSDictionary *expectedUserInfo =
+ [self expectedUserInfoWithAppName:kFIRTestAppName1 isDefaultApp:NO];
OCMExpect([self.notificationCenterMock postNotificationName:kFIRAppReadyToConfigureSDKNotification
object:[FIRApp class]
userInfo:expectedUserInfo]);
@@ -176,8 +176,8 @@ NSString *const kFIRTestAppName2 = @"test-app-name-2";
FIROptions *newOptions = [options copy];
newOptions.deepLinkURLScheme = kDeepLinkURLScheme;
- NSDictionary *expectedUserInfo1 = [self expectedUserInfoWithAppName:kFIRTestAppName1
- isDefaultApp:NO];
+ NSDictionary *expectedUserInfo1 =
+ [self expectedUserInfoWithAppName:kFIRTestAppName1 isDefaultApp:NO];
OCMExpect([self.notificationCenterMock postNotificationName:kFIRAppReadyToConfigureSDKNotification
object:[FIRApp class]
userInfo:expectedUserInfo1]);
@@ -197,8 +197,8 @@ NSString *const kFIRTestAppName2 = @"test-app-name-2";
storageBucket:nil
deepLinkURLScheme:nil];
- NSDictionary *expectedUserInfo2 = [self expectedUserInfoWithAppName:kFIRTestAppName2
- isDefaultApp:NO];
+ NSDictionary *expectedUserInfo2 =
+ [self expectedUserInfoWithAppName:kFIRTestAppName2 isDefaultApp:NO];
OCMExpect([self.notificationCenterMock postNotificationName:kFIRAppReadyToConfigureSDKNotification
object:[FIRApp class]
userInfo:expectedUserInfo2]);
@@ -275,12 +275,12 @@ NSString *const kFIRTestAppName2 = @"test-app-name-2";
[app getTokenForcingRefresh:YES
withCallback:^(NSString *_Nullable token, NSError *_Nullable error) {
- getTokenCallbackWasCalled = YES;
- }];
+ getTokenCallbackWasCalled = YES;
+ }];
XCTAssert(getTokenCallbackWasCalled,
@"The callback should be invoked by the base implementation when no block for "
- "'getTokenImplementation' has been specified.");
+ "'getTokenImplementation' has been specified.");
getTokenCallbackWasCalled = NO;
@@ -291,18 +291,18 @@ NSString *const kFIRTestAppName2 = @"test-app-name-2";
};
[app getTokenForcingRefresh:YES
withCallback:^(NSString *_Nullable token, NSError *_Nullable error) {
- getTokenCallbackWasCalled = YES;
- }];
+ getTokenCallbackWasCalled = YES;
+ }];
XCTAssert(getTokenImplementationWasCalled,
@"The 'getTokenImplementation' block was never called.");
XCTAssert(passedRefreshValue,
@"The value for the 'refresh' parameter wasn't passed to the 'getTokenImplementation' "
- "block correctly.");
+ "block correctly.");
XCTAssert(getTokenCallbackWasCalled,
@"The 'getTokenImplementation' should have invoked the callback. This could be an "
- "error in this test, or the callback parameter may not have been passed to the "
- "implementation correctly.");
+ "error in this test, or the callback parameter may not have been passed to the "
+ "implementation correctly.");
getTokenImplementationWasCalled = NO;
getTokenCallbackWasCalled = NO;
@@ -310,12 +310,11 @@ NSString *const kFIRTestAppName2 = @"test-app-name-2";
[app getTokenForcingRefresh:NO
withCallback:^(NSString *_Nullable token, NSError *_Nullable error) {
- getTokenCallbackWasCalled = YES;
- }];
+ getTokenCallbackWasCalled = YES;
+ }];
- XCTAssertFalse(passedRefreshValue,
- @"The value for the 'refresh' parameter wasn't passed to the "
- "'getTokenImplementation' block correctly.");
+ XCTAssertFalse(passedRefreshValue, @"The value for the 'refresh' parameter wasn't passed to the "
+ "'getTokenImplementation' block correctly.");
}
- (void)testModifyingOptionsThrows {
@@ -338,8 +337,8 @@ NSString *const kFIRTestAppName2 = @"test-app-name-2";
}
- (void)testOptionsLocking {
- FIROptions *options = [[FIROptions alloc] initWithGoogleAppID:kGoogleAppID
- GCMSenderID:kGCMSenderID];
+ FIROptions *options =
+ [[FIROptions alloc] initWithGoogleAppID:kGoogleAppID GCMSenderID:kGCMSenderID];
options.projectID = kProjectID;
options.databaseURL = kDatabaseURL;
@@ -484,14 +483,14 @@ NSString *const kFIRTestAppName2 = @"test-app-name-2";
XCTAssertFalse([FIRApp validateAppIDFormat:@"01:1337:ios:deadbeef" withVersion:kGoodVersionV1]);
XCTAssertFalse([FIRApp validateAppIDFormat:@"10:1337:ios:deadbeef" withVersion:kGoodVersionV1]);
XCTAssertFalse([FIRApp validateAppIDFormat:@"11:1337:ios:deadbeef" withVersion:kGoodVersionV1]);
- XCTAssertFalse([FIRApp validateAppIDFormat:@"21:1337:ios:5e18052ab54fbfec"
- withVersion:kGoodVersionV2]);
- XCTAssertFalse([FIRApp validateAppIDFormat:@"22:1337:ios:5e18052ab54fbfec"
- withVersion:kGoodVersionV2]);
- XCTAssertFalse([FIRApp validateAppIDFormat:@"02:1337:ios:5e18052ab54fbfec"
- withVersion:kGoodVersionV2]);
- XCTAssertFalse([FIRApp validateAppIDFormat:@"20:1337:ios:5e18052ab54fbfec"
- withVersion:kGoodVersionV2]);
+ XCTAssertFalse(
+ [FIRApp validateAppIDFormat:@"21:1337:ios:5e18052ab54fbfec" withVersion:kGoodVersionV2]);
+ XCTAssertFalse(
+ [FIRApp validateAppIDFormat:@"22:1337:ios:5e18052ab54fbfec" withVersion:kGoodVersionV2]);
+ XCTAssertFalse(
+ [FIRApp validateAppIDFormat:@"02:1337:ios:5e18052ab54fbfec" withVersion:kGoodVersionV2]);
+ XCTAssertFalse(
+ [FIRApp validateAppIDFormat:@"20:1337:ios:5e18052ab54fbfec" withVersion:kGoodVersionV2]);
// Extra fields.
XCTAssertFalse([FIRApp validateAppIDFormat:@"ab:1:1337:ios:deadbeef" withVersion:kGoodVersionV1]);
@@ -532,31 +531,31 @@ NSString *const kFIRTestAppName2 = @"test-app-name-2";
XCTAssertFalse([FIRApp validateAppIDFingerprint:kGoodAppIDV1 withVersion:kGoodAppIDV1]);
// Versions digits that may make a partial match.
- XCTAssertFalse([FIRApp validateAppIDFingerprint:@"01:1337:ios:deadbeef"
- withVersion:kGoodVersionV1]);
- XCTAssertFalse([FIRApp validateAppIDFingerprint:@"10:1337:ios:deadbeef"
- withVersion:kGoodVersionV1]);
- XCTAssertFalse([FIRApp validateAppIDFingerprint:@"11:1337:ios:deadbeef"
- withVersion:kGoodVersionV1]);
- XCTAssertFalse([FIRApp validateAppIDFingerprint:@"21:1337:ios:5e18052ab54fbfec"
- withVersion:kGoodVersionV2]);
- XCTAssertFalse([FIRApp validateAppIDFingerprint:@"22:1337:ios:5e18052ab54fbfec"
- withVersion:kGoodVersionV2]);
- XCTAssertFalse([FIRApp validateAppIDFingerprint:@"02:1337:ios:5e18052ab54fbfec"
- withVersion:kGoodVersionV2]);
- XCTAssertFalse([FIRApp validateAppIDFingerprint:@"20:1337:ios:5e18052ab54fbfec"
- withVersion:kGoodVersionV2]);
+ XCTAssertFalse(
+ [FIRApp validateAppIDFingerprint:@"01:1337:ios:deadbeef" withVersion:kGoodVersionV1]);
+ XCTAssertFalse(
+ [FIRApp validateAppIDFingerprint:@"10:1337:ios:deadbeef" withVersion:kGoodVersionV1]);
+ XCTAssertFalse(
+ [FIRApp validateAppIDFingerprint:@"11:1337:ios:deadbeef" withVersion:kGoodVersionV1]);
+ XCTAssertFalse(
+ [FIRApp validateAppIDFingerprint:@"21:1337:ios:5e18052ab54fbfec" withVersion:kGoodVersionV2]);
+ XCTAssertFalse(
+ [FIRApp validateAppIDFingerprint:@"22:1337:ios:5e18052ab54fbfec" withVersion:kGoodVersionV2]);
+ XCTAssertFalse(
+ [FIRApp validateAppIDFingerprint:@"02:1337:ios:5e18052ab54fbfec" withVersion:kGoodVersionV2]);
+ XCTAssertFalse(
+ [FIRApp validateAppIDFingerprint:@"20:1337:ios:5e18052ab54fbfec" withVersion:kGoodVersionV2]);
// Extra fields.
- XCTAssertFalse([FIRApp validateAppIDFingerprint:@"ab:1:1337:ios:deadbeef"
- withVersion:kGoodVersionV1]);
- XCTAssertFalse([FIRApp validateAppIDFingerprint:@"1:ab:1337:ios:deadbeef"
- withVersion:kGoodVersionV1]);
- XCTAssertFalse([FIRApp validateAppIDFingerprint:@"1:1337:ab:ios:deadbeef"
- withVersion:kGoodVersionV1]);
- XCTAssertFalse([FIRApp validateAppIDFingerprint:@"1:1337:ios:ab:deadbeef"
- withVersion:kGoodVersionV1]);
- XCTAssertFalse([FIRApp validateAppIDFingerprint:@"1:1337:ios:deadbeef:ab"
- withVersion:kGoodVersionV1]);
+ XCTAssertFalse(
+ [FIRApp validateAppIDFingerprint:@"ab:1:1337:ios:deadbeef" withVersion:kGoodVersionV1]);
+ XCTAssertFalse(
+ [FIRApp validateAppIDFingerprint:@"1:ab:1337:ios:deadbeef" withVersion:kGoodVersionV1]);
+ XCTAssertFalse(
+ [FIRApp validateAppIDFingerprint:@"1:1337:ab:ios:deadbeef" withVersion:kGoodVersionV1]);
+ XCTAssertFalse(
+ [FIRApp validateAppIDFingerprint:@"1:1337:ios:ab:deadbeef" withVersion:kGoodVersionV1]);
+ XCTAssertFalse(
+ [FIRApp validateAppIDFingerprint:@"1:1337:ios:deadbeef:ab" withVersion:kGoodVersionV1]);
}
#pragma mark - Internal Methods
@@ -564,7 +563,7 @@ NSString *const kFIRTestAppName2 = @"test-app-name-2";
- (void)testAuthGetUID {
[FIRApp configure];
- [FIRApp defaultApp].getUIDImplementation = ^NSString *{ return @"highlander"; };
+ [FIRApp defaultApp].getUIDImplementation = ^NSString * { return @"highlander"; };
XCTAssertEqual([[FIRApp defaultApp] getUID], @"highlander");
}
@@ -583,8 +582,8 @@ NSString *const kFIRTestAppName2 = @"test-app-name-2";
#pragma mark - private
-- (NSDictionary <NSString *, NSObject *> *)expectedUserInfoWithAppName:(NSString *)name
- isDefaultApp:(BOOL)isDefaultApp {
+- (NSDictionary<NSString *, NSObject *> *)expectedUserInfoWithAppName:(NSString *)name
+ isDefaultApp:(BOOL)isDefaultApp {
return @{
kFIRAppNameKey : name,
kFIRAppIsDefaultAppKey : [NSNumber numberWithBool:isDefaultApp],
diff --git a/Example/Core/Tests/FIRBundleUtilTest.m b/Example/Core/Tests/FIRBundleUtilTest.m
index 22863a4..7a9ddc8 100644
--- a/Example/Core/Tests/FIRBundleUtilTest.m
+++ b/Example/Core/Tests/FIRBundleUtilTest.m
@@ -12,10 +12,10 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-#import "FirebaseCommunity/FIRBundleUtil.h"
-
#import "FIRTestCase.h"
+#import "FirebaseCommunity/FIRBundleUtil.h"
+
static NSString *const kResultPath = @"resultPath";
static NSString *const kResourceName = @"resourceName";
static NSString *const kFileType = @"fileType";
@@ -43,11 +43,10 @@ static NSString *const kFileType = @"fileType";
- (void)testFindOptionsDictionaryPath {
[OCMStub([self.mockBundle pathForResource:kResourceName ofType:kFileType]) andReturn:kResultPath];
- XCTAssertEqualObjects(
- [FIRBundleUtil optionsDictionaryPathWithResourceName:kResourceName
- andFileType:kFileType
- inBundles:@[ self.mockBundle ]],
- kResultPath);
+ XCTAssertEqualObjects([FIRBundleUtil optionsDictionaryPathWithResourceName:kResourceName
+ andFileType:kFileType
+ inBundles:@[ self.mockBundle ]],
+ kResultPath);
}
- (void)testFindOptionsDictionaryPath_notFound {
@@ -61,11 +60,10 @@ static NSString *const kFileType = @"fileType";
[OCMStub([self.mockBundle pathForResource:kResourceName ofType:kFileType]) andReturn:kResultPath];
NSArray *bundles = @[ mockBundleEmpty, self.mockBundle ];
- XCTAssertEqualObjects(
- [FIRBundleUtil optionsDictionaryPathWithResourceName:kResourceName
- andFileType:kFileType
- inBundles:bundles],
- kResultPath);
+ XCTAssertEqualObjects([FIRBundleUtil optionsDictionaryPathWithResourceName:kResourceName
+ andFileType:kFileType
+ inBundles:bundles],
+ kResultPath);
}
- (void)testBundleIdentifierExistsInBundles {
@@ -80,7 +78,7 @@ static NSString *const kFileType = @"fileType";
}
- (void)testBundleIdentifierExistsInBundles_emptyBundlesArray {
- XCTAssertFalse([FIRBundleUtil hasBundleIdentifier:@"com.google.test" inBundles:@[ ]]);
+ XCTAssertFalse([FIRBundleUtil hasBundleIdentifier:@"com.google.test" inBundles:@[]]);
}
@end
diff --git a/Example/Core/Tests/FIRLoggerTest.m b/Example/Core/Tests/FIRLoggerTest.m
index c4d252a..a89dbb3 100644
--- a/Example/Core/Tests/FIRLoggerTest.m
+++ b/Example/Core/Tests/FIRLoggerTest.m
@@ -12,9 +12,10 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-#import "FirebaseCommunity/FIRLogger.h"
#import "FIRTestCase.h"
+#import "FirebaseCommunity/FIRLogger.h"
+
#import <asl.h>
// The following constants are exposed from FIRLogger for unit tests.
@@ -155,7 +156,6 @@ static NSString *const kMessageCode = @"I-COR000001";
XCTAssertThrows(FIRLogError(kFIRLoggerCore, @"A-APP000001", @"Message."));
}
-
- (void)testLoggerInterface {
XCTAssertNoThrow(FIRLogError(kFIRLoggerCore, kMessageCode, @"Message."));
XCTAssertNoThrow(FIRLogError(kFIRLoggerCore, kMessageCode, @"Configure %@.", @"blah"));
@@ -173,12 +173,11 @@ static NSString *const kMessageCode = @"I-COR000001";
XCTAssertNoThrow(FIRLogDebug(kFIRLoggerCore, kMessageCode, @"Configure %@.", @"blah"));
}
-
// asl_set_filter does not perform as expected in unit test environment with simulator. The
// following test only checks whether the logs have been sent to system with the default settings in
// the unit test environment.
- (void)testSystemLogWithDefaultStatus {
-#if !(BUG128) // Disable until https://github.com/firebase/firebase-ios-sdk/issues/128 is fixed
+#if !(BUG128) // Disable until https://github.com/firebase/firebase-ios-sdk/issues/128 is fixed
// Test fails on device and iOS 9 simulators - b/38130372
return;
#else
@@ -225,16 +224,14 @@ static NSString *const kMessageCode = @"I-COR000001";
XCTAssertEqual(FIRLoggerLevelDebug, ASL_LEVEL_DEBUG);
}
-
// Helper functions.
- (BOOL)logExists {
[self drainFIRClientQueue];
- NSString *correctMsg = [NSString stringWithFormat:@"%@[%@] %@", kFIRLoggerCore, kMessageCode,
- self.randomLogString];
+ NSString *correctMsg =
+ [NSString stringWithFormat:@"%@[%@] %@", kFIRLoggerCore, kMessageCode, self.randomLogString];
return [self messageWasLogged:correctMsg];
}
-
- (void)drainFIRClientQueue {
dispatch_semaphore_t workerSemaphore = dispatch_semaphore_create(0);
dispatch_async(getFIRClientQueue(), ^{
diff --git a/Example/Core/Tests/FIROptionsTest.m b/Example/Core/Tests/FIROptionsTest.m
index ec3bc27..1584633 100644
--- a/Example/Core/Tests/FIROptionsTest.m
+++ b/Example/Core/Tests/FIROptionsTest.m
@@ -12,12 +12,12 @@
// See the License for the specific language governing permissions and
// limitations under the License.
+#import "FIRTestCase.h"
+
#import "FirebaseCommunity/FIRAppInternal.h"
#import "FirebaseCommunity/FIRBundleUtil.h"
#import "FirebaseCommunity/FIROptionsInternal.h"
-#import "FIRTestCase.h"
-
extern NSString *const kFIRIsMeasurementEnabled;
extern NSString *const kFIRIsAnalyticsCollectionEnabled;
extern NSString *const kFIRIsAnalyticsCollectionDeactivated;
@@ -42,8 +42,7 @@ extern NSString *const kFIRLibraryVersionID;
- (void)testInit {
NSDictionary *optionsDictionary = [FIROptions defaultOptionsDictionary];
- FIROptions *options =
- [[FIROptions alloc] initInternalWithOptionsDictionary:optionsDictionary];
+ FIROptions *options = [[FIROptions alloc] initInternalWithOptionsDictionary:optionsDictionary];
[self assertOptionsMatchDefaults:options andProjectID:YES];
XCTAssertNil(options.deepLinkURLScheme);
XCTAssertTrue(options.usingOptionsFromDefaultPlist);
@@ -95,8 +94,8 @@ extern NSString *const kFIRLibraryVersionID;
XCTAssertEqualObjects(options.deepLinkURLScheme, kDeepLinkURLScheme);
XCTAssertFalse(options.usingOptionsFromDefaultPlist);
- FIROptions *options2 = [[FIROptions alloc] initWithGoogleAppID:kGoogleAppID
- GCMSenderID:kGCMSenderID];
+ FIROptions *options2 =
+ [[FIROptions alloc] initWithGoogleAppID:kGoogleAppID GCMSenderID:kGCMSenderID];
options2.androidClientID = kAndroidClientID;
options2.APIKey = kAPIKey;
options2.bundleID = kBundleID;
@@ -112,15 +111,15 @@ extern NSString *const kFIRLibraryVersionID;
// nil GoogleAppID should throw an exception
XCTAssertThrows([[FIROptions alloc] initWithGoogleAppID:nil
- bundleID:kBundleID
- GCMSenderID:kGCMSenderID
- APIKey:kCustomizedAPIKey
- clientID:nil
- trackingID:nil
- androidClientID:nil
- databaseURL:nil
- storageBucket:nil
- deepLinkURLScheme:nil]);
+ bundleID:kBundleID
+ GCMSenderID:kGCMSenderID
+ APIKey:kCustomizedAPIKey
+ clientID:nil
+ trackingID:nil
+ androidClientID:nil
+ databaseURL:nil
+ storageBucket:nil
+ deepLinkURLScheme:nil]);
}
- (void)testinitWithContentsOfFile {
@@ -159,8 +158,8 @@ extern NSString *const kFIRLibraryVersionID;
- (void)testCopyingProperties {
NSMutableString *mutableString;
- FIROptions *options = [[FIROptions alloc] initWithGoogleAppID:kGoogleAppID
- GCMSenderID:kGCMSenderID];
+ FIROptions *options =
+ [[FIROptions alloc] initWithGoogleAppID:kGoogleAppID GCMSenderID:kGCMSenderID];
mutableString = [[NSMutableString alloc] initWithString:@"1"];
options.APIKey = mutableString;
[mutableString appendString:@"2"];
@@ -322,7 +321,7 @@ extern NSString *const kFIRLibraryVersionID;
options = [[FIROptions alloc] initInternalWithOptionsDictionary:optionsDictionary];
mainDictionary = @{ kFIRIsAnalyticsCollectionDeactivated : @NO };
OCMExpect([mainBundleMock infoDictionary]).andReturn(mainDictionary);
- expectedAnalyticsOptions = @{
+ expectedAnalyticsOptions = @{
kFIRIsAnalyticsCollectionDeactivated : @NO, // override
kFIRIsAnalyticsCollectionEnabled : @YES,
kFIRIsMeasurementEnabled : @YES
diff --git a/Example/Shared/FIRSampleAppUtilities.h b/Example/Shared/FIRSampleAppUtilities.h
index 891c2b6..34da5ae 100644
--- a/Example/Shared/FIRSampleAppUtilities.h
+++ b/Example/Shared/FIRSampleAppUtilities.h
@@ -20,7 +20,7 @@ NS_SWIFT_NAME(SampleAppUtilities)
@interface FIRSampleAppUtilities : NSObject
+ (BOOL)appContainsRealServiceInfoPlist;
-+ (void)presentAlertForInvalidServiceInfoPlistFromViewController:(UIViewController *)
- viewController NS_SWIFT_NAME(presentAlertForInvalidServiceInfoPlistFrom(_:));
++ (void)presentAlertForInvalidServiceInfoPlistFromViewController:(UIViewController *)viewController
+ NS_SWIFT_NAME(presentAlertForInvalidServiceInfoPlistFrom(_:));
@end
diff --git a/Example/Shared/FIRSampleAppUtilities.m b/Example/Shared/FIRSampleAppUtilities.m
index a0a4794..7a777d0 100644
--- a/Example/Shared/FIRSampleAppUtilities.m
+++ b/Example/Shared/FIRSampleAppUtilities.m
@@ -55,8 +55,8 @@ NSString *const kInvalidPlistAlertMessage = @"This sample app needs to be update
return NO;
}
- NSString *plistFilePath = [bundle pathForResource:kServiceInfoFileName
- ofType:kServiceInfoFileType];
+ NSString *plistFilePath =
+ [bundle pathForResource:kServiceInfoFileName ofType:kServiceInfoFileType];
if (!plistFilePath.length) {
return NO;
}
@@ -78,24 +78,25 @@ NSString *const kInvalidPlistAlertMessage = @"This sample app needs to be update
return YES;
}
-+ (void)presentAlertForInvalidServiceInfoPlistFromViewController:(UIViewController *)
- viewController {
++ (void)presentAlertForInvalidServiceInfoPlistFromViewController:
+ (UIViewController *)viewController {
NSString *message = [NSString stringWithFormat:kInvalidPlistAlertMessage, kGithubRepoURLString];
UIAlertController *alertController =
[UIAlertController alertControllerWithTitle:kInvalidPlistAlertTitle
message:message
preferredStyle:UIAlertControllerStyleAlert];
- UIAlertAction *viewReadmeAction =
- [UIAlertAction actionWithTitle:@"View Github"
- style:UIAlertActionStyleDefault
- handler:^(UIAlertAction * _Nonnull action) {
- NSURL *githubURL = [NSURL URLWithString:kGithubRepoURLString];
- [FIRSampleAppUtilities navigateToURL:githubURL fromViewController:viewController];
-
- }];
+ UIAlertAction *viewReadmeAction = [UIAlertAction
+ actionWithTitle:@"View Github"
+ style:UIAlertActionStyleDefault
+ handler:^(UIAlertAction *_Nonnull action) {
+ NSURL *githubURL = [NSURL URLWithString:kGithubRepoURLString];
+ [FIRSampleAppUtilities navigateToURL:githubURL fromViewController:viewController];
+
+ }];
[alertController addAction:viewReadmeAction];
- UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"Close" style:UIAlertActionStyleCancel handler:nil];
+ UIAlertAction *cancelAction =
+ [UIAlertAction actionWithTitle:@"Close" style:UIAlertActionStyleCancel handler:nil];
[alertController addAction:cancelAction];
[viewController presentViewController:alertController animated:YES completion:nil];