#include <MockHTTP2Connection.h>
◆ MockHTTP2Connection()
alexaClientSDK::avsCommon::utils::http2::test::MockHTTP2Connection::MockHTTP2Connection |
( |
std::string |
dURL, |
|
|
std::string |
pingURL, |
|
|
bool |
delegateToReal = true |
|
) |
| |
Constructor
- Parameters
-
dURL | The URL for downchannel requests. |
pingURL | The URL for ping requests. |
delegateToReal | Whether the mock should delegate to real methods when possible. If false, all methods will need expectations set. |
◆ ~MockHTTP2Connection()
alexaClientSDK::avsCommon::utils::http2::test::MockHTTP2Connection::~MockHTTP2Connection |
( |
| ) |
|
|
default |
◆ addObserver()
◆ createAndSendRequestConcrete()
A concrete implementation that performs a createAndSendRequest call.
- Parameters
-
- Returns
- The request that was created with the provided config.
◆ dequePingRequest()
std::shared_ptr< MockHTTP2Request > alexaClientSDK::avsCommon::utils::http2::test::MockHTTP2Connection::dequePingRequest |
( |
| ) |
|
◆ dequePostRequest() [1/2]
std::shared_ptr< MockHTTP2Request > alexaClientSDK::avsCommon::utils::http2::test::MockHTTP2Connection::dequePostRequest |
( |
const std::chrono::milliseconds |
timeout | ) |
|
◆ dequePostRequest() [2/2]
std::shared_ptr< MockHTTP2Request > alexaClientSDK::avsCommon::utils::http2::test::MockHTTP2Connection::dequePostRequest |
( |
| ) |
|
◆ dequeRequest()
std::shared_ptr< MockHTTP2Request > alexaClientSDK::avsCommon::utils::http2::test::MockHTTP2Connection::dequeRequest |
( |
| ) |
|
Pop the latest HTTP2 Request from queue.
- Returns
- The oldest HTTP2 Request in the queue.
◆ getDownchannelRequest()
std::shared_ptr< MockHTTP2Request > alexaClientSDK::avsCommon::utils::http2::test::MockHTTP2Connection::getDownchannelRequest |
( |
std::chrono::milliseconds |
timeout = std::chrono::milliseconds(0) | ) |
|
Retrieve the first HTTP2 request made on the downchannel.
- Returns
- The first downchannel request or nullptr if none found
◆ getDownchannelRequestsNum()
std::size_t alexaClientSDK::avsCommon::utils::http2::test::MockHTTP2Connection::getDownchannelRequestsNum |
( |
| ) |
|
◆ getMaxPostRequestsEnqueud()
std::size_t alexaClientSDK::avsCommon::utils::http2::test::MockHTTP2Connection::getMaxPostRequestsEnqueud |
( |
| ) |
|
◆ getPostRequestsNum()
std::size_t alexaClientSDK::avsCommon::utils::http2::test::MockHTTP2Connection::getPostRequestsNum |
( |
| ) |
|
◆ getRequestsNum()
std::size_t alexaClientSDK::avsCommon::utils::http2::test::MockHTTP2Connection::getRequestsNum |
( |
| ) |
|
◆ isPauseOnSendReceived()
bool alexaClientSDK::avsCommon::utils::http2::test::MockHTTP2Connection::isPauseOnSendReceived |
( |
std::chrono::milliseconds |
timeout = std::chrono::milliseconds(0) | ) |
|
Check if a pause is received while sending data.
- Returns
- True if a pause is received, false otherwise
◆ isRequestQueueEmpty()
bool alexaClientSDK::avsCommon::utils::http2::test::MockHTTP2Connection::isRequestQueueEmpty |
( |
| ) |
|
Check whether there are any HTTP requests sent.
- Returns
- True if there are no HTTP requests sent by
HTTP2Transport
.
◆ MOCK_METHOD0()
alexaClientSDK::avsCommon::utils::http2::test::MockHTTP2Connection::MOCK_METHOD0 |
( |
disconnect |
, |
|
|
void() |
|
|
) |
| |
◆ MOCK_METHOD1()
◆ removeObserver()
◆ respondToDownchannelRequests()
bool alexaClientSDK::avsCommon::utils::http2::test::MockHTTP2Connection::respondToDownchannelRequests |
( |
long |
responseCode, |
|
|
bool |
sendResponseFinished, |
|
|
const std::chrono::milliseconds |
timeout |
|
) |
| |
Respond to downchannel requests with a response code and notify onResponseFinished() if needed.
- Parameters
-
responseCode | The HTTP response code to reply. |
sendResponseFinished | True if needed to notify onResponseFinished(), otherwise false. |
timeout | Timeout for wating for downchannel HTTP2 requests. |
- Returns
- True if a response has been sent to the downchannel request before timeout, otherwise false.
◆ setResponseToPOSTRequests()
void alexaClientSDK::avsCommon::utils::http2::test::MockHTTP2Connection::setResponseToPOSTRequests |
( |
http::HTTPResponseCode |
responseCode | ) |
|
Set the response code for POST requests that will be immediately replied when an HTTP POST request is sent.
- Parameters
-
responseCode | The HTTP response code to reply to the request. If set to HTTPResponseCode::HTTP_RESPONSE_CODE_UNDEFINED , a response code will not be sent. |
◆ setWaitRequestHeader()
void alexaClientSDK::avsCommon::utils::http2::test::MockHTTP2Connection::setWaitRequestHeader |
( |
const std::string & |
matchString | ) |
|
Set the Header content to be matched by waitForRequestWithHeader
.
- Parameters
-
matchString | The contents of the header to match. |
◆ waitForPingRequest()
std::shared_ptr< MockHTTP2Request > alexaClientSDK::avsCommon::utils::http2::test::MockHTTP2Connection::waitForPingRequest |
( |
const std::chrono::milliseconds |
timeout | ) |
|
Wait for a Ping HTTP2request.
- Parameters
-
timeout | The wait timeout in milliseconds. |
- Returns
- A pointer to the Ping request if there is one before the timeout occurs, otherwise nullptr
◆ waitForPostRequest()
std::shared_ptr< MockHTTP2Request > alexaClientSDK::avsCommon::utils::http2::test::MockHTTP2Connection::waitForPostRequest |
( |
const std::chrono::milliseconds |
timeout | ) |
|
Wait for a POST HTTP2request.
- Parameters
-
timeout | The wait timeout in milliseconds. |
- Returns
- A pointer to the POST request if there is one before the timeout occurs, otherwise nullptr
◆ waitForRequest()
std::shared_ptr< MockHTTP2Request > alexaClientSDK::avsCommon::utils::http2::test::MockHTTP2Connection::waitForRequest |
( |
std::chrono::milliseconds |
timeout, |
|
|
unsigned |
requestNum = 1 |
|
) |
| |
Wait for an HTTP request to be sent.
- Parameters
-
timeout | Wait timeout in milliseconds. |
requestNum | The number of HTTP2 requests to wait for. |
- Returns
- A pointer to the request if there is one before the timeout occurs, otherwise nullptr
◆ waitForRequestWithHeader()
bool alexaClientSDK::avsCommon::utils::http2::test::MockHTTP2Connection::waitForRequestWithHeader |
( |
std::chrono::milliseconds |
timeout | ) |
|
Wait for a request with a particular Header content.
- Parameters
-
timeout | The wait timeout in milliseconds |
matchString | The contents of the header that it is waiting for |
- Returns
- True if a match occurred before timeout
The documentation for this class was generated from the following files:
AlexaClientSDK 3.0.0 - Copyright 2016-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
Licensed under the Apache License, Version 2.0