diff options
Diffstat (limited to 'test/fixtures/stub_file_source.hpp')
-rw-r--r-- | test/fixtures/stub_file_source.hpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/test/fixtures/stub_file_source.hpp b/test/fixtures/stub_file_source.hpp index 7cb9c89320..344dff6073 100644 --- a/test/fixtures/stub_file_source.hpp +++ b/test/fixtures/stub_file_source.hpp @@ -16,25 +16,25 @@ public: std::unique_ptr<FileRequest> request(const Resource&, Callback) override; // You can set the response callback on a global level by assigning this callback: - std::function<Response (const Resource&)> response = [this] (const Resource& resource) { + std::function<optional<Response> (const Resource&)> response = [this] (const Resource& resource) { return defaultResponse(resource); }; // Or set per-kind responses by setting these callbacks: - std::function<Response (const Resource&)> styleResponse; - std::function<Response (const Resource&)> sourceResponse; - std::function<Response (const Resource&)> tileResponse; - std::function<Response (const Resource&)> glyphsResponse; - std::function<Response (const Resource&)> spriteJSONResponse; - std::function<Response (const Resource&)> spriteImageResponse; + std::function<optional<Response> (const Resource&)> styleResponse; + std::function<optional<Response> (const Resource&)> sourceResponse; + std::function<optional<Response> (const Resource&)> tileResponse; + std::function<optional<Response> (const Resource&)> glyphsResponse; + std::function<optional<Response> (const Resource&)> spriteJSONResponse; + std::function<optional<Response> (const Resource&)> spriteImageResponse; private: friend class StubFileRequest; // The default behavior is to throw if no per-kind callback has been set. - Response defaultResponse(const Resource&); + optional<Response> defaultResponse(const Resource&); - std::unordered_map<FileRequest*, std::pair<Response, Callback>> pending; + std::unordered_map<FileRequest*, std::pair<optional<Response>, Callback>> pending; util::Timer timer; }; |