From c85e7cbce01d655424906750aeb6288e3ecf586d Mon Sep 17 00:00:00 2001 From: Mikhail Pozdnyakov Date: Tue, 25 Feb 2020 18:06:48 +0200 Subject: Add OfflineDownload.NoFreezingOnCachedTilesAndNewStyle unit test --- test/src/mbgl/test/stub_file_source.cpp | 9 +++++++++ test/src/mbgl/test/stub_file_source.hpp | 4 ++++ 2 files changed, 13 insertions(+) (limited to 'test/src') diff --git a/test/src/mbgl/test/stub_file_source.cpp b/test/src/mbgl/test/stub_file_source.cpp index 8870a45bdc..f1fb79bea3 100644 --- a/test/src/mbgl/test/stub_file_source.cpp +++ b/test/src/mbgl/test/stub_file_source.cpp @@ -70,6 +70,15 @@ void StubFileSource::remove(AsyncRequest* req) { } } +void StubFileSource::setProperty(const std::string& key, const mapbox::base::Value& value) { + properties[key] = value; +} + +mapbox::base::Value StubFileSource::getProperty(const std::string& key) const { + auto it = properties.find(key); + return (it != properties.end()) ? it->second : mapbox::base::Value(); +} + optional StubFileSource::defaultResponse(const Resource& resource) { switch (resource.kind) { case Resource::Kind::Style: diff --git a/test/src/mbgl/test/stub_file_source.hpp b/test/src/mbgl/test/stub_file_source.hpp index 46bb33d5e2..b88adc93df 100644 --- a/test/src/mbgl/test/stub_file_source.hpp +++ b/test/src/mbgl/test/stub_file_source.hpp @@ -5,6 +5,7 @@ #include #include +#include #include namespace mbgl { @@ -22,6 +23,8 @@ public: std::unique_ptr request(const Resource&, Callback) override; bool canRequest(const Resource&) const override { return true; } void remove(AsyncRequest*); + void setProperty(const std::string&, const mapbox::base::Value&) override; + mapbox::base::Value getProperty(const std::string&) const override; using ResponseFunction = std::function (const Resource&)>; @@ -48,6 +51,7 @@ private: std::unordered_map> pending; ResponseType type; util::Timer timer; + std::map properties; }; } // namespace mbgl -- cgit v1.2.1