Skip to content

Commit

Permalink
Merge branch 'master' into bs-gullogger
Browse files Browse the repository at this point in the history
* master: (27 commits)
  Pass FSTMutations using a vector (#2357)
  Update CI to use CocoaPods 1.6.0 (#2360)
  Add NS_ASSUME_NONNULL_NOTATION for game center sign in (#2359)
  C++ migration: make all methods of `FSTRemoteStore` delegate to C++ (#2337)
  C++ migration: port write stream-related part of `FSTRemoteStore` (#2335)
  Resolve hard dependency of GameKit (#2355)
  Update gRPC certificate bundles locations for Firebase 5.16 (#2353)
  Start pod lib lint CI for IAM (#2347)
  Update library name to `fire-fiam`. (#2352)
  Bump FirebaseAnalyticsInterop version  (#2315)
  Add IAM headless to CI (#2341)
  C++ migration: port watch stream-related part of `FSTRemoteStore` (#2331)
  Open source FIAM headless SDK (#2312)
  Port flaky test fix from web. (#2332)
  Make scripts/style.sh compatible with newer swiftformat versions (0.38) (#2334)
  C++ migration: port `FSTOnlineStateTracker` (#2325)
  Don't build fuzz tests target on Travis (#2330)
  Remove FSTMutationQueue (#2319)
  C++ migration: port `FSTRemoteEvent` (#2320)
  C++ migration: port `FSTTargetChange` (#2318)
  ...
  • Loading branch information
bstpierr committed Feb 8, 2019
2 parents 45e7209 + a22b4cd commit 8264390
Show file tree
Hide file tree
Showing 243 changed files with 19,870 additions and 3,912 deletions.
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ jobs:
- travis_retry ./scripts/if_changed.sh ./scripts/pod_lib_lint.sh FirebaseMessaging.podspec
- travis_retry ./scripts/if_changed.sh ./scripts/pod_lib_lint.sh FirebaseStorage.podspec
- travis_retry ./scripts/if_changed.sh ./scripts/pod_lib_lint.sh FirebaseFunctions.podspec
- travis_retry ./scripts/if_changed.sh ./scripts/pod_lib_lint.sh FirebaseInAppMessaging.podspec
- travis_retry ./scripts/if_changed.sh ./scripts/pod_lib_lint.sh FirebaseInAppMessagingDisplay.podspec

- stage: test
Expand Down Expand Up @@ -98,6 +99,7 @@ jobs:
- travis_retry ./scripts/if_cron.sh ./scripts/pod_lib_lint.sh FirebaseMessaging.podspec --use-libraries --allow-warnings
- travis_retry ./scripts/if_cron.sh ./scripts/pod_lib_lint.sh FirebaseStorage.podspec --use-libraries
- travis_retry ./scripts/if_cron.sh ./scripts/pod_lib_lint.sh FirebaseFunctions.podspec --use-libraries
- travis_retry ./scripts/if_cron.sh ./scripts/pod_lib_lint.sh FirebaseInAppMessaging.podspec --use-libraries
- travis_retry ./scripts/if_cron.sh ./scripts/pod_lib_lint.sh FirebaseInAppMessagingDisplay.podspec --use-libraries

- stage: test
Expand Down Expand Up @@ -186,6 +188,7 @@ jobs:
- travis_retry ./scripts/if_changed.sh ./scripts/pod_lib_lint.sh FirebaseMessaging.podspec
- travis_retry ./scripts/if_changed.sh ./scripts/pod_lib_lint.sh FirebaseStorage.podspec
- travis_retry ./scripts/if_changed.sh ./scripts/pod_lib_lint.sh FirebaseFunctions.podspec
- travis_retry ./scripts/if_changed.sh ./scripts/pod_lib_lint.sh FirebaseInAppMessaging.podspec
- travis_retry ./scripts/if_changed.sh ./scripts/pod_lib_lint.sh FirebaseInAppMessagingDisplay.podspec

- stage: test
Expand Down
2 changes: 1 addition & 1 deletion Carthage.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ binary "https://dl.google.com/dl/firebase/ios/carthage/FirebaseStorageBinary.jso
into the Xcode project and make sure they're added to the
`Copy Bundle Resources` Build Phase :
- For Firestore:
- ./Carthage/Build/iOS/FirebaseFirestore.framework/gRPCCertificates-Firestore.bundle
- ./Carthage/Build/iOS/FirebaseFirestore.framework/gRPCCertificates.bundle
- For Invites:
- ./Carthage/Build/iOS/FirebaseInvites.framework/GoogleSignIn.bundle
- ./Carthage/Build/iOS/FirebaseInvites.framework/GPPACLPickerResources.bundle
Expand Down
14 changes: 14 additions & 0 deletions Example/DynamicLinks/Tests/FIRDLScionLoggingTest.m
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,20 @@ - (void)setUserPropertyWithOrigin:(nonnull NSString *)origin
name:(nonnull NSString *)name
value:(nonnull id)value {
}

- (void)checkLastNotificationForOrigin:(nonnull NSString *)origin
queue:(nonnull dispatch_queue_t)queue
callback:(nonnull void (^)(NSString *_Nullable))
currentLastNotificationProperty {
}

- (void)registerAnalyticsListener:(nonnull id<FIRAnalyticsInteropListener>)listener
withOrigin:(nonnull NSString *)origin {
}

- (void)unregisterAnalyticsListenerWithOrigin:(nonnull NSString *)origin {
}

@end

@interface FIRDLScionLoggingTest : XCTestCase
Expand Down
18 changes: 8 additions & 10 deletions Example/Firebase.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,7 @@
EDD53E2A211B08A300376BFF /* FIRComponentTestUtilities.m in Sources */ = {isa = PBXBuildFile; fileRef = EDD53E28211B08A300376BFF /* FIRComponentTestUtilities.m */; };
EDD53E2B211B08A300376BFF /* FIRComponentTestUtilities.m in Sources */ = {isa = PBXBuildFile; fileRef = EDD53E28211B08A300376BFF /* FIRComponentTestUtilities.m */; };
EDD53E2C211B08A300376BFF /* FIRComponentTestUtilities.m in Sources */ = {isa = PBXBuildFile; fileRef = EDD53E28211B08A300376BFF /* FIRComponentTestUtilities.m */; };
EDF5242C21EA37AA00BB24C6 /* FIRMessagingTestUtilities.m in Sources */ = {isa = PBXBuildFile; fileRef = EDF5242B21EA364600BB24C6 /* FIRMessagingTestUtilities.m */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand Down Expand Up @@ -1345,6 +1346,8 @@
EDD53E24211A442D00376BFF /* FIRAuthInteropFake.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = FIRAuthInteropFake.m; path = Shared/FIRAuthInteropFake.m; sourceTree = "<group>"; };
EDD53E28211B08A300376BFF /* FIRComponentTestUtilities.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = FIRComponentTestUtilities.m; path = Shared/FIRComponentTestUtilities.m; sourceTree = "<group>"; };
EDD53E29211B08A300376BFF /* FIRComponentTestUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FIRComponentTestUtilities.h; path = Shared/FIRComponentTestUtilities.h; sourceTree = "<group>"; };
EDF5242A21EA364600BB24C6 /* FIRMessagingTestUtilities.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FIRMessagingTestUtilities.h; sourceTree = "<group>"; };
EDF5242B21EA364600BB24C6 /* FIRMessagingTestUtilities.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FIRMessagingTestUtilities.m; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -2340,6 +2343,8 @@
DE9315D71E8738B70083EDBF /* FIRMessagingTestNotificationUtilities.m */,
DE37C63A2163D5F30025D03E /* FIRMessagingAnalyticsTest.m */,
DE9315D81E8738B70083EDBF /* Info.plist */,
EDF5242A21EA364600BB24C6 /* FIRMessagingTestUtilities.h */,
EDF5242B21EA364600BB24C6 /* FIRMessagingTestUtilities.m */,
);
path = Tests;
sourceTree = "<group>";
Expand Down Expand Up @@ -4419,6 +4424,7 @@
DE9315F91E8738E60083EDBF /* FIRMessagingFakeConnection.m in Sources */,
DE9316021E8738E60083EDBF /* FIRMessagingServiceTest.m in Sources */,
DE9315FE1E8738E60083EDBF /* FIRMessagingRegistrarTest.m in Sources */,
EDF5242C21EA37AA00BB24C6 /* FIRMessagingTestUtilities.m in Sources */,
DE9316031E8738E60083EDBF /* FIRMessagingSyncMessageManagerTest.m in Sources */,
DE9315FF1E8738E60083EDBF /* FIRMessagingRemoteNotificationsProxyTest.m in Sources */,
DEF61BFD216E8B1100A738D4 /* FIRMessagingReceiverTest.m in Sources */,
Expand Down Expand Up @@ -6452,6 +6458,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = "App Icon & Top Shelf Image";
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
BUNDLE_LOADER = "$(TEST_HOST)";
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
Expand All @@ -6476,11 +6483,6 @@
INFOPLIST_FILE = "$(SRCROOT)/Auth/App/iOS/Auth-Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MTL_ENABLE_DEBUG_INFO = YES;
OTHER_LDFLAGS = (
"$(inherited)",
"-framework",
FirebaseAuth,
);
PRODUCT_BUNDLE_IDENTIFIER = "com.google.Auth-Example-tvOS";
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = appletvos;
Expand All @@ -6495,6 +6497,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = "App Icon & Top Shelf Image";
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
BUNDLE_LOADER = "$(TEST_HOST)";
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
Expand All @@ -6520,11 +6523,6 @@
INFOPLIST_FILE = "$(SRCROOT)/Auth/App/iOS/Auth-Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MTL_ENABLE_DEBUG_INFO = NO;
OTHER_LDFLAGS = (
"$(inherited)",
"-framework",
FirebaseAuth,
);
PRODUCT_BUNDLE_IDENTIFIER = "com.google.Auth-Example-tvOS";
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = appletvos;
Expand Down
14 changes: 14 additions & 0 deletions Example/Messaging/Tests/FIRMessagingAnalyticsTest.m
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,20 @@ - (NSInteger)maxUserProperties:(nonnull NSString *)origin {
- (void)setConditionalUserProperty:(nonnull FIRAConditionalUserProperty *)conditionalUserProperty {
}

- (void)checkLastNotificationForOrigin:(nonnull NSString *)origin
queue:(nonnull dispatch_queue_t)queue
callback:(nonnull void (^)(NSString *_Nullable))
currentLastNotificationProperty {
}

- (void)registerAnalyticsListener:(nonnull id<FIRAnalyticsInteropListener>)listener
withOrigin:(nonnull NSString *)origin {
}

- (void)unregisterAnalyticsListenerWithOrigin:(nonnull NSString *)origin {
}


@end

@interface FIRMessagingAnalytics (ExposedForTest)
Expand Down
9 changes: 7 additions & 2 deletions Example/Messaging/Tests/FIRMessagingLinkHandlingTest.m
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@
#import "FIRMessaging.h"
#import "FIRMessagingConstants.h"
#import "FIRMessagingTestNotificationUtilities.h"
#import "FIRMessagingTestUtilities.h"

NSString *const kFIRMessagingTestsLinkHandlingSuiteName = @"com.messaging.test_linkhandling";

@interface FIRMessaging ()

+ (FIRMessaging *)messagingForTests;
- (NSURL *)linkURLFromMessage:(NSDictionary *)message;

@end
Expand All @@ -39,10 +41,13 @@ @implementation FIRMessagingLinkHandlingTest

- (void)setUp {
[super setUp];
_messaging = [FIRMessaging messagingForTests];

NSUserDefaults *defaults = [[NSUserDefaults alloc] initWithSuiteName:kFIRMessagingTestsLinkHandlingSuiteName];
_messaging = [FIRMessagingTestUtilities messagingForTestsWithUserDefaults:defaults];
}

- (void)tearDown {
[self.messaging.messagingUserDefaults removePersistentDomainForName:kFIRMessagingTestsLinkHandlingSuiteName];
_messaging = nil;
[super tearDown];
}
Expand Down
17 changes: 11 additions & 6 deletions Example/Messaging/Tests/FIRMessagingReceiverTest.m
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,9 @@

#import "FIRMessaging.h"
#import "FIRMessaging_Private.h"
#import "FIRMessagingTestUtilities.h"

@interface FIRMessaging ()
+ (FIRMessaging *)messagingForTests;
@end
NSString *const kFIRMessagingTestsReceiverSuiteName = @"com.messaging.test_receiverTest";

@interface FIRMessagingReceiverTest : XCTestCase
@property(nonatomic, readonly, strong) FIRMessaging *messaging;
Expand All @@ -36,9 +35,15 @@ @implementation FIRMessagingReceiverTest
- (void)setUp {
[super setUp];

_messaging = [FIRMessaging messagingForTests];
[[NSUserDefaults standardUserDefaults]
removePersistentDomainForName:[NSBundle mainBundle].bundleIdentifier];
NSUserDefaults *defaults = [[NSUserDefaults alloc] initWithSuiteName:kFIRMessagingTestsReceiverSuiteName];
_messaging = [FIRMessagingTestUtilities messagingForTestsWithUserDefaults:defaults];
}

- (void)tearDown {
[self.messaging.messagingUserDefaults removePersistentDomainForName:kFIRMessagingTestsReceiverSuiteName];
_messaging = nil;

[super tearDown];
}

- (void)testUseMessagingDelegate {
Expand Down
9 changes: 7 additions & 2 deletions Example/Messaging/Tests/FIRMessagingServiceTest.m
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#import "FIRMessaging.h"
#import "FIRMessagingClient.h"
#import "FIRMessagingPubSub.h"
#import "FIRMessagingTestUtilities.h"
#import "FIRMessagingTopicsCommon.h"
#import "InternalHeaders/FIRMessagingInternalUtilities.h"
#import "NSError+FIRMessaging.h"
Expand All @@ -31,8 +32,9 @@
@"yUTTzK6dhIvLqzqqCSabaa4TQVM0pGTmF6r7tmMHPe6VYiGMHuCwJFgj5v97xl78sUNMLwuPPhoci8z_"
@"QGlCrTbxCFGzEUfvA3fGpGgIVQU2W6";

NSString *const kFIRMessagingTestsServiceSuiteName = @"com.messaging.test_serviceTest";

@interface FIRMessaging () <FIRMessagingClientDelegate>
+ (FIRMessaging *)messagingForTests;
@property(nonatomic, readwrite, strong) FIRMessagingClient *client;
@property(nonatomic, readwrite, strong) FIRMessagingPubSub *pubsub;
@property(nonatomic, readwrite, strong) NSString *defaultFcmToken;
Expand All @@ -55,14 +57,17 @@ @interface FIRMessagingServiceTest : XCTestCase {
@implementation FIRMessagingServiceTest

- (void)setUp {
_messaging = [FIRMessaging messagingForTests];
NSUserDefaults *defaults = [[NSUserDefaults alloc] initWithSuiteName:kFIRMessagingTestsServiceSuiteName];
_messaging = [FIRMessagingTestUtilities messagingForTestsWithUserDefaults:defaults];
_messaging.defaultFcmToken = kFakeToken;
_mockPubSub = OCMPartialMock(_messaging.pubsub);
[_mockPubSub setClient:nil];
[super setUp];
}

- (void)tearDown {
[_messaging.messagingUserDefaults removePersistentDomainForName:kFIRMessagingTestsServiceSuiteName];
_messaging = nil;
[_mockPubSub stopMocking];
[super tearDown];
}
Expand Down
21 changes: 12 additions & 9 deletions Example/Messaging/Tests/FIRMessagingTest.m
Original file line number Diff line number Diff line change
Expand Up @@ -20,25 +20,22 @@

#import <FirebaseCore/FIRAppInternal.h>
#import <FirebaseInstanceID/FirebaseInstanceID.h>
#import <FirebaseAnalyticsInterop/FIRAnalyticsInterop.h>

#import "FIRMessaging.h"
#import "FIRMessaging_Private.h"
#import "FIRMessagingTestUtilities.h"

extern NSString *const kFIRMessagingFCMTokenFetchAPNSOption;

@interface FIRInstanceID (ExposedForTest)

+ (FIRInstanceID *)instanceIDForTests;

@end
/// The NSUserDefaults domain for testing.
NSString *const kFIRMessagingDefaultsTestDomain = @"com.messaging.tests";

@interface FIRMessaging ()
+ (FIRMessaging *)messagingForTests;

@property(nonatomic, readwrite, strong) NSString *defaultFcmToken;
@property(nonatomic, readwrite, strong) NSData *apnsTokenData;
@property(nonatomic, readwrite, strong) FIRInstanceID *instanceID;
@property(nonatomic, readwrite, strong) NSUserDefaults *messagingUserDefaults;

// Direct Channel Methods
- (void)updateAutomaticClientConnection;
Expand All @@ -59,8 +56,12 @@ @implementation FIRMessagingTest

- (void)setUp {
[super setUp];
_messaging = [FIRMessaging messagingForTests];
_messaging.instanceID = [FIRInstanceID instanceIDForTests];

// Create the messaging instance with all the necessary dependencies.
NSUserDefaults *defaults =
[[NSUserDefaults alloc] initWithSuiteName:kFIRMessagingDefaultsTestDomain];
_messaging = [FIRMessagingTestUtilities messagingForTestsWithUserDefaults:defaults];

_mockFirebaseApp = OCMClassMock([FIRApp class]);
OCMStub([_mockFirebaseApp defaultApp]).andReturn(_mockFirebaseApp);
_mockInstanceID = OCMPartialMock(self.messaging.instanceID);
Expand All @@ -69,12 +70,14 @@ - (void)setUp {
}

- (void)tearDown {
[self.messaging.messagingUserDefaults removePersistentDomainForName:kFIRMessagingDefaultsTestDomain];
self.messaging.shouldEstablishDirectChannel = NO;
self.messaging.defaultFcmToken = nil;
self.messaging.apnsTokenData = nil;
[_mockMessaging stopMocking];
[_mockInstanceID stopMocking];
[_mockFirebaseApp stopMocking];
_messaging = nil;
[super tearDown];
}

Expand Down
44 changes: 44 additions & 0 deletions Example/Messaging/Tests/FIRMessagingTestUtilities.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* Copyright 2019 Google
*
* 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 <Foundation/Foundation.h>

#import "FIRMessaging.h"

NS_ASSUME_NONNULL_BEGIN

@interface FIRMessaging (TestUtilities)
// Surface the user defaults instance to clean up after tests.
@property(nonatomic, strong) NSUserDefaults *messagingUserDefaults;
@end

@interface FIRMessagingTestUtilities : NSObject

/**
Creates an instance of FIRMessaging to use with tests, and will instantiate a new instance of
InstanceID.
Note: This does not create a FIRApp instance and call `configureWithApp:`. If required, it's up to
each test to do so.
@param userDefaults The user defaults to be used for Messaging.
@return An instance of FIRMessaging with everything initialized.
*/
+ (FIRMessaging *)messagingForTestsWithUserDefaults:(NSUserDefaults *)userDefaults;

@end

NS_ASSUME_NONNULL_END
Loading

0 comments on commit 8264390

Please sign in to comment.