summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorThiago Marcos P. Santos <thiago@mapbox.com>2016-02-22 19:43:25 +0200
committerThiago Marcos P. Santos <thiago@mapbox.com>2016-02-23 00:21:57 +0200
commit2b44c4b096bbe49d2d1d7c3e17f7e7fee825cb41 (patch)
treee2a885edf260357434c5bc6780247bd53f08c5ae /test
parentd836638407c7eae66fdf4b27f596391c591baeab (diff)
downloadqtlocation-mapboxgl-2b44c4b096bbe49d2d1d7c3e17f7e7fee825cb41.tar.gz
[tests] Add utests for HTTP 200 with no data
The implementation should return a valid empty string.
Diffstat (limited to 'test')
-rw-r--r--test/storage/http_reading.cpp25
-rwxr-xr-xtest/storage/server.js4
2 files changed, 29 insertions, 0 deletions
diff --git a/test/storage/http_reading.cpp b/test/storage/http_reading.cpp
index b8e474ee43..fdc49ee5e6 100644
--- a/test/storage/http_reading.cpp
+++ b/test/storage/http_reading.cpp
@@ -84,6 +84,31 @@ TEST_F(Storage, HTTPTile404) {
loop.run();
}
+TEST_F(Storage, HTTP200EmptyData) {
+ SCOPED_TEST(HTTP200EmptyData)
+
+ using namespace mbgl;
+
+ util::RunLoop loop;
+ OnlineFileSource fs;
+
+ std::unique_ptr<FileRequest> req = fs.request({ Resource::Unknown, "http://127.0.0.1:3000/empty-data" },
+ [&](Response res) {
+ req.reset();
+ EXPECT_TRUE(util::ThreadContext::currentlyOn(util::ThreadType::Main));
+ EXPECT_FALSE(res.noContent);
+ EXPECT_FALSE(bool(res.error));
+ EXPECT_EQ(*res.data, std::string());
+ EXPECT_FALSE(bool(res.expires));
+ EXPECT_FALSE(bool(res.modified));
+ EXPECT_FALSE(bool(res.etag));
+ loop.stop();
+ HTTP200EmptyData.finish();
+ });
+
+ loop.run();
+}
+
TEST_F(Storage, HTTP204) {
SCOPED_TEST(HTTP204)
diff --git a/test/storage/server.js b/test/storage/server.js
index 16b507daa9..d15544a0fd 100755
--- a/test/storage/server.js
+++ b/test/storage/server.js
@@ -84,6 +84,10 @@ app.get('/revalidate-etag', function(req, res) {
revalidateEtagCounter++;
});
+app.get('/empty-data', function(req, res) {
+ res.status(200).send();
+});
+
app.get('/no-content', function(req, res) {
res.status(204).send();
});