|
- #pragma once
-
- #include <microhttpd.h>
-
- #include <gmock/gmock.h>
-
- struct libmicrohttpd_mock
- {
- public:
- MOCK_METHOD6(
- MHD_get_fdset2,
- int (struct MHD_Daemon *daemon,
- fd_set * read_fdset,
- fd_set * write_fdset,
- fd_set * except_fdset,
- int * max_fd,
- unsigned int fdsetsize));
-
- MOCK_METHOD2(
- MHD_get_timeout,
- int (struct MHD_Daemon * daemon,
- MHD_UNSIGNED_LONG_LONG * timeout));
-
- MOCK_METHOD4(
- MHD_run_from_select,
- int (struct MHD_Daemon * daemon,
- const fd_set * read_fdset,
- const fd_set * write_fdset,
- const fd_set * except_fdset));
-
- MOCK_METHOD6(
- MHD_start_daemon,
- struct MHD_Daemon * (unsigned int flags,
- uint16_t port,
- MHD_AcceptPolicyCallback apc,
- void * apc_cls,
- MHD_AccessHandlerCallback dh,
- void * dh_cls));
-
- MOCK_METHOD1(
- MHD_stop_daemon,
- void (struct MHD_Daemon * daemon));
-
- MOCK_METHOD3(
- MHD_queue_response,
- int (struct MHD_Connection * connection,
- unsigned int status_code,
- struct MHD_Response * response));
-
- MOCK_METHOD3(
- MHD_add_response_header,
- int (struct MHD_Response * response,
- const char * header,
- const char * content));
-
- MOCK_METHOD3(
- MHD_create_response_from_buffer,
- struct MHD_Response * (size_t size,
- const char * buffer,
- enum MHD_ResponseMemoryMode mode));
-
- MOCK_METHOD5(
- MHD_create_response_from_callback,
- struct MHD_Response * (uint64_t size,
- size_t block_size,
- MHD_ContentReaderCallback crc,
- void * crc_cls,
- MHD_ContentReaderFreeCallback crfc));
-
- MOCK_METHOD4(
- MHD_get_connection_values,
- int (struct MHD_Connection * connection,
- enum MHD_ValueKind kind,
- MHD_KeyValueIterator iterator,
- void * iterator_cls));
-
- MOCK_METHOD1(
- MHD_destroy_response,
- void (struct MHD_Response * response));
-
- MOCK_METHOD4(
- MHD_create_post_processor,
- struct MHD_PostProcessor * (struct MHD_Connection * connection,
- size_t buffer_size,
- MHD_PostDataIterator iter,
- void * iter_cls));
-
- MOCK_METHOD1(
- MHD_destroy_post_processor,
- int (struct MHD_PostProcessor * pp));
-
- MOCK_METHOD3(
- MHD_post_process,
- int (struct MHD_PostProcessor * pp,
- const char * post_data,
- size_t post_data_len));
-
- public:
- inline libmicrohttpd_mock()
- {
- instance = this;
- }
-
- inline ~libmicrohttpd_mock()
- {
- if (instance == this)
- instance = nullptr;
- }
-
- public:
- static libmicrohttpd_mock * instance;
- };
|