Skip to content

Commit 3d4971b

Browse files
Remote Config: enable ARC for tests. (#5108)
* Remote Config: enable ARC for tests. * run ./scripts/style.sh * Fix warnings
1 parent 0fb4723 commit 3d4971b

File tree

4 files changed

+327
-310
lines changed

4 files changed

+327
-310
lines changed

FirebaseRemoteConfig.podspec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,5 +69,6 @@ app update.
6969
'FirebaseRemoteConfig/Tests/Unit/SecondApp-GoogleService-Info.plist'
7070
unit_tests.requires_app_host = true
7171
unit_tests.dependency 'OCMock'
72+
unit_tests.requires_arc = true
7273
end
7374
end

FirebaseRemoteConfig/Tests/Unit/RCNConfigDBManagerTest.m

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ - (void)testV1NamespaceMigrationToV2Namespace {
7676
XCTAssertTrue(success);
7777
if (count == 100) {
7878
// Migrate to the new namespace.
79-
[_DBManager createOrOpenDatabase];
80-
[_DBManager
79+
[self->_DBManager createOrOpenDatabase];
80+
[self->_DBManager
8181
loadMainWithBundleIdentifier:bundleIdentifier
8282
completionHandler:^(
8383
BOOL loadSuccess,
@@ -125,18 +125,18 @@ - (void)testWriteAndLoadMainTableResult {
125125
XCTAssertTrue(success);
126126
if (count == 100) {
127127
// check DB read correctly
128-
[_DBManager loadMainWithBundleIdentifier:bundleIdentifier
129-
completionHandler:^(BOOL success, NSDictionary *fetchedConfig,
130-
NSDictionary *activeConfig,
131-
NSDictionary *defaultConfig) {
132-
NSMutableDictionary *res = [fetchedConfig mutableCopy];
133-
XCTAssertTrue(success);
134-
FIRRemoteConfigValue *value = res[namespace_p][@"key100"];
135-
XCTAssertEqualObjects(value.stringValue, @"value100");
136-
if (success) {
137-
[loadConfigContentExpectation fulfill];
138-
}
139-
}];
128+
[self->_DBManager loadMainWithBundleIdentifier:bundleIdentifier
129+
completionHandler:^(BOOL success, NSDictionary *fetchedConfig,
130+
NSDictionary *activeConfig,
131+
NSDictionary *defaultConfig) {
132+
NSMutableDictionary *res = [fetchedConfig mutableCopy];
133+
XCTAssertTrue(success);
134+
FIRRemoteConfigValue *value = res[namespace_p][@"key100"];
135+
XCTAssertEqualObjects(value.stringValue, @"value100");
136+
if (success) {
137+
[loadConfigContentExpectation fulfill];
138+
}
139+
}];
140140
}
141141
};
142142
NSString *value = [NSString stringWithFormat:@"value%d", i];
@@ -165,7 +165,7 @@ - (void)testWriteAndLoadInternalMetadataResult {
165165
XCTAssertTrue(success);
166166
if (count == 100) {
167167
// check DB read correctly
168-
NSDictionary *result = [_DBManager loadInternalMetadataTable];
168+
NSDictionary *result = [self->_DBManager loadInternalMetadataTable];
169169
NSString *stringValue = [[NSString alloc] initWithData:result[@"key100"]
170170
encoding:NSUTF8StringEncoding];
171171
XCTAssertEqualObjects(stringValue, @"value100");
@@ -232,7 +232,7 @@ - (void)testWriteAndLoadMetadataResult {
232232
};
233233

234234
RCNDBCompletion completion = ^(BOOL success, NSDictionary *result1) {
235-
NSDictionary *result = [_DBManager loadMetadataWithBundleIdentifier:bundleIdentifier];
235+
NSDictionary *result = [self->_DBManager loadMetadataWithBundleIdentifier:bundleIdentifier];
236236
XCTAssertNotNil(result);
237237
XCTAssertEqualObjects(result[RCNKeyBundleIdentifier], bundleIdentifier);
238238
XCTAssertEqual([result[RCNKeyFetchTime] doubleValue], lastFetchTimestamp);
@@ -274,12 +274,12 @@ - (void)testDeleteParamAndLoadMainTable {
274274
XCTAssertTrue(success);
275275

276276
// Delete the key for given namespace.
277-
[_DBManager deleteRecordFromMainTableWithNamespace:namespaceToDelete
278-
bundleIdentifier:bundleIdentifier
279-
fromSource:RCNDBSourceActive];
277+
[self->_DBManager deleteRecordFromMainTableWithNamespace:namespaceToDelete
278+
bundleIdentifier:bundleIdentifier
279+
fromSource:RCNDBSourceActive];
280280

281281
// Read from the database and verify expected values.
282-
[_DBManager
282+
[self->_DBManager
283283
loadMainWithBundleIdentifier:bundleIdentifier
284284
completionHandler:^(BOOL success, NSDictionary *fetchedConfig,
285285
NSDictionary *activeConfig, NSDictionary *defaultConfig) {
@@ -300,7 +300,7 @@ - (void)testDeleteParamAndLoadMainTable {
300300
XCTAssertTrue(success);
301301

302302
// Ensure DB read succeeds.
303-
[_DBManager
303+
[self->_DBManager
304304
loadMainWithBundleIdentifier:bundleIdentifier
305305
completionHandler:^(BOOL success, NSDictionary *fetchedConfig,
306306
NSDictionary *activeConfig, NSDictionary *defaultConfig) {
@@ -378,7 +378,7 @@ - (void)testWriteAndLoadExperiments {
378378
experimentResults[@RCNExperimentTableKeyMetadata][@"experiment_new_metadata"]);
379379
[updateAndLoadExperimentExpectation fulfill];
380380
};
381-
[_DBManager loadExperimentWithCompletionHandler:readCompletion];
381+
[self->_DBManager loadExperimentWithCompletionHandler:readCompletion];
382382
};
383383

384384
NSError *error;
@@ -387,9 +387,9 @@ - (void)testWriteAndLoadExperiments {
387387
options:NSJSONWritingPrettyPrinted
388388
error:&error];
389389

390-
[_DBManager insertExperimentTableWithKey:@RCNExperimentTableKeyMetadata
391-
value:serializedMetadata
392-
completionHandler:writeMetadataCompletion];
390+
[self->_DBManager insertExperimentTableWithKey:@RCNExperimentTableKeyMetadata
391+
value:serializedMetadata
392+
completionHandler:writeMetadataCompletion];
393393
};
394394
[_DBManager insertExperimentTableWithKey:@RCNExperimentTableKeyPayload
395395
value:[[NSData alloc] init]
@@ -455,15 +455,15 @@ - (void)testUpdateAndloadLastFetchStatus {
455455

456456
// Metadata row must exist before update
457457
RCNDBCompletion createMetadataCompletion = ^(BOOL success, NSDictionary *createResult) {
458-
NSDictionary *result = [_DBManager loadMetadataWithBundleIdentifier:bundleIdentifier];
458+
NSDictionary *result = [self->_DBManager loadMetadataWithBundleIdentifier:bundleIdentifier];
459459
XCTAssertTrue(success);
460460
XCTAssertNotNil(result);
461461
XCTAssertEqual([result[RCNKeyLastFetchStatus] intValue],
462462
(int)FIRRemoteConfigFetchStatusSuccess);
463463
XCTAssertEqual([result[RCNKeyLastFetchError] intValue], (int)FIRRemoteConfigErrorUnknown);
464464

465465
RCNDBCompletion updateMetadataCompletion = ^(BOOL success, NSDictionary *updateResult) {
466-
NSDictionary *result = [_DBManager loadMetadataWithBundleIdentifier:bundleIdentifier];
466+
NSDictionary *result = [self->_DBManager loadMetadataWithBundleIdentifier:bundleIdentifier];
467467

468468
XCTAssertTrue(success);
469469
XCTAssertNotNil(result);
@@ -473,7 +473,7 @@ - (void)testUpdateAndloadLastFetchStatus {
473473
[updateAndLoadMetadataExpectation fulfill];
474474
};
475475
// Update with throttle status.
476-
[_DBManager
476+
[self->_DBManager
477477
updateMetadataWithOption:RCNUpdateOptionFetchStatus
478478
values:@[
479479
@(FIRRemoteConfigFetchStatusThrottled), @(FIRRemoteConfigErrorThrottled)
@@ -498,21 +498,21 @@ - (void)ignore_InsertAndUpdateApplyTime {
498498
RCNDBCompletion createMetadataCompletion = ^(BOOL success, NSDictionary *createResult) {
499499
XCTAssertTrue(success);
500500
// Read newly created metadata.
501-
NSDictionary *result = [_DBManager loadMetadataWithBundleIdentifier:bundleIdentifier];
501+
NSDictionary *result = [self->_DBManager loadMetadataWithBundleIdentifier:bundleIdentifier];
502502
XCTAssertNotNil(result);
503503
XCTAssertEqual([result[RCNKeyLastApplyTime] doubleValue], (double)100);
504504
RCNDBCompletion updateMetadataCompletion = ^(BOOL success, NSDictionary *updateResult) {
505-
NSDictionary *result = [_DBManager loadMetadataWithBundleIdentifier:bundleIdentifier];
505+
NSDictionary *result = [self->_DBManager loadMetadataWithBundleIdentifier:bundleIdentifier];
506506

507507
XCTAssertTrue(success);
508508
XCTAssertNotNil(result);
509509
XCTAssertEqual([result[RCNKeyLastApplyTime] doubleValue], lastApplyTimestamp);
510510
[updateAndLoadMetadataExpectation fulfill];
511511
};
512512
// Update apply config timestamp.
513-
[_DBManager updateMetadataWithOption:RCNUpdateOptionApplyTime
514-
values:@[ @(lastApplyTimestamp) ]
515-
completionHandler:updateMetadataCompletion];
513+
[self->_DBManager updateMetadataWithOption:RCNUpdateOptionApplyTime
514+
values:@[ @(lastApplyTimestamp) ]
515+
completionHandler:updateMetadataCompletion];
516516
};
517517

518518
[_DBManager insertMetadataTableWithValues:[self createSampleMetadata]
@@ -528,22 +528,22 @@ - (void)testUpdateAndLoadSetDefaultsTime {
528528

529529
// Metadata row must exist before update
530530
RCNDBCompletion createMetadataCompletion = ^(BOOL success, NSDictionary *createResult) {
531-
NSDictionary *result = [_DBManager loadMetadataWithBundleIdentifier:bundleIdentifier];
531+
NSDictionary *result = [self->_DBManager loadMetadataWithBundleIdentifier:bundleIdentifier];
532532
XCTAssertTrue(success);
533533
XCTAssertNotNil(result);
534534
XCTAssertEqual([result[RCNKeyLastSetDefaultsTime] doubleValue], (double)200);
535535
RCNDBCompletion updateMetadataCompletion = ^(BOOL success, NSDictionary *updateResult) {
536-
NSDictionary *result = [_DBManager loadMetadataWithBundleIdentifier:bundleIdentifier];
536+
NSDictionary *result = [self->_DBManager loadMetadataWithBundleIdentifier:bundleIdentifier];
537537

538538
XCTAssertTrue(success);
539539
XCTAssertNotNil(result);
540540
XCTAssertEqual([result[RCNKeyLastSetDefaultsTime] doubleValue], lastSetDefaultsTimestamp);
541541
[updateAndLoadMetadataExpectation fulfill];
542542
};
543543
// Update setting default config timestamp.
544-
[_DBManager updateMetadataWithOption:RCNUpdateOptionDefaultTime
545-
values:@[ @(lastSetDefaultsTimestamp) ]
546-
completionHandler:updateMetadataCompletion];
544+
[self->_DBManager updateMetadataWithOption:RCNUpdateOptionDefaultTime
545+
values:@[ @(lastSetDefaultsTimestamp) ]
546+
completionHandler:updateMetadataCompletion];
547547
};
548548

549549
[_DBManager insertMetadataTableWithValues:[self createSampleMetadata]

FirebaseRemoteConfig/Tests/Unit/RCNInstanceIDTest.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ - (void)testMultipleFetchCallsFailing {
254254
rangeOfString:@"Failed to get InstanceID token"]
255255
.location == NSNotFound);
256256
// Make a second fetch call.
257-
[_configInstances[i]
257+
[self->_configInstances[i]
258258
fetchWithExpirationDuration:43200
259259
completionHandler:^void(FIRRemoteConfigFetchStatus status, NSError *error) {
260260
XCTAssertNotNil(error);

0 commit comments

Comments
 (0)