diff options
author | jmkiley <jordan.kiley@mapbox.com> | 2019-06-28 15:47:36 -0700 |
---|---|---|
committer | jmkiley <jordan.kiley@mapbox.com> | 2019-07-09 15:03:39 -0700 |
commit | f324e5a93b7e99f92f0c03224197c6cfae8fb6f4 (patch) | |
tree | 8b63bf06ccf98c29f52c3bc35f1048c4ae858d4d | |
parent | b5e6f6cdde9b7af632e1db7d9f960420973d7940 (diff) | |
download | qtlocation-mapboxgl-f324e5a93b7e99f92f0c03224197c6cfae8fb6f4.tar.gz |
[ios] moved tests, renamed resetDatabase example
-rw-r--r-- | platform/darwin/test/MGLOfflineStorageTests.mm | 46 | ||||
-rw-r--r-- | platform/ios/app/MBXViewController.m | 4 |
2 files changed, 29 insertions, 21 deletions
diff --git a/platform/darwin/test/MGLOfflineStorageTests.mm b/platform/darwin/test/MGLOfflineStorageTests.mm index f91c8958d3..47646a83f6 100644 --- a/platform/darwin/test/MGLOfflineStorageTests.mm +++ b/platform/darwin/test/MGLOfflineStorageTests.mm @@ -201,6 +201,33 @@ pack = nil; } +- (void)testInvalidateAmbientCache { + XCTestExpectation *expectation = [self expectationWithDescription:@"Expect cache to be invalidated without an error."]; + [[MGLOfflineStorage sharedOfflineStorage] invalidateAmbientCacheWithCompletion:^(NSError * _Nullable error) { + XCTAssertNil(error); + [expectation fulfill]; + }]; + [self waitForExpectationsWithTimeout:30 handler:nil]; +} + +- (void)testClearCache { + XCTestExpectation *expectation = [self expectationWithDescription:@"Expect cache to be cleared without an error."]; + [[MGLOfflineStorage sharedOfflineStorage] clearAmbientCacheWithCompletion:^(NSError * _Nullable error) { + XCTAssertNil(error); + [expectation fulfill]; + }]; + [self waitForExpectationsWithTimeout:10 handler:nil]; +} + +- (void)testResetDatabase { + XCTestExpectation *expectation = [self expectationWithDescription:@"Expect database to be reset without an error."]; + [[MGLOfflineStorage sharedOfflineStorage] resetDatabaseWithCompletionHandler:^(NSError * _Nullable error) { + XCTAssertNil(error); + [expectation fulfill]; + }]; + [self waitForExpectationsWithTimeout:10 handler:nil]; +} + - (void)testBackupExclusion { NSURL *cacheDirectoryURL = [[NSFileManager defaultManager] URLForDirectory:NSApplicationSupportDirectory inDomain:NSUserDomainMask @@ -413,23 +440,4 @@ CFRunLoopRun(); } -- (void)testInvalidateAmbientCache { - [[MGLOfflineStorage sharedOfflineStorage] invalidateAmbientCacheWithCompletion:^(NSError * _Nullable error) { - XCTAssertNil(error); - }]; -} - -- (void)testClearCache { - [[MGLOfflineStorage sharedOfflineStorage] clearAmbientCacheWithCompletion:^(NSError * _Nullable error) { - XCTAssertNil(error); - }]; -} - -- (void)testResetDatabase { - [[MGLOfflineStorage sharedOfflineStorage] resetDatabaseWithCompletionHandler:^(NSError * _Nullable error) { - XCTAssertNil(error); - }]; -} - - @end diff --git a/platform/ios/app/MBXViewController.m b/platform/ios/app/MBXViewController.m index 1ca55fe34f..032852d08f 100644 --- a/platform/ios/app/MBXViewController.m +++ b/platform/ios/app/MBXViewController.m @@ -443,7 +443,7 @@ CLLocationCoordinate2D randomWorldCoordinate() { @"View Route Simulation", @"Ornaments Placement", @"Invalidate Ambient Cache", - @"Clear Database", + @"Reset Database", @"Reset Ambient Cache", ]]; @@ -1801,7 +1801,7 @@ CLLocationCoordinate2D randomWorldCoordinate() { if (!error) { CFTimeInterval end = CACurrentMediaTime(); CFTimeInterval difference = end - start; - NSLog(@"clearDatabase\nStarted: %f\nEnded: %f\nTotal Time: %f", start, end, difference); + NSLog(@"resetDatabase\nStarted: %f\nEnded: %f\nTotal Time: %f", start, end, difference); } }]; } |