diff options
author | Thiago Marcos P. Santos <tmpsantos@gmail.com> | 2018-11-13 02:52:53 +0200 |
---|---|---|
committer | Thiago Marcos P. Santos <tmpsantos@gmail.com> | 2018-11-13 18:07:18 +0200 |
commit | 197a78a8e284a726495c4379fb652b1f2a5ef01c (patch) | |
tree | 7e80cc59b06ac42b43cc9837943441ad344cc710 | |
parent | eb93901d6de53074c13c737442a101bbe271d4f6 (diff) | |
download | qtlocation-mapboxgl-upstream/tmpsantos-fix_crash_qt_network.tar.gz |
[test] Add test for when requesting the same resource many timesupstream/tmpsantos-fix_crash_qt_network
This test would have prevented the crash fixed by the previous patch.
-rw-r--r-- | test/storage/online_file_source.test.cpp | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/test/storage/online_file_source.test.cpp b/test/storage/online_file_source.test.cpp index 5021a513e3..39582543ef 100644 --- a/test/storage/online_file_source.test.cpp +++ b/test/storage/online_file_source.test.cpp @@ -515,4 +515,22 @@ TEST(OnlineFileSource, TEST_REQUIRES_SERVER(LowHighPriorityRequestsMany)) { NetworkStatus::Set(NetworkStatus::Status::Online); loop.run(); -}
\ No newline at end of file +} + +TEST(OnlineFileSource, TEST_REQUIRES_SERVER(RequestSameUrlMultipleTimes)) { + util::RunLoop loop; + OnlineFileSource fs; + + int count = 0; + std::vector<std::unique_ptr<AsyncRequest>> requests; + + for (int i = 0; i < 100; ++i) { + requests.emplace_back(fs.request({ Resource::Unknown, "http://127.0.0.1:3000/load" }, [&](Response) { + if (++count == 100) { + loop.stop(); + } + })); + } + + loop.run(); +} |