AlexaClientSDK  3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
Classes | Namespaces | Macros | Functions | Variables
MIMEParserTest.cpp File Reference
#include <string>
#include <cstring>
#include <future>
#include <vector>
#include <unordered_set>
#include <random>
#include <algorithm>
#include <gmock/gmock.h>
#include "AVSCommon/Utils/Common/Common.h"
#include "AVSCommon/Utils/HTTP/HttpResponseCode.h"
#include "AVSCommon/Utils/HTTP2/HTTP2MimeRequestEncoder.h"
#include "AVSCommon/Utils/HTTP2/HTTP2MimeResponseDecoder.h"
#include "AVSCommon/Utils/HTTP2/MockHTTP2MimeRequestEncodeSource.h"
#include "AVSCommon/Utils/HTTP2/MockHTTP2MimeResponseDecodeSink.h"
#include "AVSCommon/Utils/Logger/LoggerUtils.h"
Include dependency graph for MIMEParserTest.cpp:

Classes

class  alexaClientSDK::avsCommon::test::MIMEParserTest
 

Namespaces

 alexaClientSDK
 Whether or not curl logs should be emitted.
 
 alexaClientSDK::avsCommon
 
 alexaClientSDK::avsCommon::test
 

Macros

#define BUILD_HEADER(number)   key##number + SEPARATOR + value##number
 headers More...
 

Functions

 alexaClientSDK::avsCommon::test::TEST_F (MIMEParserTest, test_encodingSanity)
 
void alexaClientSDK::avsCommon::test::runDecodingBoundariesTest (const std::vector< std::pair< std::string, size_t >> &partsToIndex, const std::vector< std::multimap< std::string, std::string >> &testCaseExpectedHeaders, const std::vector< std::string > &testCaseExpectedData, const std::vector< std::string > &headers, HTTP2ReceiveDataStatus expectedStatus=HTTP2ReceiveDataStatus::SUCCESS)
 
void alexaClientSDK::avsCommon::test::generatePayloadAndTest (const std::vector< std::string > &headers, const std::string &payloadBoundary)
 
void alexaClientSDK::avsCommon::test::generatePayloadAndTest (const std::string &headerBoundary, const std::string &payloadBoundary)
 
void alexaClientSDK::avsCommon::test::runTestForCombination (std::vector< int > &partition, const std::string &payload, const std::string &boundary)
 
void alexaClientSDK::avsCommon::test::generateCombinationsAndRunTest (std::vector< int > &partitions, size_t pos, int remaining, const std::string &words, const std::string &boundary)
 
 alexaClientSDK::avsCommon::test::TEST_F (MIMEParserTest, test_multipleCombinations)
 
 alexaClientSDK::avsCommon::test::TEST_F (MIMEParserTest, test_fixedSizeGroups)
 
 alexaClientSDK::avsCommon::test::TEST_F (MIMEParserTest, test_decodingBoundariesSendBoundaryWithoutCRLF)
 
 alexaClientSDK::avsCommon::test::TEST_F (MIMEParserTest, test_decodingBoundariesSendBoundaryWithTerminatorShouldIgnoreEpilogue)
 
 alexaClientSDK::avsCommon::test::TEST_F (MIMEParserTest, test_decodingBoundariesSendDuplicatedBoundaryAsHeader)
 
 alexaClientSDK::avsCommon::test::TEST_F (MIMEParserTest, test_decodingRandomBoundaries)
 
 alexaClientSDK::avsCommon::test::TEST_F (MIMEParserTest, test_decodingBoundariesWithQuotesAndMoreHeaders)
 
 alexaClientSDK::avsCommon::test::TEST_F (MIMEParserTest, test_decodingInvalidBoundaries)
 
 alexaClientSDK::avsCommon::test::TEST_F (MIMEParserTest, test_decodingBoundaryAfteraNonBoundaryHeader)
 
 alexaClientSDK::avsCommon::test::TEST_F (MIMEParserTest, test_decodingValidBoundariesWithMoreHeaders)
 
 alexaClientSDK::avsCommon::test::TEST_F (MIMEParserTest, test_decodingBoundaryTerminatedWithCRLF)
 
 alexaClientSDK::avsCommon::test::TEST_F (MIMEParserTest, test_decodingBoundariesAvs)
 
 alexaClientSDK::avsCommon::test::TEST_F (MIMEParserTest, test_decodingBoundariesSendFakeBoundaryAsData)
 
 alexaClientSDK::avsCommon::test::TEST_F (MIMEParserTest, test_decodingBoundariesSendFakeBoundaryAsOnlyData)
 
 alexaClientSDK::avsCommon::test::TEST_F (MIMEParserTest, test_decodingBoundariesSendBoundaryWithCRLF)
 
 alexaClientSDK::avsCommon::test::TEST_F (MIMEParserTest, test_decodingBoundariesSendEndBoundaryWithoutCRLF)
 
 alexaClientSDK::avsCommon::test::TEST_F (MIMEParserTest, test_decodingBoundariesSendBoundaryWithData)
 
 alexaClientSDK::avsCommon::test::TEST_F (MIMEParserTest, test_decodingSanity)
 
