summaryrefslogtreecommitdiff
path: root/test/src/mbgl/test
diff options
context:
space:
mode:
Diffstat (limited to 'test/src/mbgl/test')
-rw-r--r--test/src/mbgl/test/http_server.cpp10
-rw-r--r--test/src/mbgl/test/stub_map_observer.hpp7
2 files changed, 17 insertions, 0 deletions
diff --git a/test/src/mbgl/test/http_server.cpp b/test/src/mbgl/test/http_server.cpp
index 2b72bb2c94..5679b1188b 100644
--- a/test/src/mbgl/test/http_server.cpp
+++ b/test/src/mbgl/test/http_server.cpp
@@ -1,6 +1,7 @@
#include <mbgl/test/util.hpp>
#include <mbgl/util/chrono.hpp>
+#include <mbgl/util/io.hpp>
#include <mbgl/util/logging.hpp>
// Limit to 4 threads (default is the nbr of CPU cores)
@@ -9,6 +10,8 @@
#include <atomic>
+using namespace std::literals::string_literals;
+
namespace mbgl {
namespace test {
@@ -182,6 +185,13 @@ void runServer(std::unique_ptr<httplib::Server>& server) {
res.set_content("Request " + std::string(numbers), "text/plain");
});
+ server->Get(R"(/online/(.*))", [](const Request req, Response& res) {
+ res.status = 200;
+ auto file = "test/fixtures/map/online/"s + std::string(req.matches[1]);
+ auto content = util::read_file(file);
+ res.set_content(content, "text/plain");
+ });
+
server->listen("127.0.0.1", 3000);
}
diff --git a/test/src/mbgl/test/stub_map_observer.hpp b/test/src/mbgl/test/stub_map_observer.hpp
index 89ee4e7953..63e42fa6ab 100644
--- a/test/src/mbgl/test/stub_map_observer.hpp
+++ b/test/src/mbgl/test/stub_map_observer.hpp
@@ -38,11 +38,18 @@ public:
}
}
+ void onDidBecomeIdle() final {
+ if (didBecomeIdleCallback) {
+ didBecomeIdleCallback();
+ }
+ }
+
std::function<void()> willStartLoadingMapCallback;
std::function<void()> didFinishLoadingMapCallback;
std::function<void()> didFailLoadingMapCallback;
std::function<void()> didFinishLoadingStyleCallback;
std::function<void(RenderFrameStatus)> didFinishRenderingFrameCallback;
+ std::function<void()> didBecomeIdleCallback;
};