AlexaClientSDK  1.26.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
MockHTTP2MimeResponseDecodeSink.h
Go to the documentation of this file.
1 /*
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License").
5  * You may not use this file except in compliance with the License.
6  * A copy of the License is located at
7  *
8  * http://aws.amazon.com/apache2.0/
9  *
10  * or in the "license" file accompanying this file. This file is distributed
11  * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12  * express or implied. See the License for the specific language governing
13  * permissions and limitations under the License.
14  */
15 
16 #ifndef ALEXA_CLIENT_SDK_AVSCOMMON_UTILS_TEST_AVSCOMMON_UTILS_HTTP2_MOCKHTTP2MIMERESPONSEDECODESINK_H_
17 #define ALEXA_CLIENT_SDK_AVSCOMMON_UTILS_TEST_AVSCOMMON_UTILS_HTTP2_MOCKHTTP2MIMERESPONSEDECODESINK_H_
18 
19 #include <string>
20 #include <vector>
21 #include <memory>
22 
25 
26 namespace alexaClientSDK {
27 namespace avsCommon {
28 namespace utils {
29 namespace http2 {
35 public:
41 
44  bool onReceiveResponseCode(long responseCode) override;
45  bool onReceiveHeaderLine(const std::string& line) override;
46  bool onBeginMimePart(const std::multimap<std::string, std::string>& headers) override;
47  avsCommon::utils::http2::HTTP2ReceiveDataStatus onReceiveMimeData(const char* bytes, size_t size) override;
48  bool onEndMimePart() override;
49  avsCommon::utils::http2::HTTP2ReceiveDataStatus onReceiveNonMimeData(const char* bytes, size_t size) override;
52 
58  bool hasSameContentAs(std::shared_ptr<MockHTTP2MimeRequestEncodeSource> source);
59 
64 
69  std::vector<std::string> m_data;
72  std::vector<std::multimap<std::string, std::string>> m_headers;
74  size_t m_index{0};
76  bool m_slowSink{false};
78  bool m_abort{false};
80  size_t m_pauseCount{0};
82  std::string m_nonMimeData;
83 };
84 
85 } // namespace http2
86 } // namespace utils
87 } // namespace avsCommon
88 } // namespace alexaClientSDK
89 #endif // ALEXA_CLIENT_SDK_AVSCOMMON_UTILS_TEST_AVSCOMMON_UTILS_HTTP2_MOCKHTTP2MIMERESPONSEDECODESINK_H_
std::string m_nonMimeData
Non mime data received.
Definition: MockHTTP2MimeResponseDecodeSink.h:82
bool hasSameContentAs(std::shared_ptr< MockHTTP2MimeRequestEncodeSource > source)
Definition: MockHTTP2MimeResponseDecodeSink.cpp:88
size_t m_index
current MIME part index
Definition: MockHTTP2MimeResponseDecodeSink.h:74
avsCommon::utils::http2::HTTP2ReceiveDataStatus onReceiveNonMimeData(const char *bytes, size_t size) override
Definition: MockHTTP2MimeResponseDecodeSink.cpp:80
bool m_slowSink
enable sending PAUSE intermittently
Definition: MockHTTP2MimeResponseDecodeSink.h:76
void onResponseFinished(avsCommon::utils::http2::HTTP2ResponseFinishedStatus status) override
Definition: MockHTTP2MimeResponseDecodeSink.cpp:85
size_t m_pauseCount
PAUSE count.
Definition: MockHTTP2MimeResponseDecodeSink.h:80
Definition: MockHTTP2MimeResponseDecodeSink.h:34
HTTP2ResponseFinishedStatus
Definition: HTTP2ResponseFinishedStatus.h:29
bool onReceiveHeaderLine(const std::string &line) override
Definition: MockHTTP2MimeResponseDecodeSink.cpp:44
bool onReceiveResponseCode(long responseCode) override
Definition: MockHTTP2MimeResponseDecodeSink.cpp:40
avsCommon::utils::http2::HTTP2ReceiveDataStatus onReceiveMimeData(const char *bytes, size_t size) override
Definition: MockHTTP2MimeResponseDecodeSink.cpp:65
Whether or not curl logs should be emitted.
Definition: AVSConnectionManager.h:36
std::vector< std::multimap< std::string, std::string > > m_headers
MIME headers received for every part.
Definition: MockHTTP2MimeResponseDecodeSink.h:72
bool onEndMimePart() override
Definition: MockHTTP2MimeResponseDecodeSink.cpp:57
MockHTTP2MimeResponseDecodeSink()
Definition: MockHTTP2MimeResponseDecodeSink.cpp:33
bool onBeginMimePart(const std::multimap< std::string, std::string > &headers) override
Definition: MockHTTP2MimeResponseDecodeSink.cpp:48
HTTP2ReceiveDataStatus
Definition: HTTP2ReceiveDataStatus.h:28
bool m_abort
If ABORT is to be sent.
Definition: MockHTTP2MimeResponseDecodeSink.h:78
std::vector< std::string > m_data
MIME data parts received.
Definition: MockHTTP2MimeResponseDecodeSink.h:70

AlexaClientSDK 1.26.0 - Copyright 2016-2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0