You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

113 rivejä
3.1 KiB

  1. #pragma once
  2. #include <microhttpd.h>
  3. #include <gmock/gmock.h>
  4. struct libmicrohttpd_mock
  5. {
  6. public:
  7. MOCK_METHOD6(
  8. MHD_get_fdset2,
  9. int (struct MHD_Daemon *daemon,
  10. fd_set * read_fdset,
  11. fd_set * write_fdset,
  12. fd_set * except_fdset,
  13. int * max_fd,
  14. unsigned int fdsetsize));
  15. MOCK_METHOD2(
  16. MHD_get_timeout,
  17. int (struct MHD_Daemon * daemon,
  18. MHD_UNSIGNED_LONG_LONG * timeout));
  19. MOCK_METHOD4(
  20. MHD_run_from_select,
  21. int (struct MHD_Daemon * daemon,
  22. const fd_set * read_fdset,
  23. const fd_set * write_fdset,
  24. const fd_set * except_fdset));
  25. MOCK_METHOD6(
  26. MHD_start_daemon,
  27. struct MHD_Daemon * (unsigned int flags,
  28. uint16_t port,
  29. MHD_AcceptPolicyCallback apc,
  30. void * apc_cls,
  31. MHD_AccessHandlerCallback dh,
  32. void * dh_cls));
  33. MOCK_METHOD1(
  34. MHD_stop_daemon,
  35. void (struct MHD_Daemon * daemon));
  36. MOCK_METHOD3(
  37. MHD_queue_response,
  38. int (struct MHD_Connection * connection,
  39. unsigned int status_code,
  40. struct MHD_Response * response));
  41. MOCK_METHOD3(
  42. MHD_add_response_header,
  43. int (struct MHD_Response * response,
  44. const char * header,
  45. const char * content));
  46. MOCK_METHOD3(
  47. MHD_create_response_from_buffer,
  48. struct MHD_Response * (size_t size,
  49. const char * buffer,
  50. enum MHD_ResponseMemoryMode mode));
  51. MOCK_METHOD5(
  52. MHD_create_response_from_callback,
  53. struct MHD_Response * (uint64_t size,
  54. size_t block_size,
  55. MHD_ContentReaderCallback crc,
  56. void * crc_cls,
  57. MHD_ContentReaderFreeCallback crfc));
  58. MOCK_METHOD4(
  59. MHD_get_connection_values,
  60. int (struct MHD_Connection * connection,
  61. enum MHD_ValueKind kind,
  62. MHD_KeyValueIterator iterator,
  63. void * iterator_cls));
  64. MOCK_METHOD1(
  65. MHD_destroy_response,
  66. void (struct MHD_Response * response));
  67. MOCK_METHOD4(
  68. MHD_create_post_processor,
  69. struct MHD_PostProcessor * (struct MHD_Connection * connection,
  70. size_t buffer_size,
  71. MHD_PostDataIterator iter,
  72. void * iter_cls));
  73. MOCK_METHOD1(
  74. MHD_destroy_post_processor,
  75. int (struct MHD_PostProcessor * pp));
  76. MOCK_METHOD3(
  77. MHD_post_process,
  78. int (struct MHD_PostProcessor * pp,
  79. const char * post_data,
  80. size_t post_data_len));
  81. public:
  82. inline libmicrohttpd_mock()
  83. {
  84. instance = this;
  85. }
  86. inline ~libmicrohttpd_mock()
  87. {
  88. if (instance == this)
  89. instance = nullptr;
  90. }
  91. public:
  92. static libmicrohttpd_mock * instance;
  93. };