void alexaClientSDK::avsCommon::test::runCodecTest (std::shared_ptr< MockHTTP2MimeRequestEncodeSource > source, std::shared_ptr< MockHTTP2MimeResponseDecodeSink > sink, const int bufferSize)
 
 alexaClientSDK::avsCommon::test::TEST_F (MIMEParserTest, test_singlePayloadSinglePass)
 
 alexaClientSDK::avsCommon::test::TEST_F (MIMEParserTest, test_singlePayloadMultiplePasses)
 
 alexaClientSDK::avsCommon::test::TEST_F (MIMEParserTest, test_multiplePayloadsSinglePass)
 
 alexaClientSDK::avsCommon::test::TEST_F (MIMEParserTest, test_multiplePayloadsMultiplePasses)
 
 alexaClientSDK::avsCommon::test::TEST_F (MIMEParserTest, test_duplicateBoundaries)
 
 alexaClientSDK::avsCommon::test::TEST_F (MIMEParserTest, test_aBORT)
 
 alexaClientSDK::avsCommon::test::TEST_F (MIMEParserTest, test_pAUSE)
 
 alexaClientSDK::avsCommon::test::TEST_F (MIMEParserTest, test_variableChunkSizes)
 
static void alexaClientSDK::avsCommon::test::testPrefixCase (const std::string &readablePrefix, const std::string &prefix, size_t firstChunkSize, int numberChunks, bool expectSuccess)
 
 alexaClientSDK::avsCommon::test::TEST_F (MIMEParserTest, test_prefixCases)
 

Variables

static const std::string alexaClientSDK::avsCommon::test::SEPARATOR = ": "
 Separator for keys and values in mime part headers. More...
 
static const int alexaClientSDK::avsCommon::test::SMALL {100}
 Guideline sizes for test payloads and headers. More...
 
static const int alexaClientSDK::avsCommon::test::MEDIUM {200}
 
static const int alexaClientSDK::avsCommon::test::LARGE {500}
 
static const int alexaClientSDK::avsCommon::test::XLARGE {5000}
 
static const int alexaClientSDK::avsCommon::test::HEADER_PART_SIZE {10}
 
static const std::string alexaClientSDK::avsCommon::test::BOUNDARY_HEADER_PREFIX = "content-type:mixed/multipart;boundary="
 
static const std::string alexaClientSDK::avsCommon::test::MIME_TEST_BOUNDARY_STRING = "84109348-943b-4446-85e6-e73eda9fac43"
 A test boundary string, copied from a real interaction with AVS. More...
 
static const std::string alexaClientSDK::avsCommon::test::MIME_NEWLINE = "\r\n"
 The newline characters that MIME parsers expect. More...
 
static const std::string alexaClientSDK::avsCommon::test::MIME_BOUNDARY_DASHES = "--"
 The double dashes which may occur before and after a boundary string. More...
 
static const std::string alexaClientSDK::avsCommon::test::BOUNDARY = MIME_BOUNDARY_DASHES + MIME_TEST_BOUNDARY_STRING
 The test boundary string with the preceding dashes. More...
 
static const std::string alexaClientSDK::avsCommon::test::BOUNDARY_LINE = MIME_NEWLINE + BOUNDARY
 A complete boundary, including the CRLF prefix. More...
 
static const std::string alexaClientSDK::avsCommon::test::HEADER_LINE = "Content-Type: application/json"
 Header line without prefix or suffix CRLF. More...
 
static const std::string alexaClientSDK::avsCommon::test::TEST_MESSAGE
 JSON payload. More...
 
static const std::string alexaClientSDK::avsCommon::test::QUOTE_CHAR = "\""
 The " char. More...
 
static const std::string alexaClientSDK::avsCommon::test::NORMAL_LINES = HEADER_LINE + MIME_NEWLINE + MIME_NEWLINE + TEST_MESSAGE + BOUNDARY_LINE
 
static const std::string alexaClientSDK::avsCommon::test::DUPLICATE_BOUNDARY_LINES = BOUNDARY + MIME_NEWLINE + NORMAL_LINES
 
static const std::string alexaClientSDK::avsCommon::test::CRLF_DUPLICATE_BOUNDARY_LINES = BOUNDARY_LINE + MIME_NEWLINE + NORMAL_LINES
 
static const std::string alexaClientSDK::avsCommon::test::TRIPLICATE_BOUNDARY_LINES = BOUNDARY + MIME_NEWLINE + BOUNDARY + MIME_NEWLINE + NORMAL_LINES
 
static const std::string alexaClientSDK::avsCommon::test::CRLF_TRIPLICATE_BOUNDARY_LINES
 

Macro Definition Documentation

◆ BUILD_HEADER

#define BUILD_HEADER (   number)    key##number + SEPARATOR + value##number

headers

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