diff options
Diffstat (limited to 'test/storage/offline_download.test.cpp')
-rw-r--r-- | test/storage/offline_download.test.cpp | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/test/storage/offline_download.test.cpp b/test/storage/offline_download.test.cpp index 5fc0e752df..01baf29592 100644 --- a/test/storage/offline_download.test.cpp +++ b/test/storage/offline_download.test.cpp @@ -662,6 +662,66 @@ TEST(OfflineDownload, Deactivate) { test.loop.run(); } + +TEST(OfflineDownload, LowPriorityRequests) { + OfflineTest test; + auto region = test.createRegion(); + ASSERT_TRUE(region); + OfflineDownload download( + region->getID(), + 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_TRUE(resource.priority == Resource::Priority::Low); + return test.response("style.json"); + }; + + test.fileSource.spriteImageResponse = [&] (const Resource& resource) { + EXPECT_TRUE(resource.priority == Resource::Priority::Low); + return test.response("sprite.png"); + }; + + test.fileSource.imageResponse = [&] (const Resource& resource) { + EXPECT_TRUE(resource.priority == Resource::Priority::Low); + return test.response("radar.gif"); + }; + + test.fileSource.spriteJSONResponse = [&] (const Resource& resource) { + EXPECT_TRUE(resource.priority == Resource::Priority::Low); + return test.response("sprite.json"); + }; + + test.fileSource.glyphsResponse = [&] (const Resource& resource) { + EXPECT_TRUE(resource.priority == Resource::Priority::Low); + return test.response("glyph.pbf"); + }; + + test.fileSource.sourceResponse = [&] (const Resource& resource) { + EXPECT_TRUE(resource.priority == Resource::Priority::Low); + return test.response("streets.json"); + }; + + test.fileSource.tileResponse = [&] (const Resource& resource) { + EXPECT_TRUE(resource.priority == Resource::Priority::Low); + return test.response("0-0-0.vector.pbf"); + }; + + auto observer = std::make_unique<MockObserver>(); + + observer->statusChangedFn = [&] (OfflineRegionStatus status) { + if (status.complete()) { + test.loop.stop(); + } + }; + + download.setObserver(std::move(observer)); + download.setState(OfflineRegionDownloadState::Active); + + test.loop.run(); +} + + #ifndef __QT__ // Qt doesn't expose the ability to register virtual file system handlers. TEST(OfflineDownload, DiskFull) { FixtureLog log; |