15 #ifndef ALEXA_CLIENT_SDK_ACL_TEST_TRANSPORT_MOCKHTTP2CONNECTION_H_ 16 #define ALEXA_CLIENT_SDK_ACL_TEST_TRANSPORT_MOCKHTTP2CONNECTION_H_ 19 #include <condition_variable> 25 #include <unordered_set> 63 void addObserver(std::shared_ptr<avsCommon::utils::http2::HTTP2ConnectionObserverInterface> observer);
64 void removeObserver(std::shared_ptr<avsCommon::utils::http2::HTTP2ConnectionObserverInterface> observer);
89 std::shared_ptr<MockHTTP2Request>
waitForRequest(std::chrono::milliseconds timeout,
unsigned requestNum = 1);
120 std::shared_ptr<MockHTTP2Request>
waitForPostRequest(
const std::chrono::milliseconds timeout);
128 std::shared_ptr<MockHTTP2Request>
waitForPingRequest(
const std::chrono::milliseconds timeout);
140 bool sendResponseFinished,
141 const std::chrono::milliseconds timeout);
157 std::chrono::milliseconds timeout = std::chrono::milliseconds(0));
193 std::shared_ptr<MockHTTP2Request>
dequePostRequest(
const std::chrono::milliseconds timeout);
218 std::deque<std::shared_ptr<MockHTTP2Request>> m_requestQueue;
221 std::mutex m_requestMutex;
224 std::condition_variable m_requestCv;
233 std::deque<std::shared_ptr<MockHTTP2Request>> m_downchannelRequestQueue;
236 std::mutex m_downchannelRequestMutex;
239 std::condition_variable m_downchannelRequestCv;
242 std::deque<std::shared_ptr<MockHTTP2Request>> m_postRequestQueue;
245 std::mutex m_postRequestMutex;
248 std::condition_variable m_requestPostCv;
251 std::deque<std::shared_ptr<MockHTTP2Request>> m_pingRequestQueue;
254 std::mutex m_observersMutex;
257 std::unordered_set<std::shared_ptr<avsCommon::utils::http2::HTTP2ConnectionObserverInterface>> m_observers;
260 std::mutex m_pingRequestMutex;
263 std::condition_variable m_pingRequestCv;
269 std::condition_variable m_requestHeaderCv;
278 std::size_t m_maxPostRequestsEnqueued;
282 static const unsigned READ_DATA_BUF_SIZE = 100;
291 #endif // ALEXA_CLIENT_SDK_ACL_TEST_TRANSPORT_MOCKHTTP2CONNECTION_H_ std::size_t getRequestsNum()
Definition: MockHTTP2Connection.cpp:215
std::shared_ptr< HTTP2RequestInterface > createAndSendRequestConcrete(const HTTP2RequestConfig &config)
Definition: MockHTTP2Connection.cpp:38
bool respondToDownchannelRequests(long responseCode, bool sendResponseFinished, const std::chrono::milliseconds timeout)
Definition: MockHTTP2Connection.cpp:177
HTTPResponseCode
Definition: HttpResponseCode.h:29
Definition: HTTP2RequestConfig.h:42
Definition: HTTP2ConnectionInterface.h:34
Definition: AmdMetricWrapperTest.cpp:24
::std::string string
Definition: gtest-port.h:1097
void removeObserver(std::shared_ptr< avsCommon::utils::http2::HTTP2ConnectionObserverInterface > observer)
Definition: MockHTTP2Connection.cpp:264
std::shared_ptr< MockHTTP2Request > waitForPingRequest(const std::chrono::milliseconds timeout)
Definition: MockHTTP2Connection.cpp:168
std::shared_ptr< MockHTTP2Request > dequePostRequest()
Definition: MockHTTP2Connection.cpp:223
bool waitForRequestWithHeader(std::chrono::milliseconds timeout)
Definition: MockHTTP2Connection.cpp:112
void setWaitRequestHeader(const std::string &matchString)
Definition: MockHTTP2Connection.cpp:107
void addObserver(std::shared_ptr< avsCommon::utils::http2::HTTP2ConnectionObserverInterface > observer)
Definition: MockHTTP2Connection.cpp:260
virtual std::shared_ptr< HTTP2RequestInterface > createAndSendRequest(const HTTP2RequestConfig &config)=0
std::shared_ptr< MockHTTP2Request > dequePingRequest()
Definition: MockHTTP2Connection.cpp:246
std::size_t getDownchannelRequestsNum()
Definition: MockHTTP2Connection.cpp:219
MOCK_METHOD0(disconnect, void())
std::shared_ptr< MockHTTP2Request > getDownchannelRequest(std::chrono::milliseconds timeout=std::chrono::milliseconds(0))
Definition: MockHTTP2Connection.cpp:198
virtual void disconnect()=0
std::size_t getMaxPostRequestsEnqueud()
Definition: MockHTTP2Connection.cpp:256
Whether or not curl logs should be emitted.
Definition: AVSConnectionManager.h:36
Definition: MockHTTP2Connection.h:46
std::shared_ptr< MockHTTP2Request > waitForPostRequest(const std::chrono::milliseconds timeout)
Definition: MockHTTP2Connection.cpp:121
std::shared_ptr< MockHTTP2Request > dequeRequest()
Definition: MockHTTP2Connection.cpp:100
Definition: PromiseFuturePair.h:75
bool isPauseOnSendReceived(std::chrono::milliseconds timeout=std::chrono::milliseconds(0))
Definition: MockHTTP2Connection.cpp:207
bool isRequestQueueEmpty()
Definition: MockHTTP2Connection.cpp:83
void setResponseToPOSTRequests(http::HTTPResponseCode responseCode)
Definition: MockHTTP2Connection.cpp:193
MOCK_METHOD1(createAndSendRequest, std::shared_ptr< HTTP2RequestInterface >(const HTTP2RequestConfig &config))
std::shared_ptr< MockHTTP2Request > waitForRequest(std::chrono::milliseconds timeout, unsigned requestNum=1)
Definition: MockHTTP2Connection.cpp:88
~MockHTTP2Connection()=default
std::size_t getPostRequestsNum()
Definition: MockHTTP2Connection.cpp:211
MockHTTP2Connection(std::string dURL, std::string pingURL, bool delegateToReal=true)
Definition: MockHTTP2Connection.cpp:27