diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2016-02-10 13:22:09 -0800 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2016-02-10 15:40:20 -0800 |
commit | 0cf450e3e529423737c6b4aa196b271442530345 (patch) | |
tree | fc5f49156dc43420962bce604603a145b75595dc /test/storage | |
parent | a9e0c1b99a0489c6bc192c0681fa1dfc6e565bbe (diff) | |
download | qtlocation-mapboxgl-0cf450e3e529423737c6b4aa196b271442530345.tar.gz |
[core] Retry errors encountered during offline downloads
Diffstat (limited to 'test/storage')
-rw-r--r-- | test/storage/offline_download.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/test/storage/offline_download.cpp b/test/storage/offline_download.cpp index d89d4a035c..6de14d37b2 100644 --- a/test/storage/offline_download.cpp +++ b/test/storage/offline_download.cpp @@ -300,3 +300,35 @@ TEST(OfflineDownload, RequestError) { test.loop.run(); } + +TEST(OfflineDownload, RequestErrorsAreRetried) { + OfflineTest test; + OfflineDownload download( + 1, + OfflineTilePyramidRegionDefinition("http://127.0.0.1:3000/offline/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"); + }; + + Response response; + response.error = std::make_unique<Response::Error>(Response::Error::Reason::Connection, "connection error"); + return response; + }; + + auto observer = std::make_unique<MockObserver>(); + + observer->statusChangedFn = [&] (OfflineRegionStatus status) { + if (status.complete()) { + EXPECT_EQ(1, status.completedResourceCount); + test.loop.stop(); + } + }; + + download.setObserver(std::move(observer)); + download.setState(OfflineRegionDownloadState::Active); + + test.loop.run(); +} |