Skip to content

Commit

Permalink
Revert "Squashed commit of the following:"
Browse files Browse the repository at this point in the history
This reverts commit c1c0fa0.
  • Loading branch information
renkelvin committed Sep 30, 2019
1 parent e6afece commit 7d5cb23
Show file tree
Hide file tree
Showing 652 changed files with 15,797 additions and 45,143 deletions.
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ Example/Database/App/GoogleService-Info.plist

Example/Storage/App/GoogleService-Info.plist

# FirebaseInstallations integration tests GoogleService-Info.plist
FirebaseInstallations/Source/Tests/Resources/GoogleService-Info.plist

Secrets.tar

# OS X
Expand Down
332 changes: 110 additions & 222 deletions .travis.yml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Carthage.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,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/gRPC-C++.framework/Resources/gRPCCertificates-Cpp.bundle
- ./Carthage/Build/iOS/FirebaseFirestore.framework/gRPCCertificates.bundle
- For FirebaseMLVisionFaceModel:
- ./Carthage/Build/iOS/FaceDetector.framework/GoogleMVFaceDetectorResources.bundle
- For FirebaseMLVisionTextModel:
Expand Down
4 changes: 2 additions & 2 deletions Example/Core/Tests/FIRAppTest.m
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,7 @@ - (void)testAnalyticsSetByGlobalDataCollectionSwitch {
// Test that the global data collection switch triggers setting Analytics when no explicit flag is
// set.
id optionsMock = OCMClassMock([FIROptions class]);
OCMStub([optionsMock isAnalyticsCollectionExplicitlySet]).andReturn(NO);
OCMStub([optionsMock isAnalyticsCollectionExpicitlySet]).andReturn(NO);

// We need to use the default app name since Analytics only associates with the default app.
FIRApp *defaultApp = [[FIRApp alloc] initInstanceWithName:kFIRDefaultAppName options:optionsMock];
Expand All @@ -670,7 +670,7 @@ - (void)testAnalyticsSetByGlobalDataCollectionSwitch {
- (void)testAnalyticsNotSetByGlobalDataCollectionSwitch {
// Test that the global data collection switch doesn't override an explicitly set Analytics flag.
id optionsMock = OCMClassMock([FIROptions class]);
OCMStub([optionsMock isAnalyticsCollectionExplicitlySet]).andReturn(YES);
OCMStub([optionsMock isAnalyticsCollectionExpicitlySet]).andReturn(YES);
FIRApp *app = [[FIRApp alloc] initInstanceWithName:@"testAnalyticsNotSet" options:optionsMock];

id configurationMock = OCMClassMock([FIRAnalyticsConfiguration class]);
Expand Down
56 changes: 4 additions & 52 deletions Example/Core/Tests/FIRComponentContainerTest.m
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
#import <FirebaseCore/FIRAppInternal.h>
#import <FirebaseCore/FIRComponent.h>
#import <FirebaseCore/FIRComponentContainerInternal.h>
#import <FirebaseCore/FIROptions.h>

#import "FIRTestComponents.h"

Expand Down Expand Up @@ -50,19 +49,12 @@ - (instancetype)initWithApp:(FIRApp *)app

@end

@interface FIRComponentContainerTest : FIRTestCase {
FIRApp *_hostApp;
}
@interface FIRComponentContainerTest : FIRTestCase

@end

@implementation FIRComponentContainerTest

- (void)tearDown {
_hostApp = nil;
[super tearDown];
}

#pragma mark - Registration Tests

- (void)testRegisteringConformingClass {
Expand Down Expand Up @@ -109,8 +101,7 @@ - (void)testInstanceNotCached {
- (void)testRemoveAllCachedInstances {
FIRComponentContainer *container =
[self containerWithRegistrants:@ [[FIRTestClass class], [FIRTestClassCached class],
[FIRTestClassEagerCached class],
[FIRTestClassCachedWithDep class]]];
[FIRTestClassEagerCached class]]];

// Retrieve an instance of FIRTestClassCached to ensure it's cached.
id<FIRTestProtocolCached> cachedInstance1 = FIR_COMPONENT(FIRTestProtocolCached, container);
Expand Down Expand Up @@ -157,57 +148,18 @@ - (void)testProtocolAlreadyRegistered {
XCTAssert(container.components.count == 1);
}

#pragma mark - Dependency Tests

- (void)testDependencyDoesntBlock {
/// Test a class that has a dependency, and fetching doesn't block the internal queue.
FIRComponentContainer *container = [self
containerWithRegistrants:@ [[FIRTestClassCached class], [FIRTestClassCachedWithDep class]]];
XCTAssert(container.components.count == 2);

id<FIRTestProtocolCachedWithDep> instanceWithDep =
FIR_COMPONENT(FIRTestProtocolCachedWithDep, container);
XCTAssertNotNil(instanceWithDep);
}

- (void)testDependencyRemoveAllCachedInstancesDoesntBlock {
/// Test a class that has a dependency, and fetching doesn't block the internal queue.
FIRComponentContainer *container = [self
containerWithRegistrants:@ [[FIRTestClassCached class], [FIRTestClassCachedWithDep class]]];
XCTAssert(container.components.count == 2);

id<FIRTestProtocolCachedWithDep> instanceWithDep =
FIR_COMPONENT(FIRTestProtocolCachedWithDep, container);
XCTAssertNotNil(instanceWithDep);
XCTAssertNotNil(instanceWithDep.testProperty);

// Both `instanceWithDep` and `testProperty` should be cached now.
XCTAssertTrue(container.cachedInstances.count == 2);

// Remove the instances and verify cachedInstances is empty, and doesn't block the queue.
[container removeAllCachedInstances];
XCTAssertTrue(container.cachedInstances.count == 0);
}

#pragma mark - Convenience Methods

/// Create a container that has registered the test class.
- (FIRComponentContainer *)containerWithRegistrants:(NSArray<Class> *)registrants {
FIROptions *options = [[FIROptions alloc] initWithGoogleAppID:kGoogleAppID
GCMSenderID:kGCMSenderID];
_hostApp = [[FIRApp alloc] initInstanceWithName:@"fake_app" options:options];
id appMock = OCMClassMock([FIRApp class]);
NSMutableSet<Class> *allRegistrants = [NSMutableSet<Class> set];

// Initialize the container with the test classes.
for (Class c in registrants) {
[FIRComponentContainer registerAsComponentRegistrant:c inSet:allRegistrants];
}

// Override the app's container with the newly instantiated container.
FIRComponentContainer *container = [[FIRComponentContainer alloc] initWithApp:_hostApp
registrants:allRegistrants];
_hostApp.container = container;
return container;
return [[FIRComponentContainer alloc] initWithApp:appMock registrants:allRegistrants];
}

@end
16 changes: 8 additions & 8 deletions Example/Core/Tests/FIROptionsTest.m
Original file line number Diff line number Diff line change
Expand Up @@ -510,50 +510,50 @@ - (void)testAnalyticsCollectionExplicitlySet {
NSDictionary *optionsDictionary = @{};
FIROptions *options = [[FIROptions alloc] initInternalWithOptionsDictionary:optionsDictionary];
NSDictionary *analyticsOptions = [options analyticsOptionsDictionaryWithInfoDictionary:@{}];
XCTAssertFalse([options isAnalyticsCollectionExplicitlySet]);
XCTAssertFalse([options isAnalyticsCollectionExpicitlySet]);

// Test deactivation flag.
optionsDictionary = @{kFIRIsAnalyticsCollectionDeactivated : @YES};
options = [[FIROptions alloc] initInternalWithOptionsDictionary:optionsDictionary];
analyticsOptions = [options analyticsOptionsDictionaryWithInfoDictionary:@{}];
XCTAssertTrue([options isAnalyticsCollectionExplicitlySet]);
XCTAssertTrue([options isAnalyticsCollectionExpicitlySet]);

// If "deactivated" == NO, that doesn't mean it's explicitly set / enabled so it should be treated
// as if it's not set.
optionsDictionary = @{kFIRIsAnalyticsCollectionDeactivated : @NO};
options = [[FIROptions alloc] initInternalWithOptionsDictionary:optionsDictionary];
analyticsOptions = [options analyticsOptionsDictionaryWithInfoDictionary:@{}];
XCTAssertFalse([options isAnalyticsCollectionExplicitlySet]);
XCTAssertFalse([options isAnalyticsCollectionExpicitlySet]);

// Test the collection enabled flag.
optionsDictionary = @{kFIRIsAnalyticsCollectionEnabled : @YES};
options = [[FIROptions alloc] initInternalWithOptionsDictionary:optionsDictionary];
analyticsOptions = [options analyticsOptionsDictionaryWithInfoDictionary:@{}];
XCTAssertTrue([options isAnalyticsCollectionExplicitlySet]);
XCTAssertTrue([options isAnalyticsCollectionExpicitlySet]);

optionsDictionary = @{kFIRIsAnalyticsCollectionEnabled : @NO};
options = [[FIROptions alloc] initInternalWithOptionsDictionary:optionsDictionary];
analyticsOptions = [options analyticsOptionsDictionaryWithInfoDictionary:@{}];
XCTAssertTrue([options isAnalyticsCollectionExplicitlySet]);
XCTAssertTrue([options isAnalyticsCollectionExpicitlySet]);

// Test the old measurement flag.
options = [[FIROptions alloc] initInternalWithOptionsDictionary:@{}];
analyticsOptions =
[options analyticsOptionsDictionaryWithInfoDictionary:@{kFIRIsMeasurementEnabled : @YES}];
XCTAssertTrue([options isAnalyticsCollectionExplicitlySet]);
XCTAssertTrue([options isAnalyticsCollectionExpicitlySet]);

options = [[FIROptions alloc] initInternalWithOptionsDictionary:@{}];
analyticsOptions =
[options analyticsOptionsDictionaryWithInfoDictionary:@{kFIRIsMeasurementEnabled : @NO}];
XCTAssertTrue([options isAnalyticsCollectionExplicitlySet]);
XCTAssertTrue([options isAnalyticsCollectionExpicitlySet]);

// For good measure, a combination of all 3 (even if they conflict).
optionsDictionary =
@{kFIRIsAnalyticsCollectionDeactivated : @YES, kFIRIsAnalyticsCollectionEnabled : @YES};
options = [[FIROptions alloc] initInternalWithOptionsDictionary:optionsDictionary];
analyticsOptions =
[options analyticsOptionsDictionaryWithInfoDictionary:@{kFIRIsMeasurementEnabled : @NO}];
XCTAssertTrue([options isAnalyticsCollectionExplicitlySet]);
XCTAssertTrue([options isAnalyticsCollectionExpicitlySet]);
}

- (void)testModifyingOptionsThrows {
Expand Down
20 changes: 2 additions & 18 deletions Example/Core/Tests/FIRTestComponents.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,33 +46,17 @@
/// A test class that is a component registrant that provides a component requiring eager
/// instantiation, and is cached for easier validation that it was instantiated.
@interface FIRTestClassEagerCached
: NSObject <FIRTestProtocolEagerCached, FIRComponentLifecycleMaintainer, FIRLibrary>
: NSObject <FIRTestProtocol, FIRComponentLifecycleMaintainer, FIRLibrary>
@end

#pragma mark - Cached Component

/// A test protocol to be used for container testing.
@protocol FIRTestProtocolCached
- (void)cacheCow;
@end

/// A test class that is a component registrant that provides a component that requests to be
/// cached.
@interface FIRTestClassCached
: NSObject <FIRTestProtocolCached, FIRComponentLifecycleMaintainer, FIRLibrary>
@end

#pragma mark - Dependency on Standard

/// A test protocol to be used for container testing.
@protocol FIRTestProtocolCachedWithDep
@property(nonatomic, strong) id<FIRTestProtocolCached> testProperty;
@end

/// A test class that is a component registrant that provides a component with a dependency on
// `FIRTestProtocolCached`.
@interface FIRTestClassCachedWithDep
: NSObject <FIRTestProtocolCachedWithDep, FIRComponentLifecycleMaintainer, FIRLibrary>
@property(nonatomic, strong) id<FIRTestProtocolCached> testProperty;
- (instancetype)initWithTest:(id<FIRTestProtocolCached>)testInstance;
: NSObject <FIRTestProtocol, FIRComponentLifecycleMaintainer, FIRLibrary>
@end
50 changes: 4 additions & 46 deletions Example/Core/Tests/FIRTestComponents.m
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@

#import "FIRTestComponents.h"

#import <FirebaseCore/FIRAppInternal.h>
#import <FirebaseCore/FIRComponent.h>
#import <FirebaseCore/FIRDependency.h>

#pragma mark - Standard Component

Expand Down Expand Up @@ -94,6 +92,9 @@ - (void)doSomethingFaster {
- (void)appWillBeDeleted:(FIRApp *)app {
}

- (void)doSomething {
}

@end

#pragma mark - Cached Component
Expand All @@ -117,50 +118,7 @@ @implementation FIRTestClassCached
- (void)appWillBeDeleted:(FIRApp *)app {
}

/// FIRTestProtocolCached conformance.
- (void)cacheCow {
}

@end

#pragma mark - Test Component with Dependency

@implementation FIRTestClassCachedWithDep

- (instancetype)initWithTest:(id<FIRTestProtocolCached>)testInstance {
self = [super init];
if (self != nil) {
self.testProperty = testInstance;
}
return self;
}

- (void)appWillBeDeleted:(nonnull FIRApp *)app {
// Do something that depends on the instance from our dependency.
[self.testProperty cacheCow];

// Fetch from the container in the deletion function.
id<FIRTestProtocolCached> anotherInstance = FIR_COMPONENT(FIRTestProtocolCached, app.container);
[anotherInstance cacheCow];
}

+ (nonnull NSArray<FIRComponent *> *)componentsToRegister {
FIRDependency *dep = [FIRDependency dependencyWithProtocol:@protocol(FIRTestProtocolCached)];
FIRComponent *testComponent = [FIRComponent
componentWithProtocol:@protocol(FIRTestProtocolCachedWithDep)
instantiationTiming:FIRInstantiationTimingLazy
dependencies:@[ dep ]
creationBlock:^id _Nullable(FIRComponentContainer *_Nonnull container,
BOOL *_Nonnull isCacheable) {
// Fetch from the container in the instantiation block.
*isCacheable = YES;

id<FIRTestProtocolCached> test = FIR_COMPONENT(FIRTestProtocolCached, container);
FIRTestClassCachedWithDep *instance =
[[FIRTestClassCachedWithDep alloc] initWithTest:test];
return instance;
}];
return @[ testComponent ];
- (void)doSomething {
}

@end
22 changes: 12 additions & 10 deletions Example/CoreDiagnostics/Tests/FIRCoreDiagnosticsTest.m
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@

#import <FirebaseCoreDiagnosticsInterop/FIRCoreDiagnosticsData.h>
#import <FirebaseCoreDiagnosticsInterop/FIRCoreDiagnosticsInterop.h>
#import <GoogleDataTransport/GDTCOREvent.h>
#import <GoogleDataTransport/GDTCOREventDataObject.h>
#import <GoogleDataTransport/GDTCORTransport.h>
#import <GoogleDataTransport/GDTEvent.h>
#import <GoogleDataTransport/GDTEventDataObject.h>
#import <GoogleDataTransport/GDTTransport.h>
#import <GoogleDataTransportCCTSupport/GDTCCTPrioritizer.h>
#import <GoogleUtilities/GULAppEnvironmentUtil.h>
#import <GoogleUtilities/GULUserDefaults.h>
Expand All @@ -47,12 +47,12 @@
@interface FIRCoreDiagnostics : NSObject
// Initialization.
+ (instancetype)sharedInstance;
- (instancetype)initWithTransport:(GDTCORTransport *)transport
- (instancetype)initWithTransport:(GDTTransport *)transport
heartbeatDateStorage:(FIRCoreDiagnosticsDateFileStorage *)heartbeatDateStorage;

// Properties.
@property(nonatomic, readonly) dispatch_queue_t diagnosticsQueue;
@property(nonatomic, readonly) GDTCORTransport *transport;
@property(nonatomic, readonly) GDTTransport *transport;
@property(nonatomic, readonly) FIRCoreDiagnosticsDateFileStorage *heartbeatDateStorage;

// Install string helpers.
Expand Down Expand Up @@ -111,7 +111,7 @@ - (instancetype)init {

@end

@interface FIRCoreDiagnosticsLog : NSObject <GDTCOREventDataObject>
@interface FIRCoreDiagnosticsLog : NSObject <GDTEventDataObject>

@property(nonatomic) logs_proto_mobilesdk_ios_ICoreConfiguration config;

Expand All @@ -136,9 +136,9 @@ @implementation FIRCoreDiagnosticsTest
- (void)setUp {
[super setUp];

self.mockTransport = OCMClassMock([GDTCORTransport class]);
self.mockTransport = OCMClassMock([GDTTransport class]);
OCMStub([self.mockTransport eventForTransport])
.andReturn([[GDTCOREvent alloc] initWithMappingID:@"111" target:2]);
.andReturn([[GDTEvent alloc] initWithMappingID:@"111" target:2]);

self.mockDateStorage = OCMClassMock([FIRCoreDiagnosticsDateFileStorage class]);
self.diagnostics = [[FIRCoreDiagnostics alloc] initWithTransport:self.mockTransport
Expand Down Expand Up @@ -220,10 +220,12 @@ - (void)populateProto:(logs_proto_mobilesdk_ios_ICoreConfiguration *)config {
config->dynamic_framework_count = numFrameworks;
config->has_dynamic_framework_count = 1;
config->apple_framework_version = FIREncodeString(combinedVersions);
#if !TARGET_OS_IOS
NSString *minVersion = [[NSBundle mainBundle] infoDictionary][@"MinimumOSVersion"];
if (minVersion) {
config->min_supported_ios_version = FIREncodeString(minVersion);
}
#endif // TARGET_OS_IOS
config->using_zip_file = 0;
config->has_using_zip_file = 1;
config->deployment_type = logs_proto_mobilesdk_ios_ICoreConfiguration_DeploymentType_COCOAPODS;
Expand Down Expand Up @@ -319,8 +321,8 @@ - (void)assertEventSentWithHeartbeat:(BOOL)isHeartbeat {
}

- (void)expectEventToBeSentToTransportWithHeartbeat:(BOOL)isHeartbeat {
id eventValidation = [OCMArg checkWithBlock:^BOOL(GDTCOREvent *obj) {
XCTAssert([obj isKindOfClass:[GDTCOREvent class]]);
id eventValidation = [OCMArg checkWithBlock:^BOOL(GDTEvent *obj) {
XCTAssert([obj isKindOfClass:[GDTEvent class]]);
FIRCoreDiagnosticsLog *dataObject = obj.dataObject;
XCTAssert([dataObject isKindOfClass:[FIRCoreDiagnosticsLog class]]);

Expand Down
4 changes: 1 addition & 3 deletions Example/Database/Tests/Integration/FOrderByTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -235,9 +235,7 @@ - (void)testFiresChildMovedEvents {
moved = YES;
XCTAssertEqualObjects(snapshot.key, @"greg", @"");
XCTAssertEqualObjects(prevName, @"rob", @"");
XCTAssertEqualObjects(
snapshot.value,
@{@"nuggets" : @57}, @"");
XCTAssertEqualObjects(snapshot.value, @{@"nuggets" : @57}, @"");
}];

[ref setValue:initial];
Expand Down
Loading

0 comments on commit 7d5cb23

Please sign in to comment.