Add OfflineDownload.NoFreezingOnCachedTilesAndNewStyle unit test
This commit is contained in:
@@ -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<Response> StubFileSource::defaultResponse(const Resource& resource) {
|
||||
switch (resource.kind) {
|
||||
case Resource::Kind::Style:
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <mbgl/storage/resource.hpp>
|
||||
#include <mbgl/util/timer.hpp>
|
||||
|
||||
#include <map>
|
||||
#include <unordered_map>
|
||||
|
||||
namespace mbgl {
|
||||
@@ -22,6 +23,8 @@ public:
|
||||
std::unique_ptr<AsyncRequest> 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<optional<Response> (const Resource&)>;
|
||||
|
||||
@@ -48,6 +51,7 @@ private:
|
||||
std::unordered_map<AsyncRequest*, std::tuple<Resource, ResponseFunction, Callback>> pending;
|
||||
ResponseType type;
|
||||
util::Timer timer;
|
||||
std::map<std::string, mapbox::base::Value> properties;
|
||||
};
|
||||
|
||||
} // namespace mbgl
|
||||
|
||||
Reference in New Issue
Block a user