diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2016-04-25 14:51:27 -0700 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2016-04-25 14:51:27 -0700 |
commit | e916cc811c781404d305af946ae127d4da338a38 (patch) | |
tree | 71b6147b4fb2828de8d418972e631a17e3598be0 /test/storage | |
parent | 8ce0fb4739f68cd3d5b65b0ded0346053855fa3f (diff) | |
download | qtlocation-mapboxgl-e916cc811c781404d305af946ae127d4da338a38.tar.gz |
[tests] Rationalize test fixtures (#4834)
Place them in a directory corresponding to the test .cpp file name.
Diffstat (limited to 'test/storage')
-rw-r--r-- | test/storage/offline_database.cpp | 186 | ||||
-rw-r--r-- | test/storage/offline_download.cpp | 118 |
2 files changed, 79 insertions, 225 deletions
diff --git a/test/storage/offline_database.cpp b/test/storage/offline_database.cpp index e211aba2d7..6833a058a9 100644 --- a/test/storage/offline_database.cpp +++ b/test/storage/offline_database.cpp @@ -80,30 +80,15 @@ private: } -//TEST(OfflineDatabase, NonexistentDirectory) { -// using namespace mbgl; -// -// Log::setObserver(std::make_unique<FixtureLogObserver>()); -// -// OfflineDatabase db("test/fixtures/404/offline.db"); -// -// db.get({ Resource::Unknown, "mapbox://test" }, [] (optional<Response> res) { -// EXPECT_FALSE(bool(res)); -// }); -// -// auto observer = Log::removeObserver(); -// EXPECT_EQ(1ul, dynamic_cast<FixtureLogObserver*>(observer.get())->count({ EventSeverity::Error, Event::Database, 14, "unable to open database file" })); -//} - TEST(OfflineDatabase, TEST_REQUIRES_WRITE(Create)) { using namespace mbgl; - createDir("test/fixtures/database"); - deleteFile("test/fixtures/database/offline.db"); + createDir("test/fixtures/offline_database"); + deleteFile("test/fixtures/offline_database/offline.db"); Log::setObserver(std::make_unique<FixtureLogObserver>()); - OfflineDatabase db("test/fixtures/database/offline.db"); + OfflineDatabase db("test/fixtures/offline_database/offline.db"); EXPECT_FALSE(bool(db.get({ Resource::Unknown, "mapbox://test" }))); Log::removeObserver(); @@ -112,9 +97,9 @@ TEST(OfflineDatabase, TEST_REQUIRES_WRITE(Create)) { TEST(OfflineDatabase, TEST_REQUIRES_WRITE(SchemaVersion)) { using namespace mbgl; - createDir("test/fixtures/database"); - deleteFile("test/fixtures/database/offline.db"); - std::string path("test/fixtures/database/offline.db"); + createDir("test/fixtures/offline_database"); + deleteFile("test/fixtures/offline_database/offline.db"); + std::string path("test/fixtures/offline_database/offline.db"); { sqlite3* db = nullptr; @@ -134,150 +119,19 @@ TEST(OfflineDatabase, TEST_REQUIRES_WRITE(SchemaVersion)) { TEST(OfflineDatabase, TEST_REQUIRES_WRITE(Invalid)) { using namespace mbgl; - createDir("test/fixtures/database"); - deleteFile("test/fixtures/database/invalid.db"); - writeFile("test/fixtures/database/invalid.db", "this is an invalid file"); + createDir("test/fixtures/offline_database"); + deleteFile("test/fixtures/offline_database/invalid.db"); + writeFile("test/fixtures/offline_database/invalid.db", "this is an invalid file"); Log::setObserver(std::make_unique<FixtureLogObserver>()); - OfflineDatabase db("test/fixtures/database/invalid.db"); + OfflineDatabase db("test/fixtures/offline_database/invalid.db"); auto observer = Log::removeObserver(); auto flo = dynamic_cast<FixtureLogObserver*>(observer.get()); EXPECT_EQ(1ul, flo->count({ EventSeverity::Warning, Event::Database, -1, "Removing existing incompatible offline database" })); } -//TEST(OfflineDatabase, DatabaseLockedRead) { -// using namespace mbgl; -// -// // Create a locked file. -// createDir("test/fixtures/database"); -// deleteFile("test/fixtures/database/locked.db"); -// FileLock guard("test/fixtures/database/locked.db"); -// -// OfflineDatabase db("test/fixtures/database/locked.db"); -// -// { -// // First request should fail. -// Log::setObserver(std::make_unique<FixtureLogObserver>()); -// -// db.get({ Resource::Unknown, "mapbox://test" }, [] (optional<Response> res) { -// EXPECT_FALSE(bool(res)); -// }); -// -// // Make sure that we got a few "database locked" errors -// auto observer = Log::removeObserver(); -// auto flo = dynamic_cast<FixtureLogObserver*>(observer.get()); -// EXPECT_EQ(4ul, flo->count({ EventSeverity::Error, Event::Database, 5, "database is locked" })); -// } -// -// // Then, unlock the file and try again. -// guard.unlock(); -// -// { -// // First, try getting a file (the cache value should not exist). -// Log::setObserver(std::make_unique<FixtureLogObserver>()); -// -// db.get({ Resource::Unknown, "mapbox://test" }, [] (optional<Response> res) { -// EXPECT_FALSE(bool(res)); -// }); -// -// // Make sure that we got a no errors -// Log::removeObserver(); -// } -//} -// -//TEST(OfflineDatabase, DatabaseLockedWrite) { -// using namespace mbgl; -// -// // Create a locked file. -// createDir("test/fixtures/database"); -// deleteFile("test/fixtures/database/locked.db"); -// FileLock guard("test/fixtures/database/locked.db"); -// -// OfflineDatabase db("test/fixtures/database/locked.db"); -// -// { -// // Adds a file (which should fail). -// Log::setObserver(std::make_unique<FixtureLogObserver>()); -// -// db.put({ Resource::Unknown, "mapbox://test" }, Response()); -// db.get({ Resource::Unknown, "mapbox://test" }, [] (optional<Response> res) { -// EXPECT_FALSE(bool(res)); -// }); -// -// auto observer = Log::removeObserver(); -// auto flo = dynamic_cast<FixtureLogObserver*>(observer.get()); -// EXPECT_EQ(8ul, flo->count({ EventSeverity::Error, Event::Database, 5, "database is locked" })); -// } -// -// // Then, unlock the file and try again. -// guard.unlock(); -// -// { -// // Then, set a file and obtain it again. -// Log::setObserver(std::make_unique<FixtureLogObserver>()); -// -// Response response; -// response.data = std::make_shared<std::string>("Demo"); -// db.put({ Resource::Unknown, "mapbox://test" }, response); -// db.get({ Resource::Unknown, "mapbox://test" }, [] (optional<Response> res) { -// ASSERT_TRUE(bool(res)); -// ASSERT_TRUE(res->data.get()); -// EXPECT_EQ("Demo", *res->data); -// }); -// -// // Make sure that we got a no errors -// Log::removeObserver(); -// } -//} -// -//TEST(OfflineDatabase, DatabaseDeleted) { -// using namespace mbgl; -// -// // Create a locked file. -// createDir("test/fixtures/database"); -// deleteFile("test/fixtures/database/locked.db"); -// -// OfflineDatabase db("test/fixtures/database/locked.db"); -// -// { -// // Adds a file. -// Log::setObserver(std::make_unique<FixtureLogObserver>()); -// -// Response response; -// response.data = std::make_shared<std::string>("Demo"); -// db.put({ Resource::Unknown, "mapbox://test" }, response); -// db.get({ Resource::Unknown, "mapbox://test" }, [] (optional<Response> res) { -// ASSERT_TRUE(bool(res)); -// ASSERT_TRUE(res->data.get()); -// EXPECT_EQ("Demo", *res->data); -// }); -// -// Log::removeObserver(); -// } -// -// deleteFile("test/fixtures/database/locked.db"); -// -// { -// // Adds a file. -// Log::setObserver(std::make_unique<FixtureLogObserver>()); -// -// Response response; -// response.data = std::make_shared<std::string>("Demo"); -// db.put({ Resource::Unknown, "mapbox://test" }, response); -// db.get({ Resource::Unknown, "mapbox://test" }, [] (optional<Response> res) { -// ASSERT_TRUE(bool(res)); -// ASSERT_TRUE(res->data.get()); -// EXPECT_EQ("Demo", *res->data); -// }); -// -// auto observer = Log::removeObserver(); -// auto flo = dynamic_cast<FixtureLogObserver*>(observer.get()); -// EXPECT_EQ(1ul, flo->count({ EventSeverity::Error, Event::Database, 8, "attempt to write a readonly database" })); -// } -//} - TEST(OfflineDatabase, PutDoesNotStoreConnectionErrors) { using namespace mbgl; @@ -491,11 +345,11 @@ TEST(OfflineDatabase, CreateRegionInfiniteMaxZoom) { TEST(OfflineDatabase, TEST_REQUIRES_WRITE(ConcurrentUse)) { using namespace mbgl; - createDir("test/fixtures/database"); - deleteFile("test/fixtures/database/offline.db"); + createDir("test/fixtures/offline_database"); + deleteFile("test/fixtures/offline_database/offline.db"); - OfflineDatabase db1("test/fixtures/database/offline.db"); - OfflineDatabase db2("test/fixtures/database/offline.db"); + OfflineDatabase db1("test/fixtures/offline_database/offline.db"); + OfflineDatabase db2("test/fixtures/offline_database/offline.db"); Resource resource { Resource::Style, "http://example.com/" }; Response response; @@ -671,18 +525,18 @@ TEST(OfflineDatabase, MigrateFromV2Schema) { // v2.db is a v2 database containing a single offline region with a small number of resources. - deleteFile("test/fixtures/offline/v3.db"); - writeFile("test/fixtures/offline/v3.db", util::read_file("test/fixtures/offline/v2.db")); + deleteFile("test/fixtures/offline_database/v3.db"); + writeFile("test/fixtures/offline_database/v3.db", util::read_file("test/fixtures/offline_database/v2.db")); { - OfflineDatabase db("test/fixtures/offline/v3.db", 0); + OfflineDatabase db("test/fixtures/offline_database/v3.db", 0); auto regions = db.listRegions(); for (auto& region : regions) { db.deleteRegion(std::move(region)); } } - EXPECT_EQ(3, databaseUserVersion("test/fixtures/offline/v3.db")); - EXPECT_LT(databasePageCount("test/fixtures/offline/v3.db"), - databasePageCount("test/fixtures/offline/v2.db")); + EXPECT_EQ(3, databaseUserVersion("test/fixtures/offline_database/v3.db")); + EXPECT_LT(databasePageCount("test/fixtures/offline_database/v3.db"), + databasePageCount("test/fixtures/offline_database/v2.db")); } diff --git a/test/storage/offline_download.cpp b/test/storage/offline_download.cpp index 0898043232..7ac9b94e81 100644 --- a/test/storage/offline_download.cpp +++ b/test/storage/offline_download.cpp @@ -48,7 +48,7 @@ public: Response response(const std::string& path) { Response result; - result.data = std::make_shared<std::string>(util::read_file("test/fixtures/"s + path)); + result.data = std::make_shared<std::string>(util::read_file("test/fixtures/offline_download/"s + path)); size_t uncompressed = result.data->size(); size_t compressed = util::compress(*result.data).size(); size += std::min(uncompressed, compressed); @@ -61,12 +61,12 @@ TEST(OfflineDownload, NoSubresources) { OfflineRegion region = test.createRegion(); OfflineDownload download( region.getID(), - OfflineTilePyramidRegionDefinition("http://127.0.0.1:3000/offline/style.json", LatLngBounds::world(), 0.0, 0.0, 1.0), + OfflineTilePyramidRegionDefinition("http://127.0.0.1:3000/style.json", LatLngBounds::world(), 0.0, 0.0, 1.0), test.db, test.fileSource); test.fileSource.styleResponse = [&] (const Resource& resource) { - EXPECT_EQ("http://127.0.0.1:3000/offline/style.json", resource.url); - return test.response("offline/empty.style.json"); + EXPECT_EQ("http://127.0.0.1:3000/style.json", resource.url); + return test.response("empty.style.json"); }; auto observer = std::make_unique<MockObserver>(); @@ -101,22 +101,22 @@ TEST(OfflineDownload, InlineSource) { OfflineRegion region = test.createRegion(); OfflineDownload download( region.getID(), - OfflineTilePyramidRegionDefinition("http://127.0.0.1:3000/offline/style.json", LatLngBounds::world(), 0.0, 0.0, 1.0), + OfflineTilePyramidRegionDefinition("http://127.0.0.1:3000/style.json", LatLngBounds::world(), 0.0, 0.0, 1.0), test.db, test.fileSource); test.fileSource.styleResponse = [&] (const Resource& resource) { - EXPECT_EQ("http://127.0.0.1:3000/offline/style.json", resource.url); - return test.response("offline/inline_source.style.json"); + EXPECT_EQ("http://127.0.0.1:3000/style.json", resource.url); + return test.response("inline_source.style.json"); }; test.fileSource.tileResponse = [&] (const Resource& resource) { const Resource::TileData& tile = *resource.tileData; - EXPECT_EQ("http://127.0.0.1:3000/offline/{z}-{x}-{y}.vector.pbf", tile.urlTemplate); + EXPECT_EQ("http://127.0.0.1:3000/{z}-{x}-{y}.vector.pbf", tile.urlTemplate); EXPECT_EQ(1, tile.pixelRatio); EXPECT_EQ(0, tile.x); EXPECT_EQ(0, tile.y); EXPECT_EQ(0, tile.z); - return test.response("offline/0-0-0.vector.pbf"); + return test.response("0-0-0.vector.pbf"); }; auto observer = std::make_unique<MockObserver>(); @@ -141,17 +141,17 @@ TEST(OfflineDownload, GeoJSONSource) { OfflineRegion region = test.createRegion(); OfflineDownload download( region.getID(), - OfflineTilePyramidRegionDefinition("http://127.0.0.1:3000/offline/style.json", LatLngBounds::world(), 0.0, 0.0, 1.0), + OfflineTilePyramidRegionDefinition("http://127.0.0.1:3000/style.json", LatLngBounds::world(), 0.0, 0.0, 1.0), test.db, test.fileSource); test.fileSource.styleResponse = [&] (const Resource& resource) { - EXPECT_EQ("http://127.0.0.1:3000/offline/style.json", resource.url); - return test.response("offline/geojson_source.style.json"); + EXPECT_EQ("http://127.0.0.1:3000/style.json", resource.url); + return test.response("geojson_source.style.json"); }; test.fileSource.sourceResponse = [&] (const Resource& resource) { - EXPECT_EQ("http://127.0.0.1:3000/offline/geojson.json", resource.url); - return test.response("offline/geojson.json"); + EXPECT_EQ("http://127.0.0.1:3000/geojson.json", resource.url); + return test.response("geojson.json"); }; auto observer = std::make_unique<MockObserver>(); @@ -176,41 +176,41 @@ TEST(OfflineDownload, Activate) { OfflineRegion region = test.createRegion(); OfflineDownload download( region.getID(), - OfflineTilePyramidRegionDefinition("http://127.0.0.1:3000/offline/style.json", LatLngBounds::world(), 0.0, 0.0, 1.0), + OfflineTilePyramidRegionDefinition("http://127.0.0.1:3000/style.json", LatLngBounds::world(), 0.0, 0.0, 1.0), test.db, test.fileSource); test.fileSource.styleResponse = [&] (const Resource& resource) { - EXPECT_EQ("http://127.0.0.1:3000/offline/style.json", resource.url); - return test.response("offline/style.json"); + EXPECT_EQ("http://127.0.0.1:3000/style.json", resource.url); + return test.response("style.json"); }; test.fileSource.spriteImageResponse = [&] (const Resource& resource) { - EXPECT_EQ("http://127.0.0.1:3000/offline/sprite.png", resource.url); - return test.response("offline/sprite.png"); + EXPECT_EQ("http://127.0.0.1:3000/sprite.png", resource.url); + return test.response("sprite.png"); }; test.fileSource.spriteJSONResponse = [&] (const Resource& resource) { - EXPECT_EQ("http://127.0.0.1:3000/offline/sprite.json", resource.url); - return test.response("offline/sprite.json"); + EXPECT_EQ("http://127.0.0.1:3000/sprite.json", resource.url); + return test.response("sprite.json"); }; test.fileSource.glyphsResponse = [&] (const Resource&) { - return test.response("offline/glyph.pbf"); + return test.response("glyph.pbf"); }; test.fileSource.sourceResponse = [&] (const Resource& resource) { - EXPECT_EQ("http://127.0.0.1:3000/offline/streets.json", resource.url); - return test.response("offline/streets.json"); + EXPECT_EQ("http://127.0.0.1:3000/streets.json", resource.url); + return test.response("streets.json"); }; test.fileSource.tileResponse = [&] (const Resource& resource) { const Resource::TileData& tile = *resource.tileData; - EXPECT_EQ("http://127.0.0.1:3000/offline/{z}-{x}-{y}.vector.pbf", tile.urlTemplate); + EXPECT_EQ("http://127.0.0.1:3000/{z}-{x}-{y}.vector.pbf", tile.urlTemplate); EXPECT_EQ(1, tile.pixelRatio); EXPECT_EQ(0, tile.x); EXPECT_EQ(0, tile.y); EXPECT_EQ(0, tile.z); - return test.response("offline/0-0-0.vector.pbf"); + return test.response("0-0-0.vector.pbf"); }; auto observer = std::make_unique<MockObserver>(); @@ -243,7 +243,7 @@ TEST(OfflineDownload, GetStatusNoResources) { OfflineRegion region = test.createRegion(); OfflineDownload download( region.getID(), - OfflineTilePyramidRegionDefinition("http://127.0.0.1:3000/offline/style.json", LatLngBounds::world(), 0.0, 0.0, 1.0), + OfflineTilePyramidRegionDefinition("http://127.0.0.1:3000/style.json", LatLngBounds::world(), 0.0, 0.0, 1.0), test.db, test.fileSource); OfflineRegionStatus status = download.getStatus(); @@ -260,12 +260,12 @@ TEST(OfflineDownload, GetStatusStyleComplete) { OfflineRegion region = test.createRegion(); OfflineDownload download( region.getID(), - OfflineTilePyramidRegionDefinition("http://127.0.0.1:3000/offline/style.json", LatLngBounds::world(), 0.0, 0.0, 1.0), + OfflineTilePyramidRegionDefinition("http://127.0.0.1:3000/style.json", LatLngBounds::world(), 0.0, 0.0, 1.0), test.db, test.fileSource); test.db.putRegionResource(1, - Resource::style("http://127.0.0.1:3000/offline/style.json"), - test.response("offline/style.json")); + Resource::style("http://127.0.0.1:3000/style.json"), + test.response("style.json")); OfflineRegionStatus status = download.getStatus(); @@ -282,16 +282,16 @@ TEST(OfflineDownload, GetStatusStyleAndSourceComplete) { OfflineRegion region = test.createRegion(); OfflineDownload download( region.getID(), - OfflineTilePyramidRegionDefinition("http://127.0.0.1:3000/offline/style.json", LatLngBounds::world(), 0.0, 0.0, 1.0), + OfflineTilePyramidRegionDefinition("http://127.0.0.1:3000/style.json", LatLngBounds::world(), 0.0, 0.0, 1.0), test.db, test.fileSource); test.db.putRegionResource(1, - Resource::style("http://127.0.0.1:3000/offline/style.json"), - test.response("offline/style.json")); + Resource::style("http://127.0.0.1:3000/style.json"), + test.response("style.json")); test.db.putRegionResource(1, - Resource::source("http://127.0.0.1:3000/offline/streets.json"), - test.response("offline/streets.json")); + Resource::source("http://127.0.0.1:3000/streets.json"), + test.response("streets.json")); OfflineRegionStatus status = download.getStatus(); @@ -308,7 +308,7 @@ TEST(OfflineDownload, RequestError) { OfflineRegion region = test.createRegion(); OfflineDownload download( region.getID(), - OfflineTilePyramidRegionDefinition("http://127.0.0.1:3000/offline/style.json", LatLngBounds::world(), 0.0, 0.0, 1.0), + OfflineTilePyramidRegionDefinition("http://127.0.0.1:3000/style.json", LatLngBounds::world(), 0.0, 0.0, 1.0), test.db, test.fileSource); test.fileSource.styleResponse = [&] (const Resource&) { @@ -336,12 +336,12 @@ TEST(OfflineDownload, RequestErrorsAreRetried) { OfflineRegion region = test.createRegion(); OfflineDownload download( region.getID(), - OfflineTilePyramidRegionDefinition("http://127.0.0.1:3000/offline/style.json", LatLngBounds::world(), 0.0, 0.0, 1.0), + OfflineTilePyramidRegionDefinition("http://127.0.0.1:3000/style.json", LatLngBounds::world(), 0.0, 0.0, 1.0), test.db, test.fileSource); test.fileSource.styleResponse = [&] (const Resource&) { test.fileSource.styleResponse = [&] (const Resource&) { - return test.response("offline/empty.style.json"); + return test.response("empty.style.json"); }; Response response; @@ -369,7 +369,7 @@ TEST(OfflineDownload, TileCountLimitExceededNoTileResponse) { OfflineRegion region = test.createRegion(); OfflineDownload download( region.getID(), - OfflineTilePyramidRegionDefinition("http://127.0.0.1:3000/offline/style.json", LatLngBounds::world(), 0.0, 0.0, 1.0), + OfflineTilePyramidRegionDefinition("http://127.0.0.1:3000/style.json", LatLngBounds::world(), 0.0, 0.0, 1.0), test.db, test.fileSource); uint64_t tileLimit = 0; @@ -377,8 +377,8 @@ TEST(OfflineDownload, TileCountLimitExceededNoTileResponse) { test.db.setOfflineMapboxTileCountLimit(tileLimit); test.fileSource.styleResponse = [&] (const Resource& resource) { - EXPECT_EQ("http://127.0.0.1:3000/offline/style.json", resource.url); - return test.response("offline/mapbox_source.style.json"); + EXPECT_EQ("http://127.0.0.1:3000/style.json", resource.url); + return test.response("mapbox_source.style.json"); }; auto observer = std::make_unique<MockObserver>(); @@ -411,7 +411,7 @@ TEST(OfflineDownload, TileCountLimitExceededWithTileResponse) { OfflineRegion region = test.createRegion(); OfflineDownload download( region.getID(), - OfflineTilePyramidRegionDefinition("http://127.0.0.1:3000/offline/style.json", LatLngBounds::world(), 0.0, 0.0, 1.0), + OfflineTilePyramidRegionDefinition("http://127.0.0.1:3000/style.json", LatLngBounds::world(), 0.0, 0.0, 1.0), test.db, test.fileSource); uint64_t tileLimit = 1; @@ -419,8 +419,8 @@ TEST(OfflineDownload, TileCountLimitExceededWithTileResponse) { test.db.setOfflineMapboxTileCountLimit(tileLimit); test.fileSource.styleResponse = [&] (const Resource& resource) { - EXPECT_EQ("http://127.0.0.1:3000/offline/style.json", resource.url); - return test.response("offline/mapbox_source.style.json"); + EXPECT_EQ("http://127.0.0.1:3000/style.json", resource.url); + return test.response("mapbox_source.style.json"); }; test.fileSource.tileResponse = [&] (const Resource& resource) { @@ -430,7 +430,7 @@ TEST(OfflineDownload, TileCountLimitExceededWithTileResponse) { EXPECT_EQ(0, tile.x); EXPECT_EQ(0, tile.y); EXPECT_EQ(0, tile.z); - return test.response("offline/0-0-0.vector.pbf"); + return test.response("0-0-0.vector.pbf"); }; auto observer = std::make_unique<MockObserver>(); @@ -465,17 +465,17 @@ TEST(OfflineDownload, WithPreviouslyExistingTile) { OfflineRegion region = test.createRegion(); OfflineDownload download( region.getID(), - OfflineTilePyramidRegionDefinition("http://127.0.0.1:3000/offline/style.json", LatLngBounds::world(), 0.0, 0.0, 1.0), + OfflineTilePyramidRegionDefinition("http://127.0.0.1:3000/style.json", LatLngBounds::world(), 0.0, 0.0, 1.0), test.db, test.fileSource); test.fileSource.styleResponse = [&] (const Resource& resource) { - EXPECT_EQ("http://127.0.0.1:3000/offline/style.json", resource.url); - return test.response("offline/inline_source.style.json"); + EXPECT_EQ("http://127.0.0.1:3000/style.json", resource.url); + return test.response("inline_source.style.json"); }; test.db.put( - Resource::tile("http://127.0.0.1:3000/offline/{z}-{x}-{y}.vector.pbf", 1, 0, 0, 0), - test.response("offline/0-0-0.vector.pbf")); + Resource::tile("http://127.0.0.1:3000/{z}-{x}-{y}.vector.pbf", 1, 0, 0, 0), + test.response("0-0-0.vector.pbf")); auto observer = std::make_unique<MockObserver>(); @@ -499,17 +499,17 @@ TEST(OfflineDownload, ReactivatePreviouslyCompletedDownload) { OfflineRegion region = test.createRegion(); OfflineDownload download( region.getID(), - OfflineTilePyramidRegionDefinition("http://127.0.0.1:3000/offline/style.json", LatLngBounds::world(), 0.0, 0.0, 1.0), + OfflineTilePyramidRegionDefinition("http://127.0.0.1:3000/style.json", LatLngBounds::world(), 0.0, 0.0, 1.0), test.db, test.fileSource); test.fileSource.styleResponse = [&] (const Resource& resource) { - EXPECT_EQ("http://127.0.0.1:3000/offline/style.json", resource.url); - return test.response("offline/inline_source.style.json"); + EXPECT_EQ("http://127.0.0.1:3000/style.json", resource.url); + return test.response("inline_source.style.json"); }; test.db.put( - Resource::tile("http://127.0.0.1:3000/offline/{z}-{x}-{y}.vector.pbf", 1, 0, 0, 0), - test.response("offline/0-0-0.vector.pbf")); + Resource::tile("http://127.0.0.1:3000/{z}-{x}-{y}.vector.pbf", 1, 0, 0, 0), + test.response("0-0-0.vector.pbf")); auto observer = std::make_unique<MockObserver>(); observer->statusChangedFn = [&] (OfflineRegionStatus status) { @@ -525,7 +525,7 @@ TEST(OfflineDownload, ReactivatePreviouslyCompletedDownload) { OfflineDownload redownload( region.getID(), - OfflineTilePyramidRegionDefinition("http://127.0.0.1:3000/offline/style.json", LatLngBounds::world(), 0.0, 0.0, 1.0), + OfflineTilePyramidRegionDefinition("http://127.0.0.1:3000/style.json", LatLngBounds::world(), 0.0, 0.0, 1.0), test.db, test.fileSource); std::vector<OfflineRegionStatus> statusesAfterReactivate; @@ -566,12 +566,12 @@ TEST(OfflineDownload, Deactivate) { OfflineRegion region = test.createRegion(); OfflineDownload download( region.getID(), - OfflineTilePyramidRegionDefinition("http://127.0.0.1:3000/offline/style.json", LatLngBounds::world(), 0.0, 0.0, 1.0), + OfflineTilePyramidRegionDefinition("http://127.0.0.1:3000/style.json", LatLngBounds::world(), 0.0, 0.0, 1.0), test.db, test.fileSource); test.fileSource.styleResponse = [&] (const Resource& resource) { - EXPECT_EQ("http://127.0.0.1:3000/offline/style.json", resource.url); - return test.response("offline/mapbox_source.style.json"); + EXPECT_EQ("http://127.0.0.1:3000/style.json", resource.url); + return test.response("mapbox_source.style.json"); }; auto observer = std::make_unique<MockObserver>(); |