#include "quiche/http2/core/spdy_framer.h"
#include <stdlib.h>
#include <algorithm>
#include <cstdint>
#include <cstring>
#include <ios>
#include <limits>
#include <memory>
#include <string>
#include <utility>
#include <vector>
#include "absl/base/macros.h"
#include "absl/strings/string_view.h"
#include "quiche/http2/core/array_output_buffer.h"
#include "quiche/http2/core/http2_frame_decoder_adapter.h"
#include "quiche/http2/core/recording_headers_handler.h"
#include "quiche/http2/core/spdy_alt_svc_wire_format.h"
#include "quiche/http2/core/spdy_bitmasks.h"
#include "quiche/http2/core/spdy_frame_builder.h"
#include "quiche/http2/core/spdy_headers_handler_interface.h"
#include "quiche/http2/core/spdy_protocol.h"
#include "quiche/http2/hpack/hpack_encoder.h"
#include "quiche/http2/test_tools/mock_spdy_framer_visitor.h"
#include "quiche/http2/test_tools/spdy_test_utils.h"
#include "quiche/common/platform/api/quiche_logging.h"
#include "quiche/common/platform/api/quiche_test.h"
#include "quiche/common/quiche_text_utils.h"
#include "quiche/spdy/core/http2_header_block.h"
Http2DecoderAdapter;
_;
namespace spdy {
namespace test {
namespace {
const int64_t kSize = …;
char output_buffer[kSize] = …;
const int64_t buffer_size = …;
char frame_list_char[buffer_size] = …;
}
class MockDebugVisitor : public SpdyFramerDebugVisitorInterface { … };
MATCHER_P(IsFrameUnionOf, frame_list, "") { … }
class SpdyFramerPeer { … };
class TestSpdyVisitor : public SpdyFramerVisitorInterface,
public SpdyFramerDebugVisitorInterface { … };
class TestExtension : public ExtensionVisitorInterface { … };
class TestSpdyUnknownIR : public SpdyUnknownIR { … };
enum Output { … };
class SpdyFramerTest : public quiche::test::QuicheTestWithParam<Output> { … };
INSTANTIATE_TEST_SUITE_P(…);
TEST_P(SpdyFramerTest, HeaderBlockInBuffer) { … }
TEST_P(SpdyFramerTest, UndersizedHeaderBlockInBuffer) { … }
TEST_P(SpdyFramerTest, HeaderStreamDependencyValues) { … }
TEST_P(SpdyFramerTest, AcceptMaxFrameSizeSetting) { … }
TEST_P(SpdyFramerTest, ExceedMaxFrameSizeSetting) { … }
TEST_P(SpdyFramerTest, AcceptLargerMaxFrameSizeSetting) { … }
TEST_P(SpdyFramerTest, OversizedDataPaddingError) { … }
TEST_P(SpdyFramerTest, CorrectlySizedDataPaddingNoError) { … }
TEST_P(SpdyFramerTest, OversizedHeadersPaddingError) { … }
TEST_P(SpdyFramerTest, CorrectlySizedHeadersPaddingNoError) { … }
TEST_P(SpdyFramerTest, DataWithStreamIdZero) { … }
TEST_P(SpdyFramerTest, HeadersWithStreamIdZero) { … }
TEST_P(SpdyFramerTest, PriorityWithStreamIdZero) { … }
TEST_P(SpdyFramerTest, RstStreamWithStreamIdZero) { … }
TEST_P(SpdyFramerTest, SettingsWithStreamIdNotZero) { … }
TEST_P(SpdyFramerTest, GoawayWithStreamIdNotZero) { … }
TEST_P(SpdyFramerTest, ContinuationWithStreamIdZero) { … }
TEST_P(SpdyFramerTest, PushPromiseWithStreamIdZero) { … }
TEST_P(SpdyFramerTest, PushPromiseWithPromisedStreamIdZero) { … }
TEST_P(SpdyFramerTest, MultiValueHeader) { … }
TEST_P(SpdyFramerTest, CompressEmptyHeaders) { … }
TEST_P(SpdyFramerTest, Basic) { … }
TEST_P(SpdyFramerTest, BasicWithError) { … }
TEST_P(SpdyFramerTest, FinOnDataFrame) { … }
TEST_P(SpdyFramerTest, FinOnHeadersFrame) { … }
TEST_P(SpdyFramerTest, UnclosedStreamDataCompressorsOneByteAtATime) { … }
TEST_P(SpdyFramerTest, WindowUpdateFrame) { … }
TEST_P(SpdyFramerTest, CreateDataFrame) { … }
TEST_P(SpdyFramerTest, CreateRstStream) { … }
TEST_P(SpdyFramerTest, CreateSettings) { … }
TEST_P(SpdyFramerTest, CreatePingFrame) { … }
TEST_P(SpdyFramerTest, CreateGoAway) { … }
TEST_P(SpdyFramerTest, CreateHeadersUncompressed) { … }
TEST_P(SpdyFramerTest, CreateWindowUpdate) { … }
TEST_P(SpdyFramerTest, CreatePushPromiseUncompressed) { … }
TEST_P(SpdyFramerTest, GetNumberRequiredContinuationFrames) { … }
TEST_P(SpdyFramerTest, CreateContinuationUncompressed) { … }
TEST_P(SpdyFramerTest, SendUnexpectedContinuation) { … }
TEST_P(SpdyFramerTest, CreatePushPromiseThenContinuationUncompressed) { … }
TEST_P(SpdyFramerTest, CreateAltSvc) { … }
TEST_P(SpdyFramerTest, CreatePriority) { … }
TEST_P(SpdyFramerTest, CreatePriorityUpdate) { … }
TEST_P(SpdyFramerTest, CreateAcceptCh) { … }
TEST_P(SpdyFramerTest, CreateUnknown) { … }
TEST_P(SpdyFramerTest, CreateUnknownUnchecked) { … }
TEST_P(SpdyFramerTest, ReadCompressedHeadersHeaderBlock) { … }
TEST_P(SpdyFramerTest, ReadCompressedHeadersHeaderBlockWithHalfClose) { … }
TEST_P(SpdyFramerTest, TooLargeHeadersFrameUsesContinuation) { … }
TEST_P(SpdyFramerTest, MultipleContinuationFramesWithIterator) { … }
TEST_P(SpdyFramerTest, PushPromiseFramesWithIterator) { … }
class SpdyControlFrameIteratorTest : public quiche::test::QuicheTest { … };
TEST_F(SpdyControlFrameIteratorTest, RstStreamFrameWithIterator) { … }
TEST_F(SpdyControlFrameIteratorTest, SettingsFrameWithIterator) { … }
TEST_F(SpdyControlFrameIteratorTest, PingFrameWithIterator) { … }
TEST_F(SpdyControlFrameIteratorTest, GoAwayFrameWithIterator) { … }
TEST_F(SpdyControlFrameIteratorTest, WindowUpdateFrameWithIterator) { … }
TEST_F(SpdyControlFrameIteratorTest, AtlSvcFrameWithIterator) { … }
TEST_F(SpdyControlFrameIteratorTest, PriorityFrameWithIterator) { … }
TEST_P(SpdyFramerTest, TooLargePushPromiseFrameUsesContinuation) { … }
TEST_P(SpdyFramerTest, ControlFrameMuchTooLarge) { … }
TEST_P(SpdyFramerTest, ControlFrameSizesAreValidated) { … }
TEST_P(SpdyFramerTest, ReadZeroLenSettingsFrame) { … }
TEST_P(SpdyFramerTest, ReadBogusLenSettingsFrame) { … }
TEST_P(SpdyFramerTest, ReadLargeSettingsFrame) { … }
TEST_P(SpdyFramerTest, ReadDuplicateSettings) { … }
TEST_P(SpdyFramerTest, ReadUnknownSettingsId) { … }
TEST_P(SpdyFramerTest, ReadKnownAndUnknownSettingsWithExtension) { … }
TEST_P(SpdyFramerTest, ReadOutOfOrderSettings) { … }
TEST_P(SpdyFramerTest, ProcessSettingsAckFrame) { … }
TEST_P(SpdyFramerTest, ProcessDataFrameWithPadding) { … }
TEST_P(SpdyFramerTest, ReadWindowUpdate) { … }
TEST_P(SpdyFramerTest, ReadCompressedPushPromise) { … }
TEST_P(SpdyFramerTest, ReadHeadersWithContinuation) { … }
TEST_P(SpdyFramerTest, ReadHeadersWithContinuationAndFin) { … }
TEST_P(SpdyFramerTest, ReadPushPromiseWithContinuation) { … }
TEST_P(SpdyFramerTest, ReceiveUnknownMidContinuation) { … }
TEST_P(SpdyFramerTest, ReceiveUnknownMidContinuationWithExtension) { … }
TEST_P(SpdyFramerTest, ReceiveContinuationOnWrongStream) { … }
TEST_P(SpdyFramerTest, ReadContinuationOutOfOrder) { … }
TEST_P(SpdyFramerTest, ExpectContinuationReceiveData) { … }
TEST_P(SpdyFramerTest, ExpectContinuationReceiveControlFrame) { … }
TEST_P(SpdyFramerTest, ReadGarbage) { … }
TEST_P(SpdyFramerTest, ReadUnknownExtensionFrame) { … }
TEST_P(SpdyFramerTest, ReadUnknownExtensionFrameWithExtension) { … }
TEST_P(SpdyFramerTest, ReadGarbageWithValidLength) { … }
TEST_P(SpdyFramerTest, ReadGarbageHPACKEncoding) { … }
TEST_P(SpdyFramerTest, SizesTest) { … }
TEST_P(SpdyFramerTest, StateToStringTest) { … }
TEST_P(SpdyFramerTest, SpdyFramerErrorToStringTest) { … }
TEST_P(SpdyFramerTest, DataFrameFlagsV4) { … }
TEST_P(SpdyFramerTest, RstStreamFrameFlags) { … }
TEST_P(SpdyFramerTest, SettingsFrameFlags) { … }
TEST_P(SpdyFramerTest, GoawayFrameFlags) { … }
TEST_P(SpdyFramerTest, HeadersFrameFlags) { … }
TEST_P(SpdyFramerTest, PingFrameFlags) { … }
TEST_P(SpdyFramerTest, WindowUpdateFrameFlags) { … }
TEST_P(SpdyFramerTest, PushPromiseFrameFlags) { … }
TEST_P(SpdyFramerTest, ContinuationFrameFlags) { … }
TEST_P(SpdyFramerTest, RstStreamStatusBounds) { … }
TEST_P(SpdyFramerTest, GoAwayStatusBounds) { … }
TEST_P(SpdyFramerTest, GoAwayStreamIdBounds) { … }
TEST_P(SpdyFramerTest, OnAltSvcWithOrigin) { … }
TEST_P(SpdyFramerTest, OnAltSvcNoOrigin) { … }
TEST_P(SpdyFramerTest, OnAltSvcEmptyProtocolId) { … }
TEST_P(SpdyFramerTest, OnAltSvcBadLengths) { … }
TEST_P(SpdyFramerTest, ReadChunkedAltSvcFrame) { … }
TEST_P(SpdyFramerTest, ReadAltSvcFrame) { … }
TEST_P(SpdyFramerTest, ErrorOnAltSvcFrameWithInvalidValue) { … }
TEST_P(SpdyFramerTest, ReadPriorityUpdateFrame) { … }
TEST_P(SpdyFramerTest, ReadPriorityUpdateFrameWithEmptyPriorityFieldValue) { … }
TEST_P(SpdyFramerTest, PriorityUpdateFrameWithEmptyPayload) { … }
TEST_P(SpdyFramerTest, PriorityUpdateFrameWithShortPayload) { … }
TEST_P(SpdyFramerTest, PriorityUpdateFrameOnIncorrectStream) { … }
TEST_P(SpdyFramerTest, PriorityUpdateFramePrioritizingIncorrectStream) { … }
TEST_P(SpdyFramerTest, ReadPriority) { … }
TEST_P(SpdyFramerTest, ReadIncorrectlySizedPriority) { … }
TEST_P(SpdyFramerTest, ReadIncorrectlySizedPing) { … }
TEST_P(SpdyFramerTest, ReadIncorrectlySizedWindowUpdate) { … }
TEST_P(SpdyFramerTest, ReadIncorrectlySizedRstStream) { … }
TEST_P(SpdyFramerTest, ReadInvalidRstStreamWithPayload) { … }
TEST_P(SpdyFramerTest, ProcessAllInput) { … }
namespace {
void CheckFrameAndIRSize(SpdyFrameIR* ir, SpdyFramer* framer,
ArrayOutputBuffer* array_output_buffer) { … }
}
TEST_P(SpdyFramerTest, SpdyFrameIRSize) { … }
}
}