From d13cd54af64b9bcac9ae076b33d56b2af8313803 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Minh=20Nguye=CC=82=CC=83n?= Date: Wed, 7 Nov 2018 23:48:15 -0800 Subject: [ios, macos] Renamed ambient cache prewarming method Renamed the method for prewarming the ambient cache to conform to Cocoa and Swift naming conventions. --- platform/darwin/test/MGLOfflineStorageTests.mm | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'platform/darwin/test/MGLOfflineStorageTests.mm') diff --git a/platform/darwin/test/MGLOfflineStorageTests.mm b/platform/darwin/test/MGLOfflineStorageTests.mm index f01e6854b7..d7c592d668 100644 --- a/platform/darwin/test/MGLOfflineStorageTests.mm +++ b/platform/darwin/test/MGLOfflineStorageTests.mm @@ -395,12 +395,13 @@ } --(void) testPutResourceForURL { +- (void)testPutResourceForURL { NSURL *styleURL = [NSURL URLWithString:@"https://api.mapbox.com/some/thing"]; MGLOfflineStorage *os = [MGLOfflineStorage sharedOfflineStorage]; std::string testData("test data"); - [os putResourceWithUrl:styleURL data:[NSData dataWithBytes:testData.c_str() length:testData.length()] modified:nil expires:nil etag:nil mustRevalidate:NO]; + NSData *data = [NSData dataWithBytes:testData.c_str() length:testData.length()]; + [os preloadData:data forURL:styleURL modificationDate:nil expirationDate:nil eTag:nil mustRevalidate:NO]; auto fs = os.mbglFileSource; const mbgl::Resource resource { mbgl::Resource::Unknown, "https://api.mapbox.com/some/thing" }; @@ -420,14 +421,15 @@ CFRunLoopRun(); } --(void) testPutResourceForURLWithTimestamps { +- (void)testPutResourceForURLWithTimestamps { NSURL *styleURL = [NSURL URLWithString:@"https://api.mapbox.com/some/thing"]; MGLOfflineStorage *os = [MGLOfflineStorage sharedOfflineStorage]; std::string testData("test data"); - NSDate* now = [NSDate date]; - NSDate* future = [now dateByAddingTimeInterval:600]; - [os putResourceWithUrl:styleURL data:[NSData dataWithBytes:testData.c_str() length:testData.length()] modified:now expires:future etag:@"some etag" mustRevalidate:YES]; + NSDate *now = [NSDate date]; + NSDate *future = [now dateByAddingTimeInterval:600]; + NSData *data = [NSData dataWithBytes:testData.c_str() length:testData.length()]; + [os preloadData:data forURL:styleURL modificationDate:now expirationDate:future eTag:@"some etag" mustRevalidate:YES]; auto fs = os.mbglFileSource; const mbgl::Resource resource { mbgl::Resource::Unknown, "https://api.mapbox.com/some/thing" }; -- cgit v1.2.1