diff options
author | Juha Alanen <juha.alanen@mapbox.com> | 2020-01-30 10:27:54 +0200 |
---|---|---|
committer | Juha Alanen <juha.alanen@mapbox.com> | 2020-02-06 17:52:12 +0200 |
commit | aed25c04383bfccfb8860a4745691538a16e093a (patch) | |
tree | ce12fa5fd999705c9cf98b547e9111042f6bade1 /test/storage/main_resource_loader.test.cpp | |
parent | ce5b7ad1138f5095f5dbf1fb67586c0f5ba9dc47 (diff) | |
download | qtlocation-mapboxgl-aed25c04383bfccfb8860a4745691538a16e093a.tar.gz |
[test] Improve the stability of a test on Android
Diffstat (limited to 'test/storage/main_resource_loader.test.cpp')
-rw-r--r-- | test/storage/main_resource_loader.test.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/test/storage/main_resource_loader.test.cpp b/test/storage/main_resource_loader.test.cpp index c5f1a9c707..ee9211b064 100644 --- a/test/storage/main_resource_loader.test.cpp +++ b/test/storage/main_resource_loader.test.cpp @@ -687,16 +687,23 @@ TEST(MainResourceLoader, TEST_REQUIRES_SERVER(CachedResourceLowPriority)) { response.data = std::make_shared<std::string>("Cached Request 4"); dbfs->forward(resource2, response); - onlineFs->setProperty("max-concurrent-requests", 1u); + onlineFs->setProperty(MAX_CONCURRENT_REQUESTS_KEY, 1u); fs.pause(); NetworkStatus::Set(NetworkStatus::Status::Offline); // Ensure that the online requests for new resources are processed first. + Resource nonCached0{Resource::Unknown, "http://127.0.0.1:3000/load/0", {}, Resource::LoadingMethod::All}; + std::unique_ptr<AsyncRequest> req0 = fs.request(nonCached0, [&](Response res) { + req0.reset(); + EXPECT_EQ(online_response_counter, 0); // make sure this is responded first + EXPECT_EQ("Request 0", *res.data); + }); + Resource nonCached1{Resource::Unknown, "http://127.0.0.1:3000/load/1", {}, Resource::LoadingMethod::All}; std::unique_ptr<AsyncRequest> req1 = fs.request(nonCached1, [&](Response res) { online_response_counter++; req1.reset(); - EXPECT_EQ(online_response_counter, 1); // make sure this is responded first + EXPECT_EQ(online_response_counter, 1); // make sure this is responded second EXPECT_EQ("Request 1", *res.data); }); @@ -733,7 +740,7 @@ TEST(MainResourceLoader, TEST_REQUIRES_SERVER(CachedResourceLowPriority)) { std::unique_ptr<AsyncRequest> req2 = fs.request(nonCached2, [&](Response res) { online_response_counter++; req2.reset(); - EXPECT_EQ(online_response_counter, 2); // make sure this is responded second + EXPECT_EQ(online_response_counter, 2); // make sure this is responded third EXPECT_EQ("Request 2", *res.data); }); |