diff options
author | Huyen Chau Nguyen <hello@chau-nguyen.de> | 2018-10-31 09:51:50 +0100 |
---|---|---|
committer | Asheem Mamoowala <asheem.mamoowala@mapbox.com> | 2018-11-15 12:19:48 -0800 |
commit | 8d0b06d5dd73313724bf5186a244f3ad3e7ba85e (patch) | |
tree | eea5e5c0d397a78ca2e61a93a4f4087bc2537aa1 /test/storage | |
parent | 9a606caf0b33d5dba33e33ce3fb59724e1849eb1 (diff) | |
download | qtlocation-mapboxgl-8d0b06d5dd73313724bf5186a244f3ad3e7ba85e.tar.gz |
[core] add test about number of maximum concurrent requests
Diffstat (limited to 'test/storage')
-rw-r--r-- | test/storage/offline_download.test.cpp | 6 | ||||
-rw-r--r-- | test/storage/online_file_source.test.cpp | 9 |
2 files changed, 12 insertions, 3 deletions
diff --git a/test/storage/offline_download.test.cpp b/test/storage/offline_download.test.cpp index 4db807a204..83fb7f3c18 100644 --- a/test/storage/offline_download.test.cpp +++ b/test/storage/offline_download.test.cpp @@ -61,7 +61,7 @@ public: } util::RunLoop loop; - StubFileSource fileSource; + StubOnlineFileSource fileSource; OfflineDatabase db; std::size_t size = 0; @@ -277,8 +277,8 @@ TEST(OfflineDownload, Activate) { } TEST(OfflineDownload, DoesNotFloodTheFileSourceWithRequests) { - FakeFileSource fileSource; OfflineTest test; + FakeOnlineFileSource fileSource; auto region = test.createRegion(); ASSERT_TRUE(region); OfflineDownload download( @@ -297,7 +297,7 @@ TEST(OfflineDownload, DoesNotFloodTheFileSourceWithRequests) { fileSource.respond(Resource::Kind::Style, test.response("style.json")); test.loop.runOnce(); - EXPECT_EQ(HTTPFileSource::maximumConcurrentRequests(), fileSource.requests.size()); + EXPECT_EQ(fileSource.getMaximumConcurrentRequests(), fileSource.requests.size()); } TEST(OfflineDownload, GetStatusNoResources) { diff --git a/test/storage/online_file_source.test.cpp b/test/storage/online_file_source.test.cpp index 36d6f63a77..756a7a92d1 100644 --- a/test/storage/online_file_source.test.cpp +++ b/test/storage/online_file_source.test.cpp @@ -517,6 +517,15 @@ TEST(OnlineFileSource, TEST_REQUIRES_SERVER(LowHighPriorityRequestsMany)) { loop.run(); } +TEST(OnlineFileSource, TEST_REQUIRES_SERVER(MaximumConcurrentRequests)) { + util::RunLoop loop; + OnlineFileSource fs; + + ASSERT_EQ(fs.getMaximumConcurrentRequests(), 20u); + + fs.setMaximumConcurrentRequests(10); + ASSERT_EQ(fs.getMaximumConcurrentRequests(), 10u); +} TEST(OnlineFileSource, TEST_REQUIRES_SERVER(RequestSameUrlMultipleTimes)) { util::RunLoop loop; OnlineFileSource fs; |