summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThiago Marcos P. Santos <tmpsantos@gmail.com>2018-11-13 02:52:53 +0200
committerThiago Marcos P. Santos <tmpsantos@gmail.com>2018-11-13 18:07:18 +0200
commit197a78a8e284a726495c4379fb652b1f2a5ef01c (patch)
tree7e80cc59b06ac42b43cc9837943441ad344cc710
parenteb93901d6de53074c13c737442a101bbe271d4f6 (diff)
downloadqtlocation-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.cpp20
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();
+}