summaryrefslogtreecommitdiff
path: root/test/storage/http_other_loop.cpp
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2015-01-21 19:30:58 +0100
committerKonstantin Käfer <mail@kkaefer.com>2015-02-04 10:49:05 +0100
commit8a1fce547e9ad0bf750418c844c9b23a3ee6d8dd (patch)
treee3f0e8f4b16071667c6a4fdf706740335500dbc6 /test/storage/http_other_loop.cpp
parent5503aef6907b1fea74d6bdbe696f02b9f016f752 (diff)
downloadqtlocation-mapboxgl-8a1fce547e9ad0bf750418c844c9b23a3ee6d8dd.tar.gz
rearrange tests and add storage tests
Diffstat (limited to 'test/storage/http_other_loop.cpp')
-rw-r--r--test/storage/http_other_loop.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/storage/http_other_loop.cpp b/test/storage/http_other_loop.cpp
new file mode 100644
index 0000000000..01779453d5
--- /dev/null
+++ b/test/storage/http_other_loop.cpp
@@ -0,0 +1,26 @@
+#include "../util.hpp"
+
+#include <uv.h>
+
+#include <mbgl/storage/default/default_file_source.hpp>
+
+TEST(Storage, HTTPOtherLoop) {
+ SCOPED_TEST(HTTPOtherLoop)
+
+ using namespace mbgl;
+
+ // This file source launches a separate thread to do the processing.
+ DefaultFileSource fs(nullptr);
+
+ fs.request({ Resource::Unknown, "http://127.0.0.1:3000/test" }, uv_default_loop(), [&](const Response &res) {
+ EXPECT_EQ(res.status, Response::Successful);
+ EXPECT_EQ(res.data, "Hello World!");
+ EXPECT_EQ(res.expires, 0);
+ EXPECT_EQ(res.modified, 0);
+ EXPECT_EQ(res.etag, "");
+ EXPECT_EQ(res.message, "");
+ HTTPOtherLoop.finish();
+ });
+
+ uv_run(uv_default_loop(), UV_RUN_DEFAULT);
+}