summaryrefslogtreecommitdiff
path: root/test/mock_transport.hh
diff options
context:
space:
mode:
authorJoel Klinghed <the_jk@spawned.biz>2021-11-17 22:34:57 +0100
committerJoel Klinghed <the_jk@spawned.biz>2021-11-17 22:34:57 +0100
commit6232d13f5321b87ddf12a1aa36b4545da45f173d (patch)
tree23f3316470a14136debd9d02f9e920ca2b06f4cc /test/mock_transport.hh
Travel3: Simple image and video display site
Reads the images and videos from filesystem and builds a site in memroy.
Diffstat (limited to 'test/mock_transport.hh')
-rw-r--r--test/mock_transport.hh39
1 files changed, 39 insertions, 0 deletions
diff --git a/test/mock_transport.hh b/test/mock_transport.hh
new file mode 100644
index 0000000..7fe9235
--- /dev/null
+++ b/test/mock_transport.hh
@@ -0,0 +1,39 @@
+#ifndef MOCK_TRANSPORT_HH
+#define MOCK_TRANSPORT_HH
+
+#include "transport.hh"
+
+#include <gmock/gmock.h>
+
+class MockTransport : public Transport {
+public:
+ std::unique_ptr<Response> create_data(uint16_t code, std::string data)
+ override {
+ return std::unique_ptr<Response>(create_data_proxy(code, std::move(data)));
+ }
+
+ MOCK_METHOD(std::unique_ptr<Response>, create_file,
+ (uint16_t, std::filesystem::path),
+ (override));
+ MOCK_METHOD(std::unique_ptr<Response>, create_exif_thumbnail,
+ (uint16_t, std::filesystem::path),
+ (override));
+ MOCK_METHOD(void, add_client, (unique_fd&&), (override));
+
+ MOCK_METHOD(Response*, create_data_proxy, (uint16_t, std::string));
+};
+
+class MockResponse : public Transport::Response {
+public:
+ MOCK_METHOD(uint16_t, code, (), (override, const));
+ MOCK_METHOD((std::vector<std::pair<std::string, std::string>> const&),
+ headers, (), (override, const));
+ MOCK_METHOD(std::unique_ptr<Transport::Input>, open_content, (), (override));
+ MOCK_METHOD(void, open_content_async, (
+ std::shared_ptr<TaskRunner>,
+ std::function<void(std::unique_ptr<Transport::Input>)>),
+ (override));
+ MOCK_METHOD(void, add_header, (std::string, std::string), (override));
+};
+
+#endif // MOCK_TRANSPORT_HH