@@ -191,62 +191,6 @@ - (void)testCheckinSaveSuccess {
191191 [self waitForExpectationsWithTimeout: kExpectationTimeout handler: nil ];
192192}
193193
194- // Write fake checkin data to legacy location, then test if migration worked.
195- - (void )testCheckinMigrationMovesToNewLocationInKeychain {
196- XCTestExpectation *checkinMigrationExpectation =
197- [self expectationWithDescription: @" checkin migration should move to the new location" ];
198- // Create checkin store class.
199- FIRInstanceIDBackupExcludedPlist *checkinPlist =
200- [[FIRInstanceIDBackupExcludedPlist alloc ] initWithFileName: kFakeCheckinPlistName
201- subDirectory: kSubDirectoryName ];
202-
203- FIRInstanceIDFakeKeychain *fakeKeychain = [[FIRInstanceIDFakeKeychain alloc ] init ];
204- FIRInstanceIDFakeKeychain *weakKeychain = fakeKeychain;
205-
206- // Create fake checkin preferences object.
207- FIRInstanceIDCheckinPreferences *preferences =
208- [[FIRInstanceIDCheckinPreferences alloc ] initWithDeviceID: kAuthID secretToken: kSecret ];
209- [preferences updateWithCheckinPlistContents: [[self class ] newCheckinPlistPreferences ]];
210-
211- // Write checkin into legacy location in Fake keychain.
212- NSString *checkinKeychainContent = [preferences checkinKeychainContent ];
213- NSData *data = [checkinKeychainContent dataUsingEncoding: NSUTF8StringEncoding];
214- [fakeKeychain setData: data
215- forService: kFIRInstanceIDLegacyCheckinKeychainService
216- account: kFIRInstanceIDLegacyCheckinKeychainAccount
217- handler: ^(NSError *error) {
218- XCTAssertNil (error);
219- // Check that we saved it correctly to the legacy location.
220- NSData *dataInLegacyLocation =
221- [weakKeychain dataForService: kFIRInstanceIDLegacyCheckinKeychainService
222- account: kFIRInstanceIDLegacyCheckinKeychainAccount ];
223- XCTAssertNotNil (dataInLegacyLocation);
224-
225- FIRInstanceIDCheckinStore *checkinStore =
226- [[FIRInstanceIDCheckinStore alloc ] initWithCheckinPlist: checkinPlist
227- keychain: weakKeychain];
228- // Perform migration.
229- [checkinStore migrateCheckinItemIfNeeded ];
230-
231- // Ensure the item is no longer in the old location.
232- dataInLegacyLocation =
233- [weakKeychain dataForService: kFIRInstanceIDLegacyCheckinKeychainService
234- account: kFIRInstanceIDLegacyCheckinKeychainAccount ];
235- XCTAssertNil (dataInLegacyLocation);
236- // Check that it exists in the new location.
237- NSData *dataInMigratedLocation =
238- [weakKeychain dataForService: kFIRInstanceIDCheckinKeychainService
239- account: checkinStore.bundleIdentifierForKeychainAccount];
240- XCTAssertNotNil (dataInMigratedLocation);
241- // Ensure that the data is the same as what we originally saved.
242- XCTAssertEqualObjects (dataInMigratedLocation, data);
243-
244- [checkinMigrationExpectation fulfill ];
245- }];
246-
247- [self waitForExpectationsWithTimeout: kExpectationTimeout handler: nil ];
248- }
249-
250194#pragma mark - Private Helpers
251195
252196- (BOOL )savePreferencesToPlist : (NSDictionary *)preferences {
0 commit comments