| Index: net/spdy/spdy_framer_test.cc
|
| diff --git a/net/spdy/spdy_framer_test.cc b/net/spdy/spdy_framer_test.cc
|
| index 7166290325a467fc964fe85e056aaa68df20ca77..196c8bf232263ebed07540b88360bfc10958f276 100644
|
| --- a/net/spdy/spdy_framer_test.cc
|
| +++ b/net/spdy/spdy_framer_test.cc
|
| @@ -393,11 +393,7 @@ class TestSpdyVisitor : public SpdyFramerVisitorInterface,
|
| << ", " << priority << ", " << (fin ? 1 : 0) << ", "
|
| << (unidirectional ? 1 : 0) << ")";
|
| ++syn_frame_count_;
|
| - if (framer_.protocol_version() == SPDY3) {
|
| - InitHeaderStreaming(SYN_STREAM, stream_id);
|
| - } else {
|
| - InitHeaderStreaming(HEADERS, stream_id);
|
| - }
|
| + InitHeaderStreaming(HEADERS, stream_id);
|
| if (fin) {
|
| ++fin_flag_count_;
|
| }
|
| @@ -405,11 +401,7 @@ class TestSpdyVisitor : public SpdyFramerVisitorInterface,
|
|
|
| void OnSynReply(SpdyStreamId stream_id, bool fin) override {
|
| ++syn_reply_frame_count_;
|
| - if (framer_.protocol_version() == SPDY3) {
|
| - InitHeaderStreaming(SYN_REPLY, stream_id);
|
| - } else {
|
| - InitHeaderStreaming(HEADERS, stream_id);
|
| - }
|
| + InitHeaderStreaming(HEADERS, stream_id);
|
| if (fin) {
|
| ++fin_flag_count_;
|
| }
|
| @@ -661,29 +653,18 @@ class TestSpdyVisitor : public SpdyFramerVisitorInterface,
|
| StringPiece GetSerializedHeaders(const SpdySerializedFrame& frame,
|
| const SpdyFramer& framer) {
|
| SpdyFrameReader reader(frame.data(), frame.size());
|
| - if (framer.protocol_version() == SPDY3) {
|
| - reader.Seek(2); // Seek past the frame length.
|
| - } else {
|
| - reader.Seek(3); // Seek past the frame length.
|
| - }
|
| + reader.Seek(3); // Seek past the frame length.
|
| +
|
| SpdyFrameType frame_type;
|
| - if (framer.protocol_version() == SPDY3) {
|
| - uint16_t serialized_type;
|
| - reader.ReadUInt16(&serialized_type);
|
| - frame_type = SpdyConstants::ParseFrameType(framer.protocol_version(),
|
| - serialized_type);
|
| - DCHECK(frame_type == HEADERS || frame_type == SYN_STREAM) << frame_type;
|
| - } else {
|
| - uint8_t serialized_type;
|
| - reader.ReadUInt8(&serialized_type);
|
| - frame_type = SpdyConstants::ParseFrameType(framer.protocol_version(),
|
| - serialized_type);
|
| - DCHECK_EQ(HEADERS, frame_type);
|
| - uint8_t flags;
|
| - reader.ReadUInt8(&flags);
|
| - if (flags & HEADERS_FLAG_PRIORITY) {
|
| - frame_type = SYN_STREAM;
|
| - }
|
| + uint8_t serialized_type;
|
| + reader.ReadUInt8(&serialized_type);
|
| + frame_type =
|
| + SpdyConstants::ParseFrameType(framer.protocol_version(), serialized_type);
|
| + DCHECK_EQ(HEADERS, frame_type);
|
| + uint8_t flags;
|
| + reader.ReadUInt8(&flags);
|
| + if (flags & HEADERS_FLAG_PRIORITY) {
|
| + frame_type = SYN_STREAM;
|
| }
|
|
|
| if (frame_type == SYN_STREAM) {
|
| @@ -720,42 +701,14 @@ class SpdyFramerTest : public ::testing::TestWithParam<SpdyMajorVersion> {
|
| actual_frame.size());
|
| }
|
|
|
| - bool IsSpdy3() { return spdy_version_ == SPDY3; }
|
| - bool IsHttp2() { return spdy_version_ == HTTP2; }
|
| -
|
| // Version of SPDY protocol to be used.
|
| SpdyMajorVersion spdy_version_;
|
| };
|
|
|
| -// All tests are run with SPDY/3 and HTTP/2.
|
| +// All tests are run with HTTP/2, using the existing SpdyFramer.
|
| INSTANTIATE_TEST_CASE_P(SpdyFramerTests,
|
| SpdyFramerTest,
|
| - ::testing::Values(SPDY3, HTTP2));
|
| -
|
| -// Test that we ignore cookie where both name and value are empty.
|
| -TEST_P(SpdyFramerTest, HeaderBlockWithEmptyCookie) {
|
| - if (!IsSpdy3()) {
|
| - // Not implemented for hpack.
|
| - return;
|
| - }
|
| -
|
| - SpdyFramer framer(spdy_version_);
|
| - framer.set_enable_compression(true);
|
| - SpdyHeadersIR headers(1);
|
| - headers.SetHeader("cookie",
|
| - "=; key=value; ; = ; foo; bar=; ; = ; k2=v2 ; =");
|
| - SpdySerializedFrame frame(SpdyFramerPeer::SerializeHeaders(&framer, headers));
|
| -
|
| - TestSpdyVisitor visitor(spdy_version_);
|
| - visitor.use_compression_ = true;
|
| - visitor.SimulateInFramer(reinterpret_cast<unsigned char*>(frame.data()),
|
| - frame.size());
|
| -
|
| - EXPECT_EQ(0, visitor.zero_length_control_frame_header_data_count_);
|
| - EXPECT_NE(headers.header_block(), visitor.headers_);
|
| - EXPECT_EQ(1u, visitor.headers_.size());
|
| - EXPECT_EQ("key=value; foo; bar=; k2=v2 ", visitor.headers_["cookie"]);
|
| -}
|
| + ::testing::Values(HTTP2));
|
|
|
| // Test that we can encode and decode a SpdyHeaderBlock in serialized form.
|
| TEST_P(SpdyFramerTest, HeaderBlockInBuffer) {
|
| @@ -798,41 +751,9 @@ TEST_P(SpdyFramerTest, UndersizedHeaderBlockInBuffer) {
|
| EXPECT_EQ(0u, visitor.headers_.size());
|
| }
|
|
|
| -// Test that we make all header field names (keys) lower case on encoding.
|
| -TEST_P(SpdyFramerTest, HeaderBlockToLowerCase) {
|
| - // The HPACK encoding path does not lowercase field names.
|
| - if (IsHttp2()) {
|
| - return;
|
| - }
|
| -
|
| - SpdyFramer framer(spdy_version_);
|
| - framer.set_enable_compression(true);
|
| -
|
| - // Encode the header block into a Headers frame.
|
| - SpdyHeadersIR headers_ir(1);
|
| - headers_ir.SetHeader("aLpha", "beta");
|
| - headers_ir.SetHeader("GAMMA", "charlie");
|
| - headers_ir.SetHeader("foo", "Bar"); // Upper case values are okay.
|
| - SpdySerializedFrame frame(
|
| - SpdyFramerPeer::SerializeHeaders(&framer, headers_ir));
|
| - TestSpdyVisitor visitor(spdy_version_);
|
| - visitor.use_compression_ = true;
|
| - visitor.SimulateInFramer(reinterpret_cast<unsigned char*>(frame.data()),
|
| - frame.size());
|
| - EXPECT_EQ(1, visitor.headers_frame_count_);
|
| - EXPECT_EQ(headers_ir.header_block().size(), visitor.headers_.size());
|
| - EXPECT_EQ("beta", visitor.headers_["alpha"]);
|
| - EXPECT_EQ("charlie", visitor.headers_["gamma"]);
|
| - EXPECT_EQ("Bar", visitor.headers_["foo"]);
|
| -}
|
| -
|
| // Test that we treat incoming upper-case or mixed-case header values as
|
| // malformed for HTTP2.
|
| TEST_P(SpdyFramerTest, RejectUpperCaseHeaderBlockValue) {
|
| - if (!IsHttp2()) {
|
| - return;
|
| - }
|
| -
|
| SpdyFramer framer(spdy_version_);
|
| framer.set_enable_compression(false);
|
|
|
| @@ -868,10 +789,6 @@ TEST_P(SpdyFramerTest, RejectUpperCaseHeaderBlockValue) {
|
| // Test that we can encode and decode stream dependency values in a header
|
| // frame.
|
| TEST_P(SpdyFramerTest, HeaderStreamDependencyValues) {
|
| - if (!IsHttp2()) {
|
| - return;
|
| - }
|
| -
|
| SpdyFramer framer(spdy_version_);
|
| framer.set_enable_compression(false);
|
|
|
| @@ -901,10 +818,6 @@ TEST_P(SpdyFramerTest, HeaderStreamDependencyValues) {
|
| // Test that if we receive a frame with payload length field at the
|
| // advertised max size, we do not set an error in ProcessInput.
|
| TEST_P(SpdyFramerTest, AcceptMaxFrameSizeSetting) {
|
| - if (!IsHttp2()) {
|
| - return;
|
| - }
|
| -
|
| testing::StrictMock<test::MockSpdyFramerVisitor> visitor;
|
| SpdyFramer framer(spdy_version_);
|
| framer.set_visitor(&visitor);
|
| @@ -930,10 +843,6 @@ TEST_P(SpdyFramerTest, AcceptMaxFrameSizeSetting) {
|
| // Test that if we receive a frame with payload length larger than the
|
| // advertised max size, we set an error of SPDY_INVALID_CONTROL_FRAME_SIZE.
|
| TEST_P(SpdyFramerTest, ExceedMaxFrameSizeSetting) {
|
| - if (!IsHttp2()) {
|
| - return;
|
| - }
|
| -
|
| testing::StrictMock<test::MockSpdyFramerVisitor> visitor;
|
| SpdyFramer framer(spdy_version_);
|
| framer.set_visitor(&visitor);
|
| @@ -960,10 +869,6 @@ TEST_P(SpdyFramerTest, ExceedMaxFrameSizeSetting) {
|
| // Test that if we receive a DATA frame with padding length larger than the
|
| // payload length, we set an error of SPDY_INVALID_PADDING
|
| TEST_P(SpdyFramerTest, OversizedDataPaddingError) {
|
| - if (!IsHttp2()) {
|
| - return;
|
| - }
|
| -
|
| testing::StrictMock<test::MockSpdyFramerVisitor> visitor;
|
| SpdyFramer framer(spdy_version_);
|
| framer.set_visitor(&visitor);
|
| @@ -999,10 +904,6 @@ TEST_P(SpdyFramerTest, OversizedDataPaddingError) {
|
| // Test that if we receive a DATA frame with padding length not larger than the
|
| // payload length, we do not set an error of SPDY_INVALID_PADDING
|
| TEST_P(SpdyFramerTest, CorrectlySizedDataPaddingNoError) {
|
| - if (!IsHttp2()) {
|
| - return;
|
| - }
|
| -
|
| testing::StrictMock<test::MockSpdyFramerVisitor> visitor;
|
| SpdyFramer framer(spdy_version_);
|
| framer.set_visitor(&visitor);
|
| @@ -1038,10 +939,6 @@ TEST_P(SpdyFramerTest, CorrectlySizedDataPaddingNoError) {
|
| // Test that if we receive a HEADERS frame with padding length larger than the
|
| // payload length, we set an error of SPDY_INVALID_PADDING
|
| TEST_P(SpdyFramerTest, OversizedHeadersPaddingError) {
|
| - if (!IsHttp2()) {
|
| - return;
|
| - }
|
| -
|
| testing::StrictMock<test::MockSpdyFramerVisitor> visitor;
|
| SpdyFramer framer(spdy_version_);
|
| framer.set_visitor(&visitor);
|
| @@ -1074,10 +971,6 @@ TEST_P(SpdyFramerTest, OversizedHeadersPaddingError) {
|
| // Test that if we receive a HEADERS frame with padding length not larger
|
| // than the payload length, we do not set an error of SPDY_INVALID_PADDING
|
| TEST_P(SpdyFramerTest, CorrectlySizedHeadersPaddingNoError) {
|
| - if (!IsHttp2()) {
|
| - return;
|
| - }
|
| -
|
| testing::StrictMock<test::MockSpdyFramerVisitor> visitor;
|
| SpdyFramer framer(spdy_version_);
|
| framer.set_visitor(&visitor);
|
| @@ -1102,36 +995,9 @@ TEST_P(SpdyFramerTest, CorrectlySizedHeadersPaddingNoError) {
|
| << SpdyFramer::ErrorCodeToString(framer.error_code());
|
| }
|
|
|
| -// Test that if we receive a SYN_REPLY with stream ID zero, we signal an error
|
| -// (but don't crash).
|
| -TEST_P(SpdyFramerTest, SynReplyWithStreamIdZero) {
|
| - if (!IsSpdy3()) {
|
| - return;
|
| - }
|
| -
|
| - testing::StrictMock<test::MockSpdyFramerVisitor> visitor;
|
| - SpdyFramer framer(spdy_version_);
|
| - framer.set_visitor(&visitor);
|
| -
|
| - SpdySynReplyIR syn_reply(0);
|
| - syn_reply.SetHeader("alpha", "beta");
|
| - SpdySerializedFrame frame(framer.SerializeSynReply(syn_reply));
|
| -
|
| - // We shouldn't have to read the whole frame before we signal an error.
|
| - EXPECT_CALL(visitor, OnError(testing::Eq(&framer)));
|
| - EXPECT_GT(frame.size(), framer.ProcessInput(frame.data(), frame.size()));
|
| - EXPECT_TRUE(framer.HasError());
|
| - EXPECT_EQ(SpdyFramer::SPDY_INVALID_CONTROL_FRAME, framer.error_code())
|
| - << SpdyFramer::ErrorCodeToString(framer.error_code());
|
| -}
|
| -
|
| // Test that if we receive a DATA with stream ID zero, we signal an error
|
| // (but don't crash).
|
| TEST_P(SpdyFramerTest, DataWithStreamIdZero) {
|
| - if (!IsHttp2()) {
|
| - return;
|
| - }
|
| -
|
| testing::StrictMock<test::MockSpdyFramerVisitor> visitor;
|
| SpdyFramer framer(spdy_version_);
|
| framer.set_visitor(&visitor);
|
| @@ -1163,22 +1029,13 @@ TEST_P(SpdyFramerTest, HeadersWithStreamIdZero) {
|
| EXPECT_CALL(visitor, OnError(testing::Eq(&framer)));
|
| EXPECT_GT(frame.size(), framer.ProcessInput(frame.data(), frame.size()));
|
| EXPECT_TRUE(framer.HasError());
|
| - if (IsHttp2()) {
|
| - EXPECT_EQ(SpdyFramer::SPDY_INVALID_STREAM_ID, framer.error_code())
|
| - << SpdyFramer::ErrorCodeToString(framer.error_code());
|
| - } else {
|
| - EXPECT_EQ(SpdyFramer::SPDY_INVALID_CONTROL_FRAME, framer.error_code())
|
| - << SpdyFramer::ErrorCodeToString(framer.error_code());
|
| - }
|
| + EXPECT_EQ(SpdyFramer::SPDY_INVALID_STREAM_ID, framer.error_code())
|
| + << SpdyFramer::ErrorCodeToString(framer.error_code());
|
| }
|
|
|
| // Test that if we receive a PRIORITY with stream ID zero, we signal an error
|
| // (but don't crash).
|
| TEST_P(SpdyFramerTest, PriorityWithStreamIdZero) {
|
| - if (!IsHttp2()) {
|
| - return;
|
| - }
|
| -
|
| testing::StrictMock<test::MockSpdyFramerVisitor> visitor;
|
| SpdyFramer framer(spdy_version_);
|
| framer.set_visitor(&visitor);
|
| @@ -1197,10 +1054,6 @@ TEST_P(SpdyFramerTest, PriorityWithStreamIdZero) {
|
| // Test that if we receive a RST_STREAM with stream ID zero, we signal an error
|
| // (but don't crash).
|
| TEST_P(SpdyFramerTest, RstStreamWithStreamIdZero) {
|
| - if (!IsHttp2()) {
|
| - return;
|
| - }
|
| -
|
| testing::StrictMock<test::MockSpdyFramerVisitor> visitor;
|
| SpdyFramer framer(spdy_version_);
|
| framer.set_visitor(&visitor);
|
| @@ -1219,10 +1072,6 @@ TEST_P(SpdyFramerTest, RstStreamWithStreamIdZero) {
|
| // Test that if we receive a SETTINGS with stream ID other than zero,
|
| // we signal an error (but don't crash).
|
| TEST_P(SpdyFramerTest, SettingsWithStreamIdNotZero) {
|
| - if (!IsHttp2()) {
|
| - return;
|
| - }
|
| -
|
| testing::StrictMock<test::MockSpdyFramerVisitor> visitor;
|
| SpdyFramer framer(spdy_version_);
|
| framer.set_visitor(&visitor);
|
| @@ -1250,10 +1099,6 @@ TEST_P(SpdyFramerTest, SettingsWithStreamIdNotZero) {
|
| // Test that if we receive a GOAWAY with stream ID other than zero,
|
| // we signal an error (but don't crash).
|
| TEST_P(SpdyFramerTest, GoawayWithStreamIdNotZero) {
|
| - if (!IsHttp2()) {
|
| - return;
|
| - }
|
| -
|
| testing::StrictMock<test::MockSpdyFramerVisitor> visitor;
|
| SpdyFramer framer(spdy_version_);
|
| framer.set_visitor(&visitor);
|
| @@ -1282,10 +1127,6 @@ TEST_P(SpdyFramerTest, GoawayWithStreamIdNotZero) {
|
| // Test that if we receive a CONTINUATION with stream ID zero, we signal an
|
| // SPDY_INVALID_STREAM_ID.
|
| TEST_P(SpdyFramerTest, ContinuationWithStreamIdZero) {
|
| - if (!IsHttp2()) {
|
| - return;
|
| - }
|
| -
|
| testing::StrictMock<test::MockSpdyFramerVisitor> visitor;
|
| SpdyFramer framer(spdy_version_);
|
| framer.set_visitor(&visitor);
|
| @@ -1308,10 +1149,6 @@ TEST_P(SpdyFramerTest, ContinuationWithStreamIdZero) {
|
| // Test that if we receive a PUSH_PROMISE with stream ID zero, we signal an
|
| // SPDY_INVALID_STREAM_ID.
|
| TEST_P(SpdyFramerTest, PushPromiseWithStreamIdZero) {
|
| - if (!IsHttp2()) {
|
| - return;
|
| - }
|
| -
|
| testing::StrictMock<test::MockSpdyFramerVisitor> visitor;
|
| SpdyFramer framer(spdy_version_);
|
| framer.set_visitor(&visitor);
|
| @@ -1331,10 +1168,6 @@ TEST_P(SpdyFramerTest, PushPromiseWithStreamIdZero) {
|
| // Test that if we receive a PUSH_PROMISE with promised stream ID zero, we
|
| // signal SPDY_INVALID_STREAM_ID.
|
| TEST_P(SpdyFramerTest, PushPromiseWithPromisedStreamIdZero) {
|
| - if (!IsHttp2()) {
|
| - return;
|
| - }
|
| -
|
| testing::StrictMock<test::MockSpdyFramerVisitor> visitor;
|
| SpdyFramer framer(spdy_version_);
|
| framer.set_visitor(&visitor);
|
| @@ -1352,24 +1185,11 @@ TEST_P(SpdyFramerTest, PushPromiseWithPromisedStreamIdZero) {
|
| }
|
|
|
| TEST_P(SpdyFramerTest, DuplicateHeader) {
|
| - if (!IsSpdy3()) {
|
| - // TODO(jgraettinger): Punting on this because we haven't determined
|
| - // whether duplicate HPACK headers other than Cookie are an error.
|
| - // If they are, this will need to be updated to use HpackOutputStream.
|
| - return;
|
| - }
|
| SpdyFramer framer(spdy_version_);
|
| // Frame builder with plentiful buffer size.
|
| SpdyFrameBuilder frame(1024, spdy_version_);
|
| - if (spdy_version_ <= SPDY3) {
|
| - frame.WriteControlFrameHeader(framer, SYN_STREAM, CONTROL_FLAG_NONE);
|
| - frame.WriteUInt32(3); // stream_id
|
| - frame.WriteUInt32(0); // associated stream id
|
| - frame.WriteUInt16(0); // Priority.
|
| - } else {
|
| - frame.BeginNewFrame(framer, HEADERS, HEADERS_FLAG_PRIORITY, 3);
|
| - frame.WriteUInt32(framer.GetHighestPriority());
|
| - }
|
| + frame.BeginNewFrame(framer, HEADERS, HEADERS_FLAG_PRIORITY, 3);
|
| + frame.WriteUInt32(framer.GetHighestPriority());
|
|
|
| frame.WriteUInt32(2); // Number of headers.
|
| frame.WriteStringPiece32("name");
|
| @@ -1392,32 +1212,19 @@ TEST_P(SpdyFramerTest, MultiValueHeader) {
|
| SpdyFramer framer(spdy_version_);
|
| // Frame builder with plentiful buffer size.
|
| SpdyFrameBuilder frame(1024, spdy_version_);
|
| - if (IsSpdy3()) {
|
| - frame.WriteControlFrameHeader(framer, SYN_STREAM, CONTROL_FLAG_NONE);
|
| - frame.WriteUInt32(3); // stream_id
|
| - frame.WriteUInt32(0); // associated stream id
|
| - frame.WriteUInt16(0); // Priority.
|
| - } else {
|
| - frame.BeginNewFrame(framer, HEADERS,
|
| - HEADERS_FLAG_PRIORITY | HEADERS_FLAG_END_HEADERS, 3);
|
| - frame.WriteUInt32(0); // Priority exclusivity and dependent stream.
|
| - frame.WriteUInt8(255); // Priority weight.
|
| - }
|
| + frame.BeginNewFrame(framer, HEADERS,
|
| + HEADERS_FLAG_PRIORITY | HEADERS_FLAG_END_HEADERS, 3);
|
| + frame.WriteUInt32(0); // Priority exclusivity and dependent stream.
|
| + frame.WriteUInt8(255); // Priority weight.
|
|
|
| string value("value1\0value2", 13);
|
| - if (IsSpdy3()) {
|
| - frame.WriteUInt32(1); // Number of headers.
|
| - frame.WriteStringPiece32("name");
|
| - frame.WriteStringPiece32(value);
|
| - } else {
|
| - // TODO(jgraettinger): If this pattern appears again, move to test class.
|
| - SpdyHeaderBlock header_set;
|
| - header_set["name"] = value;
|
| - string buffer;
|
| - HpackEncoder encoder(ObtainHpackHuffmanTable());
|
| - encoder.EncodeHeaderSetWithoutCompression(header_set, &buffer);
|
| - frame.WriteBytes(&buffer[0], buffer.size());
|
| - }
|
| + // TODO(jgraettinger): If this pattern appears again, move to test class.
|
| + SpdyHeaderBlock header_set;
|
| + header_set["name"] = value;
|
| + string buffer;
|
| + HpackEncoder encoder(ObtainHpackHuffmanTable());
|
| + encoder.EncodeHeaderSetWithoutCompression(header_set, &buffer);
|
| + frame.WriteBytes(&buffer[0], buffer.size());
|
| // write the length
|
| frame.RewriteLength(framer);
|
|
|
| @@ -1434,74 +1241,6 @@ TEST_P(SpdyFramerTest, MultiValueHeader) {
|
| testing::ElementsAre(testing::Pair("name", StringPiece(value))));
|
| }
|
|
|
| -TEST_P(SpdyFramerTest, BasicCompression) {
|
| - if (!IsSpdy3()) {
|
| - // Deflate compression doesn't apply to HPACK.
|
| - return;
|
| - }
|
| -
|
| - std::unique_ptr<TestSpdyVisitor> visitor(new TestSpdyVisitor(spdy_version_));
|
| - SpdyFramer framer(spdy_version_);
|
| - framer.set_debug_visitor(visitor.get());
|
| - SpdySynStreamIR syn_stream(1);
|
| - syn_stream.set_priority(1);
|
| - syn_stream.SetHeader("server", "SpdyServer 1.0");
|
| - syn_stream.SetHeader("date", "Mon 12 Jan 2009 12:12:12 PST");
|
| - syn_stream.SetHeader("status", "200");
|
| - syn_stream.SetHeader("version", "HTTP/1.1");
|
| - syn_stream.SetHeader("content-type", "text/html");
|
| - syn_stream.SetHeader("content-length", "12");
|
| - SpdySerializedFrame frame1(framer.SerializeSynStream(syn_stream));
|
| - size_t uncompressed_size1 = visitor->last_payload_len_;
|
| - size_t compressed_size1 =
|
| - visitor->last_frame_len_ - framer.GetSynStreamMinimumSize();
|
| - EXPECT_EQ(165u, uncompressed_size1);
|
| -#if defined(USE_SYSTEM_ZLIB)
|
| - EXPECT_EQ(181u, compressed_size1);
|
| -#else // !defined(USE_SYSTEM_ZLIB)
|
| - EXPECT_EQ(116u, compressed_size1);
|
| -#endif // !defined(USE_SYSTEM_ZLIB)
|
| - SpdySerializedFrame frame2(framer.SerializeSynStream(syn_stream));
|
| - size_t uncompressed_size2 = visitor->last_payload_len_;
|
| - size_t compressed_size2 =
|
| - visitor->last_frame_len_ - framer.GetSynStreamMinimumSize();
|
| -
|
| - // Expect the second frame to be more compact than the first.
|
| - EXPECT_LE(frame2.size(), frame1.size());
|
| -
|
| - // Decompress the first frame
|
| - SpdySerializedFrame frame3(
|
| - SpdyFramerTestUtil::DecompressFrame(&framer, frame1));
|
| -
|
| - // Decompress the second frame
|
| - visitor.reset(new TestSpdyVisitor(spdy_version_));
|
| - framer.set_debug_visitor(visitor.get());
|
| - SpdySerializedFrame frame4(
|
| - SpdyFramerTestUtil::DecompressFrame(&framer, frame2));
|
| - size_t uncompressed_size4 = frame4.size() - framer.GetSynStreamMinimumSize();
|
| - size_t compressed_size4 =
|
| - visitor->last_frame_len_ - framer.GetSynStreamMinimumSize();
|
| - EXPECT_EQ(165u, uncompressed_size4);
|
| -#if defined(USE_SYSTEM_ZLIB)
|
| - EXPECT_EQ(175u, compressed_size4);
|
| -#else // !defined(USE_SYSTEM_ZLIB)
|
| - EXPECT_EQ(98u, compressed_size4);
|
| -#endif // !defined(USE_SYSTEM_ZLIB)
|
| -
|
| - EXPECT_EQ(uncompressed_size1, uncompressed_size2);
|
| - EXPECT_EQ(uncompressed_size1, uncompressed_size4);
|
| - EXPECT_EQ(compressed_size2, compressed_size4);
|
| -
|
| - // Expect frames 3 & 4 to be the same.
|
| - CompareFrames("Uncompressed SYN_STREAM", frame3, frame4);
|
| -
|
| - // Expect frames 3 to be the same as a uncompressed frame created
|
| - // from scratch.
|
| - framer.set_enable_compression(false);
|
| - SpdySerializedFrame uncompressed_frame(framer.SerializeSynStream(syn_stream));
|
| - CompareFrames("Uncompressed SYN_STREAM", frame3, uncompressed_frame);
|
| -}
|
| -
|
| TEST_P(SpdyFramerTest, CompressEmptyHeaders) {
|
| // See crbug.com/172383
|
| SpdyHeadersIR headers(1);
|
| @@ -1520,67 +1259,6 @@ TEST_P(SpdyFramerTest, CompressEmptyHeaders) {
|
| }
|
|
|
| TEST_P(SpdyFramerTest, Basic) {
|
| - // clang-format off
|
| - const unsigned char kV3Input[] = {
|
| - 0x80, 0x03, 0x00, 0x01, // SYN Stream #1
|
| - 0x00, 0x00, 0x00, 0x1a,
|
| - 0x00, 0x00, 0x00, 0x01,
|
| - 0x00, 0x00, 0x00, 0x00,
|
| - 0x00, 0x00, 0x00, 0x00,
|
| - 0x00, 0x01, 0x00, 0x00,
|
| - 0x00, 0x02, 'h', 'h',
|
| - 0x00, 0x00, 0x00, 0x02,
|
| - 'v', 'v',
|
| -
|
| - 0x80, 0x03, 0x00, 0x08, // HEADERS on Stream #1
|
| - 0x00, 0x00, 0x00, 0x20,
|
| - 0x00, 0x00, 0x00, 0x01,
|
| - 0x00, 0x00, 0x00, 0x02,
|
| - 0x00, 0x00, 0x00, 0x02,
|
| - 'h', '2',
|
| - 0x00, 0x00, 0x00, 0x02,
|
| - 'v', '2', 0x00, 0x00,
|
| - 0x00, 0x02, 'h', '3',
|
| - 0x00, 0x00, 0x00, 0x02,
|
| - 'v', '3',
|
| -
|
| - 0x00, 0x00, 0x00, 0x01, // DATA on Stream #1
|
| - 0x00, 0x00, 0x00, 0x0c,
|
| - 0xde, 0xad, 0xbe, 0xef,
|
| - 0xde, 0xad, 0xbe, 0xef,
|
| - 0xde, 0xad, 0xbe, 0xef,
|
| -
|
| - 0x80, 0x03, 0x00, 0x01, // SYN Stream #3
|
| - 0x00, 0x00, 0x00, 0x0e,
|
| - 0x00, 0x00, 0x00, 0x03,
|
| - 0x00, 0x00, 0x00, 0x00,
|
| - 0x00, 0x00, 0x00, 0x00,
|
| - 0x00, 0x00,
|
| -
|
| - 0x00, 0x00, 0x00, 0x03, // DATA on Stream #3
|
| - 0x00, 0x00, 0x00, 0x08,
|
| - 0xde, 0xad, 0xbe, 0xef,
|
| - 0xde, 0xad, 0xbe, 0xef,
|
| -
|
| - 0x00, 0x00, 0x00, 0x01, // DATA on Stream #1
|
| - 0x00, 0x00, 0x00, 0x04,
|
| - 0xde, 0xad, 0xbe, 0xef,
|
| -
|
| - 0x80, 0x03, 0x00, 0x03, // RST_STREAM on Stream #1
|
| - 0x00, 0x00, 0x00, 0x08,
|
| - 0x00, 0x00, 0x00, 0x01,
|
| - 0x00, 0x00, 0x00, 0x05, // RST_STREAM_CANCEL
|
| -
|
| - 0x00, 0x00, 0x00, 0x03, // DATA on Stream #3
|
| - 0x00, 0x00, 0x00, 0x00,
|
| -
|
| - 0x80, 0x03, 0x00, 0x03, // RST_STREAM on Stream #3
|
| - 0x00, 0x00, 0x00, 0x08,
|
| - 0x00, 0x00, 0x00, 0x03,
|
| - 0x00, 0x00, 0x00, 0x05, // RST_STREAM_CANCEL
|
| - };
|
| - // clang-format on
|
| -
|
| // SYN_STREAM doesn't exist in HTTP/2, so instead we send
|
| // HEADERS frames with PRIORITY and END_HEADERS set.
|
| // frame-format off
|
| @@ -1646,26 +1324,16 @@ TEST_P(SpdyFramerTest, Basic) {
|
| // frame-format on
|
|
|
| TestSpdyVisitor visitor(spdy_version_);
|
| - if (IsSpdy3()) {
|
| - visitor.SimulateInFramer(kV3Input, sizeof(kV3Input));
|
| - } else {
|
| - visitor.SimulateInFramer(kH2Input, sizeof(kH2Input));
|
| - }
|
| + visitor.SimulateInFramer(kH2Input, sizeof(kH2Input));
|
|
|
| EXPECT_EQ(0, visitor.syn_reply_frame_count_);
|
| EXPECT_EQ(24, visitor.data_bytes_);
|
| EXPECT_EQ(0, visitor.error_count_);
|
| EXPECT_EQ(2, visitor.fin_frame_count_);
|
|
|
| - if (IsSpdy3()) {
|
| - EXPECT_EQ(1, visitor.headers_frame_count_);
|
| - EXPECT_EQ(2, visitor.syn_frame_count_);
|
| - EXPECT_TRUE(visitor.fin_opaque_data_.empty());
|
| - } else {
|
| - EXPECT_EQ(3, visitor.headers_frame_count_);
|
| - EXPECT_EQ(0, visitor.syn_frame_count_);
|
| - EXPECT_TRUE(visitor.fin_opaque_data_.empty());
|
| - }
|
| + EXPECT_EQ(3, visitor.headers_frame_count_);
|
| + EXPECT_EQ(0, visitor.syn_frame_count_);
|
| + EXPECT_TRUE(visitor.fin_opaque_data_.empty());
|
|
|
| EXPECT_EQ(0, visitor.fin_flag_count_);
|
| EXPECT_EQ(0, visitor.end_of_stream_count_);
|
| @@ -1675,38 +1343,6 @@ TEST_P(SpdyFramerTest, Basic) {
|
|
|
| // Test that the FIN flag on a data frame signifies EOF.
|
| TEST_P(SpdyFramerTest, FinOnDataFrame) {
|
| - // clang-format off
|
| - const unsigned char kV3Input[] = {
|
| - 0x80, 0x03, 0x00, 0x01, // SYN Stream #1
|
| - 0x00, 0x00, 0x00, 0x1a,
|
| - 0x00, 0x00, 0x00, 0x01,
|
| - 0x00, 0x00, 0x00, 0x00,
|
| - 0x00, 0x00, 0x00, 0x00,
|
| - 0x00, 0x01, 0x00, 0x00,
|
| - 0x00, 0x02, 'h', 'h',
|
| - 0x00, 0x00, 0x00, 0x02,
|
| - 'v', 'v',
|
| -
|
| - 0x80, 0x03, 0x00, 0x02, // SYN REPLY Stream #1
|
| - 0x00, 0x00, 0x00, 0x14,
|
| - 0x00, 0x00, 0x00, 0x01,
|
| - 0x00, 0x00, 0x00, 0x01,
|
| - 0x00, 0x00, 0x00, 0x02,
|
| - 'a', 'a', 0x00, 0x00,
|
| - 0x00, 0x02, 'b', 'b',
|
| -
|
| - 0x00, 0x00, 0x00, 0x01, // DATA on Stream #1
|
| - 0x00, 0x00, 0x00, 0x0c,
|
| - 0xde, 0xad, 0xbe, 0xef,
|
| - 0xde, 0xad, 0xbe, 0xef,
|
| - 0xde, 0xad, 0xbe, 0xef,
|
| -
|
| - 0x00, 0x00, 0x00, 0x01, // DATA on Stream #1, with EOF
|
| - 0x01, 0x00, 0x00, 0x04,
|
| - 0xde, 0xad, 0xbe, 0xef,
|
| - };
|
| - // clang-format on
|
| -
|
| // SYN_STREAM and SYN_REPLY don't exist in HTTP2, so instead we send
|
| // HEADERS frames with PRIORITY(SYN_STREAM only) and END_HEADERS set.
|
| // frame-format off
|
| @@ -1741,22 +1377,12 @@ TEST_P(SpdyFramerTest, FinOnDataFrame) {
|
| // frame-format on
|
|
|
| TestSpdyVisitor visitor(spdy_version_);
|
| - if (IsSpdy3()) {
|
| - visitor.SimulateInFramer(kV3Input, sizeof(kV3Input));
|
| - } else {
|
| - visitor.SimulateInFramer(kH2Input, sizeof(kH2Input));
|
| - }
|
| + visitor.SimulateInFramer(kH2Input, sizeof(kH2Input));
|
|
|
| EXPECT_EQ(0, visitor.error_count_);
|
| - if (IsSpdy3()) {
|
| - EXPECT_EQ(1, visitor.syn_frame_count_);
|
| - EXPECT_EQ(1, visitor.syn_reply_frame_count_);
|
| - EXPECT_EQ(0, visitor.headers_frame_count_);
|
| - } else {
|
| - EXPECT_EQ(0, visitor.syn_frame_count_);
|
| - EXPECT_EQ(0, visitor.syn_reply_frame_count_);
|
| - EXPECT_EQ(2, visitor.headers_frame_count_);
|
| - }
|
| + EXPECT_EQ(0, visitor.syn_frame_count_);
|
| + EXPECT_EQ(0, visitor.syn_reply_frame_count_);
|
| + EXPECT_EQ(2, visitor.headers_frame_count_);
|
| EXPECT_EQ(16, visitor.data_bytes_);
|
| EXPECT_EQ(0, visitor.fin_frame_count_);
|
| EXPECT_EQ(0, visitor.fin_flag_count_);
|
| @@ -1766,28 +1392,6 @@ TEST_P(SpdyFramerTest, FinOnDataFrame) {
|
|
|
| // Test that the FIN flag on a SYN reply frame signifies EOF.
|
| TEST_P(SpdyFramerTest, FinOnSynReplyFrame) {
|
| - // clang-format off
|
| - const unsigned char kV3Input[] = {
|
| - 0x80, 0x03, 0x00, // SYN Stream #1
|
| - 0x01, 0x00, 0x00, 0x00,
|
| - 0x1a, 0x00, 0x00, 0x00,
|
| - 0x01, 0x00, 0x00, 0x00,
|
| - 0x00, 0x00, 0x00, 0x00,
|
| - 0x00, 0x00, 0x01, 0x00,
|
| - 0x00, 0x00, 0x02, 'h',
|
| - 'h', 0x00, 0x00, 0x00,
|
| - 0x02, 'v', 'v',
|
| -
|
| - 0x80, 0x03, 0x00, 0x02, // SYN REPLY Stream #1
|
| - 0x01, 0x00, 0x00, 0x14,
|
| - 0x00, 0x00, 0x00, 0x01,
|
| - 0x00, 0x00, 0x00, 0x01,
|
| - 0x00, 0x00, 0x00, 0x02,
|
| - 'a', 'a', 0x00, 0x00,
|
| - 0x00, 0x02, 'b', 'b',
|
| - };
|
| - // clang-format on
|
| -
|
| // SYN_STREAM and SYN_REPLY don't exist in HTTP2, so instead we send
|
| // HEADERS frames with PRIORITY(SYN_STREAM only) and END_HEADERS set.
|
| // frame-format off
|
| @@ -1808,22 +1412,12 @@ TEST_P(SpdyFramerTest, FinOnSynReplyFrame) {
|
| // frame-format on
|
|
|
| TestSpdyVisitor visitor(spdy_version_);
|
| - if (IsSpdy3()) {
|
| - visitor.SimulateInFramer(kV3Input, sizeof(kV3Input));
|
| - } else {
|
| - visitor.SimulateInFramer(kH2Input, sizeof(kH2Input));
|
| - }
|
| + visitor.SimulateInFramer(kH2Input, sizeof(kH2Input));
|
|
|
| EXPECT_EQ(0, visitor.error_count_);
|
| - if (IsSpdy3()) {
|
| - EXPECT_EQ(1, visitor.syn_frame_count_);
|
| - EXPECT_EQ(1, visitor.syn_reply_frame_count_);
|
| - EXPECT_EQ(0, visitor.headers_frame_count_);
|
| - } else {
|
| - EXPECT_EQ(0, visitor.syn_frame_count_);
|
| - EXPECT_EQ(0, visitor.syn_reply_frame_count_);
|
| - EXPECT_EQ(2, visitor.headers_frame_count_);
|
| - }
|
| + EXPECT_EQ(0, visitor.syn_frame_count_);
|
| + EXPECT_EQ(0, visitor.syn_reply_frame_count_);
|
| + EXPECT_EQ(2, visitor.headers_frame_count_);
|
| EXPECT_EQ(0, visitor.data_bytes_);
|
| EXPECT_EQ(0, visitor.fin_frame_count_);
|
| EXPECT_EQ(1, visitor.fin_flag_count_);
|
| @@ -1831,63 +1425,6 @@ TEST_P(SpdyFramerTest, FinOnSynReplyFrame) {
|
| EXPECT_EQ(0, visitor.data_frame_count_);
|
| }
|
|
|
| -TEST_P(SpdyFramerTest, HeaderCompression) {
|
| - if (!IsSpdy3()) {
|
| - // Deflate compression doesn't apply to HPACK.
|
| - return;
|
| - }
|
| -
|
| - SpdyFramer send_framer(spdy_version_);
|
| - SpdyFramer recv_framer(spdy_version_);
|
| -
|
| - send_framer.set_enable_compression(true);
|
| - recv_framer.set_enable_compression(true);
|
| -
|
| - const char kHeader1[] = "header1";
|
| - const char kHeader2[] = "header2";
|
| - const char kHeader3[] = "header3";
|
| - const char kValue1[] = "value1";
|
| - const char kValue2[] = "value2";
|
| - const char kValue3[] = "value3";
|
| -
|
| - // SYN_STREAM #1
|
| - SpdyHeaderBlock block;
|
| - block[kHeader1] = kValue1;
|
| - block[kHeader2] = kValue2;
|
| - SpdySynStreamIR syn_ir_1(1, block.Clone());
|
| - SpdySerializedFrame syn_frame_1(send_framer.SerializeFrame(syn_ir_1));
|
| -
|
| - // SYN_STREAM #2
|
| - block[kHeader3] = kValue3;
|
| - SpdySynStreamIR syn_stream(3, std::move(block));
|
| - SpdySerializedFrame syn_frame_2(send_framer.SerializeSynStream(syn_stream));
|
| -
|
| - // Decompress SYN_STREAM #1
|
| - SpdySerializedFrame decompressed(
|
| - SpdyFramerTestUtil::DecompressFrame(&recv_framer, syn_frame_1));
|
| - StringPiece serialized_headers =
|
| - GetSerializedHeaders(decompressed, send_framer);
|
| - SpdyHeaderBlock decompressed_headers;
|
| - EXPECT_TRUE(recv_framer.ParseHeaderBlockInBuffer(serialized_headers.data(),
|
| - serialized_headers.size(),
|
| - &decompressed_headers));
|
| - EXPECT_EQ(2u, decompressed_headers.size());
|
| - EXPECT_EQ(kValue1, decompressed_headers[kHeader1]);
|
| - EXPECT_EQ(kValue2, decompressed_headers[kHeader2]);
|
| -
|
| - // Decompress SYN_STREAM #2
|
| - decompressed = SpdyFramerTestUtil::DecompressFrame(&recv_framer, syn_frame_2);
|
| - serialized_headers = GetSerializedHeaders(decompressed, send_framer);
|
| - decompressed_headers.clear();
|
| - EXPECT_TRUE(recv_framer.ParseHeaderBlockInBuffer(serialized_headers.data(),
|
| - serialized_headers.size(),
|
| - &decompressed_headers));
|
| - EXPECT_EQ(3u, decompressed_headers.size());
|
| - EXPECT_EQ(kValue1, decompressed_headers[kHeader1]);
|
| - EXPECT_EQ(kValue2, decompressed_headers[kHeader2]);
|
| - EXPECT_EQ(kValue3, decompressed_headers[kHeader3]);
|
| -}
|
| -
|
| // Verify we can decompress the stream even if handed over to the
|
| // framer 1 byte at a time.
|
| TEST_P(SpdyFramerTest, UnclosedStreamDataCompressorsOneByteAtATime) {
|
| @@ -1943,14 +1480,6 @@ TEST_P(SpdyFramerTest, WindowUpdateFrame) {
|
| framer.SerializeWindowUpdate(SpdyWindowUpdateIR(1, 0x12345678)));
|
|
|
| const char kDescription[] = "WINDOW_UPDATE frame, stream 1, delta 0x12345678";
|
| - // clang-format off
|
| - const unsigned char kV3FrameData[] = {
|
| - 0x80, 0x03, 0x00, 0x09,
|
| - 0x00, 0x00, 0x00, 0x08,
|
| - 0x00, 0x00, 0x00, 0x01,
|
| - 0x12, 0x34, 0x56, 0x78
|
| - };
|
| - // clang-format on
|
| const unsigned char kH2FrameData[] = {
|
| 0x00, 0x00, 0x04, // Length: 4
|
| 0x08, // Type: WINDOW_UPDATE
|
| @@ -1959,11 +1488,7 @@ TEST_P(SpdyFramerTest, WindowUpdateFrame) {
|
| 0x12, 0x34, 0x56, 0x78, // Increment: 305419896
|
| };
|
|
|
| - if (IsSpdy3()) {
|
| - CompareFrame(kDescription, frame, kV3FrameData, arraysize(kV3FrameData));
|
| - } else {
|
| - CompareFrame(kDescription, frame, kH2FrameData, arraysize(kH2FrameData));
|
| - }
|
| + CompareFrame(kDescription, frame, kH2FrameData, arraysize(kH2FrameData));
|
| }
|
|
|
| TEST_P(SpdyFramerTest, CreateDataFrame) {
|
| @@ -1971,14 +1496,6 @@ TEST_P(SpdyFramerTest, CreateDataFrame) {
|
|
|
| {
|
| const char kDescription[] = "'hello' data frame, no FIN";
|
| - // clang-format off
|
| - const unsigned char kV3FrameData[] = {
|
| - 0x00, 0x00, 0x00, 0x01,
|
| - 0x00, 0x00, 0x00, 0x05,
|
| - 'h', 'e', 'l', 'l',
|
| - 'o'
|
| - };
|
| - // clang-format on
|
| // frame-format off
|
| const unsigned char kH2FrameData[] = {
|
| 0x00, 0x00, 0x05, // Length: 5
|
| @@ -1993,11 +1510,7 @@ TEST_P(SpdyFramerTest, CreateDataFrame) {
|
|
|
| SpdyDataIR data_ir(1, bytes);
|
| SpdySerializedFrame frame(framer.SerializeData(data_ir));
|
| - if (IsSpdy3()) {
|
| - CompareFrame(kDescription, frame, kV3FrameData, arraysize(kV3FrameData));
|
| - } else {
|
| - CompareFrame(kDescription, frame, kH2FrameData, arraysize(kH2FrameData));
|
| - }
|
| + CompareFrame(kDescription, frame, kH2FrameData, arraysize(kH2FrameData));
|
|
|
| SpdyDataIR data_header_ir(1);
|
| data_header_ir.SetDataShallow(bytes);
|
| @@ -2005,28 +1518,19 @@ TEST_P(SpdyFramerTest, CreateDataFrame) {
|
| framer.SerializeDataFrameHeaderWithPaddingLengthField(data_header_ir);
|
| CompareCharArraysWithHexError(
|
| kDescription, reinterpret_cast<const unsigned char*>(frame.data()),
|
| - framer.GetDataFrameMinimumSize(),
|
| - IsSpdy3() ? kV3FrameData : kH2FrameData,
|
| + framer.GetDataFrameMinimumSize(), kH2FrameData,
|
| framer.GetDataFrameMinimumSize());
|
| }
|
|
|
| {
|
| const char kDescription[] = "'hello' data frame with more padding, no FIN";
|
| - // clang-format off
|
| - const unsigned char kV3FrameData[] = {
|
| - 0x00, 0x00, 0x00, 0x01,
|
| - 0x00, 0x00, 0x00, 0x05,
|
| - 'h', 'e', 'l', 'l',
|
| - 'o'
|
| - };
|
| - // frame-format off
|
| const unsigned char kH2FrameData[] = {
|
| 0x00, 0x00, 0xfd, // Length: 253
|
| 0x00, // Type: DATA
|
| 0x08, // Flags: PADDED
|
| 0x00, 0x00, 0x00, 0x01, // Stream: 1
|
| 0xf7, // PadLen: 247 trailing bytes
|
| - 'h', 'e', 'l', 'l', // Payload
|
| + 'h', 'e', 'l', 'l', // Payload
|
| 'o', //
|
| // Padding of 247 0x00(s).
|
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| @@ -2060,30 +1564,17 @@ TEST_P(SpdyFramerTest, CreateDataFrame) {
|
| // bytes.
|
| data_ir.set_padding_len(248);
|
| SpdySerializedFrame frame(framer.SerializeData(data_ir));
|
| - if (IsSpdy3()) {
|
| - CompareFrame(kDescription, frame, kV3FrameData, arraysize(kV3FrameData));
|
| - } else {
|
| - CompareFrame(kDescription, frame, kH2FrameData, arraysize(kH2FrameData));
|
| - }
|
| + CompareFrame(kDescription, frame, kH2FrameData, arraysize(kH2FrameData));
|
|
|
| frame = framer.SerializeDataFrameHeaderWithPaddingLengthField(data_ir);
|
| CompareCharArraysWithHexError(
|
| kDescription, reinterpret_cast<const unsigned char*>(frame.data()),
|
| - framer.GetDataFrameMinimumSize(),
|
| - IsSpdy3() ? kV3FrameData : kH2FrameData,
|
| + framer.GetDataFrameMinimumSize(), kH2FrameData,
|
| framer.GetDataFrameMinimumSize());
|
| }
|
|
|
| {
|
| const char kDescription[] = "'hello' data frame with few padding, no FIN";
|
| - // clang-format off
|
| - const unsigned char kV3FrameData[] = {
|
| - 0x00, 0x00, 0x00, 0x01,
|
| - 0x00, 0x00, 0x00, 0x05,
|
| - 'h', 'e', 'l', 'l',
|
| - 'o'
|
| - };
|
| - // clang-format on
|
| // frame-format off
|
| const unsigned char kH2FrameData[] = {
|
| 0x00, 0x00, 0x0d, // Length: 13
|
| @@ -2103,25 +1594,12 @@ TEST_P(SpdyFramerTest, CreateDataFrame) {
|
| // 7 zeros and the pad length field make the overall padding to be 8 bytes.
|
| data_ir.set_padding_len(8);
|
| SpdySerializedFrame frame(framer.SerializeData(data_ir));
|
| - if (IsSpdy3()) {
|
| - CompareFrame(kDescription, frame, kV3FrameData, arraysize(kV3FrameData));
|
| - } else {
|
| - CompareFrame(kDescription, frame, kH2FrameData, arraysize(kH2FrameData));
|
| - }
|
| + CompareFrame(kDescription, frame, kH2FrameData, arraysize(kH2FrameData));
|
| }
|
|
|
| {
|
| const char kDescription[] =
|
| "'hello' data frame with 1 byte padding, no FIN";
|
| - // clang-format off
|
| - const unsigned char kV3FrameData[] = {
|
| - 0x00, 0x00, 0x00, 0x01,
|
| - 0x00, 0x00, 0x00, 0x05,
|
| - 'h', 'e', 'l', 'l',
|
| - 'o'
|
| - };
|
| - // clang-format on
|
| -
|
| // frame-format off
|
| const unsigned char kH2FrameData[] = {
|
| 0x00, 0x00, 0x06, // Length: 6
|
| @@ -2140,29 +1618,17 @@ TEST_P(SpdyFramerTest, CreateDataFrame) {
|
| // payload is needed.
|
| data_ir.set_padding_len(1);
|
| SpdySerializedFrame frame(framer.SerializeData(data_ir));
|
| - if (IsSpdy3()) {
|
| - CompareFrame(kDescription, frame, kV3FrameData, arraysize(kV3FrameData));
|
| - } else {
|
| - CompareFrame(kDescription, frame, kH2FrameData, arraysize(kH2FrameData));
|
| - }
|
| + CompareFrame(kDescription, frame, kH2FrameData, arraysize(kH2FrameData));
|
|
|
| frame = framer.SerializeDataFrameHeaderWithPaddingLengthField(data_ir);
|
| CompareCharArraysWithHexError(
|
| kDescription, reinterpret_cast<const unsigned char*>(frame.data()),
|
| - framer.GetDataFrameMinimumSize(),
|
| - IsSpdy3() ? kV3FrameData : kH2FrameData,
|
| + framer.GetDataFrameMinimumSize(), kH2FrameData,
|
| framer.GetDataFrameMinimumSize());
|
| }
|
|
|
| {
|
| const char kDescription[] = "Data frame with negative data byte, no FIN";
|
| - // clang-format off
|
| - const unsigned char kV3FrameData[] = {
|
| - 0x00, 0x00, 0x00, 0x01,
|
| - 0x00, 0x00, 0x00, 0x01,
|
| - 0xff
|
| - };
|
| - // clang-format on
|
| const unsigned char kH2FrameData[] = {
|
| 0x00, 0x00, 0x01, // Length: 1
|
| 0x00, // Type: DATA
|
| @@ -2172,23 +1638,11 @@ TEST_P(SpdyFramerTest, CreateDataFrame) {
|
| };
|
| SpdyDataIR data_ir(1, "\xff");
|
| SpdySerializedFrame frame(framer.SerializeData(data_ir));
|
| - if (IsSpdy3()) {
|
| - CompareFrame(kDescription, frame, kV3FrameData, arraysize(kV3FrameData));
|
| - } else {
|
| - CompareFrame(kDescription, frame, kH2FrameData, arraysize(kH2FrameData));
|
| - }
|
| + CompareFrame(kDescription, frame, kH2FrameData, arraysize(kH2FrameData));
|
| }
|
|
|
| {
|
| const char kDescription[] = "'hello' data frame, with FIN";
|
| - // clang-format off
|
| - const unsigned char kV3FrameData[] = {
|
| - 0x00, 0x00, 0x00, 0x01,
|
| - 0x01, 0x00, 0x00, 0x05,
|
| - 'h', 'e', 'l', 'l',
|
| - 'o'
|
| - };
|
| - // clang-format on
|
| const unsigned char kH2FrameData[] = {
|
| 0x00, 0x00, 0x05, // Length: 5
|
| 0x00, // Type: DATA
|
| @@ -2200,21 +1654,11 @@ TEST_P(SpdyFramerTest, CreateDataFrame) {
|
| SpdyDataIR data_ir(1, "hello");
|
| data_ir.set_fin(true);
|
| SpdySerializedFrame frame(framer.SerializeData(data_ir));
|
| - if (IsSpdy3()) {
|
| - CompareFrame(kDescription, frame, kV3FrameData, arraysize(kV3FrameData));
|
| - } else {
|
| - CompareFrame(kDescription, frame, kH2FrameData, arraysize(kH2FrameData));
|
| - }
|
| + CompareFrame(kDescription, frame, kH2FrameData, arraysize(kH2FrameData));
|
| }
|
|
|
| {
|
| const char kDescription[] = "Empty data frame";
|
| - // clang-format off
|
| - const unsigned char kV3FrameData[] = {
|
| - 0x00, 0x00, 0x00, 0x01,
|
| - 0x00, 0x00, 0x00, 0x00,
|
| - };
|
| - // clang-format on
|
| const unsigned char kH2FrameData[] = {
|
| 0x00, 0x00, 0x00, // Length: 0
|
| 0x00, // Type: DATA
|
| @@ -2223,30 +1667,17 @@ TEST_P(SpdyFramerTest, CreateDataFrame) {
|
| };
|
| SpdyDataIR data_ir(1, "");
|
| SpdySerializedFrame frame(framer.SerializeData(data_ir));
|
| - if (IsSpdy3()) {
|
| - CompareFrame(kDescription, frame, kV3FrameData, arraysize(kV3FrameData));
|
| - } else {
|
| - CompareFrame(kDescription, frame, kH2FrameData, arraysize(kH2FrameData));
|
| - }
|
| + CompareFrame(kDescription, frame, kH2FrameData, arraysize(kH2FrameData));
|
|
|
| frame = framer.SerializeDataFrameHeaderWithPaddingLengthField(data_ir);
|
| CompareCharArraysWithHexError(
|
| kDescription, reinterpret_cast<const unsigned char*>(frame.data()),
|
| - framer.GetDataFrameMinimumSize(),
|
| - IsSpdy3() ? kV3FrameData : kH2FrameData,
|
| + framer.GetDataFrameMinimumSize(), kH2FrameData,
|
| framer.GetDataFrameMinimumSize());
|
| }
|
|
|
| {
|
| const char kDescription[] = "Data frame with max stream ID";
|
| - // clang-format off
|
| - const unsigned char kV3FrameData[] = {
|
| - 0x7f, 0xff, 0xff, 0xff,
|
| - 0x01, 0x00, 0x00, 0x05,
|
| - 'h', 'e', 'l', 'l',
|
| - 'o'
|
| - };
|
| - // clang-format on
|
| const unsigned char kH2FrameData[] = {
|
| 0x00, 0x00, 0x05, // Length: 5
|
| 0x00, // Type: DATA
|
| @@ -2258,429 +1689,29 @@ TEST_P(SpdyFramerTest, CreateDataFrame) {
|
| SpdyDataIR data_ir(0x7fffffff, "hello");
|
| data_ir.set_fin(true);
|
| SpdySerializedFrame frame(framer.SerializeData(data_ir));
|
| - if (IsSpdy3()) {
|
| - CompareFrame(kDescription, frame, kV3FrameData, arraysize(kV3FrameData));
|
| - } else {
|
| - CompareFrame(kDescription, frame, kH2FrameData, arraysize(kH2FrameData));
|
| - }
|
| - }
|
| -
|
| - if (!IsHttp2()) {
|
| - // This test does not apply to HTTP/2 because the max frame size is smaller
|
| - // than 4MB.
|
| - const char kDescription[] = "Large data frame";
|
| - const int kDataSize = 4 * 1024 * 1024; // 4 MB
|
| - const string kData(kDataSize, 'A');
|
| - // clang-format off
|
| - const unsigned char kFrameHeader[] = {
|
| - 0x00, 0x00, 0x00, 0x01,
|
| - 0x01, 0x40, 0x00, 0x00,
|
| - };
|
| - // clang-format on
|
| -
|
| - const int kFrameSize = arraysize(kFrameHeader) + kDataSize;
|
| - std::unique_ptr<unsigned char[]> expected_frame_data(
|
| - new unsigned char[kFrameSize]);
|
| - memcpy(expected_frame_data.get(), kFrameHeader, arraysize(kFrameHeader));
|
| - memset(expected_frame_data.get() + arraysize(kFrameHeader), 'A', kDataSize);
|
| -
|
| - SpdyDataIR data_ir(1, kData);
|
| - data_ir.set_fin(true);
|
| - SpdySerializedFrame frame(framer.SerializeData(data_ir));
|
| - CompareFrame(kDescription, frame, expected_frame_data.get(), kFrameSize);
|
| + CompareFrame(kDescription, frame, kH2FrameData, arraysize(kH2FrameData));
|
| }
|
| }
|
|
|
| -TEST_P(SpdyFramerTest, CreateSynStreamUncompressed) {
|
| - if (!IsSpdy3()) {
|
| - return;
|
| - }
|
| -
|
| +TEST_P(SpdyFramerTest, CreateRstStream) {
|
| SpdyFramer framer(spdy_version_);
|
| - framer.set_enable_compression(false);
|
|
|
| {
|
| - const char kDescription[] = "SYN_STREAM frame, lowest pri, no FIN";
|
| -
|
| - // clang-format off
|
| - const unsigned char kV3FrameData[] = {
|
| - 0x80, 0x03, 0x00, 0x01,
|
| - 0x00, 0x00, 0x00, 0x2a,
|
| - 0x00, 0x00, 0x00, 0x01,
|
| - 0x00, 0x00, 0x00, 0x00,
|
| - 0xE0, 0x00, 0x00, 0x00,
|
| - 0x00, 0x02, 0x00, 0x00,
|
| - 0x00, 0x03, 'b', 'a',
|
| - 'r', 0x00, 0x00, 0x00,
|
| - 0x03, 'f', 'o', 'o',
|
| - 0x00, 0x00, 0x00, 0x03,
|
| - 'f', 'o', 'o', 0x00,
|
| - 0x00, 0x00, 0x03, 'b',
|
| - 'a', 'r'
|
| + const char kDescription[] = "RST_STREAM frame";
|
| + const unsigned char kH2FrameData[] = {
|
| + 0x00, 0x00, 0x04, // Length: 4
|
| + 0x03, // Type: RST_STREAM
|
| + 0x00, // Flags: none
|
| + 0x00, 0x00, 0x00, 0x01, // Stream: 1
|
| + 0x00, 0x00, 0x00, 0x01, // Error: PROTOCOL_ERROR
|
| };
|
| - // clang-format on
|
| - SpdySynStreamIR syn_stream(1);
|
| - syn_stream.set_priority(framer.GetLowestPriority());
|
| - syn_stream.SetHeader("bar", "foo");
|
| - syn_stream.SetHeader("foo", "bar");
|
| - SpdySerializedFrame frame(framer.SerializeSynStream(syn_stream));
|
| - if (IsSpdy3()) {
|
| - CompareFrame(kDescription, frame, kV3FrameData, arraysize(kV3FrameData));
|
| - } else {
|
| - LOG(FATAL) << "Unsupported version in test.";
|
| - }
|
| - }
|
| -
|
| - {
|
| - const char kDescription[] =
|
| - "SYN_STREAM frame with a 0-length header name, highest pri, FIN, "
|
| - "max stream ID";
|
| -
|
| - // clang-format off
|
| - const unsigned char kV3FrameData[] = {
|
| - 0x80, 0x03, 0x00, 0x01,
|
| - 0x01, 0x00, 0x00, 0x27,
|
| - 0x7f, 0xff, 0xff, 0xff,
|
| - 0x7f, 0xff, 0xff, 0xff,
|
| - 0x00, 0x00, 0x00, 0x00,
|
| - 0x00, 0x02, 0x00, 0x00,
|
| - 0x00, 0x00, 0x00, 0x00,
|
| - 0x00, 0x03, 'f', 'o',
|
| - 'o', 0x00, 0x00, 0x00,
|
| - 0x03, 'f', 'o', 'o',
|
| - 0x00, 0x00, 0x00, 0x03,
|
| - 'b', 'a', 'r'
|
| - };
|
| - // clang-format on
|
| - SpdySynStreamIR syn_stream(0x7fffffff);
|
| - syn_stream.set_associated_to_stream_id(0x7fffffff);
|
| - syn_stream.set_priority(framer.GetHighestPriority());
|
| - syn_stream.set_fin(true);
|
| - syn_stream.SetHeader("", "foo");
|
| - syn_stream.SetHeader("foo", "bar");
|
| - SpdySerializedFrame frame(framer.SerializeSynStream(syn_stream));
|
| - if (IsSpdy3()) {
|
| - CompareFrame(kDescription, frame, kV3FrameData, arraysize(kV3FrameData));
|
| - } else {
|
| - LOG(FATAL) << "Unsupported version in test.";
|
| - }
|
| - }
|
| -
|
| - {
|
| - const char kDescription[] =
|
| - "SYN_STREAM frame with a 0-length header val, high pri, FIN, "
|
| - "max stream ID";
|
| -
|
| - // clang-format off
|
| - const unsigned char kV3FrameData[] = {
|
| - 0x80, 0x03, 0x00, 0x01,
|
| - 0x01, 0x00, 0x00, 0x27,
|
| - 0x7f, 0xff, 0xff, 0xff,
|
| - 0x7f, 0xff, 0xff, 0xff,
|
| - 0x20, 0x00, 0x00, 0x00,
|
| - 0x00, 0x02, 0x00, 0x00,
|
| - 0x00, 0x03, 'b', 'a',
|
| - 'r', 0x00, 0x00, 0x00,
|
| - 0x03, 'f', 'o', 'o',
|
| - 0x00, 0x00, 0x00, 0x03,
|
| - 'f', 'o', 'o', 0x00,
|
| - 0x00, 0x00, 0x00
|
| - };
|
| - // clang-format on
|
| - SpdySynStreamIR syn_stream(0x7fffffff);
|
| - syn_stream.set_associated_to_stream_id(0x7fffffff);
|
| - syn_stream.set_priority(1);
|
| - syn_stream.set_fin(true);
|
| - syn_stream.SetHeader("bar", "foo");
|
| - syn_stream.SetHeader("foo", "");
|
| - SpdySerializedFrame frame(framer.SerializeSynStream(syn_stream));
|
| - if (IsSpdy3()) {
|
| - CompareFrame(kDescription, frame, kV3FrameData, arraysize(kV3FrameData));
|
| - } else {
|
| - LOG(FATAL) << "Unsupported version in test.";
|
| - }
|
| - }
|
| -}
|
| -
|
| -// TODO(phajdan.jr): Clean up after we no longer need
|
| -// to workaround http://crbug.com/139744.
|
| -#if !defined(USE_SYSTEM_ZLIB)
|
| -TEST_P(SpdyFramerTest, CreateSynStreamCompressed) {
|
| - if (!IsSpdy3()) {
|
| - return;
|
| - }
|
| -
|
| - SpdyFramer framer(spdy_version_);
|
| - framer.set_enable_compression(true);
|
| -
|
| - {
|
| - const char kDescription[] = "SYN_STREAM frame, low pri, no FIN";
|
| -
|
| - // clang-format off
|
| - const unsigned char kV3FrameData[] = {
|
| - 0x80, 0x03, 0x00, 0x01,
|
| - 0x00, 0x00, 0x00, 0x36,
|
| - 0x00, 0x00, 0x00, 0x01,
|
| - 0x00, 0x00, 0x00, 0x00,
|
| - 0x80, 0x00, 0x38, 0xEA,
|
| - 0xE3, 0xC6, 0xA7, 0xC2,
|
| - 0x02, 0xE5, 0x0E, 0x50,
|
| - 0xC2, 0x4B, 0x4A, 0x04,
|
| - 0xE5, 0x0B, 0x66, 0x80,
|
| - 0x00, 0x4A, 0xCB, 0xCF,
|
| - 0x07, 0x08, 0x20, 0x10,
|
| - 0x95, 0x96, 0x9F, 0x0F,
|
| - 0xA2, 0x00, 0x02, 0x28,
|
| - 0x29, 0xB1, 0x08, 0x20,
|
| - 0x00, 0x00, 0x00, 0x00,
|
| - 0xFF, 0xFF,
|
| - };
|
| - const unsigned char kV3SIMDFrameData[] = {
|
| - 0x80, 0x03, 0x00, 0x01,
|
| - 0x00, 0x00, 0x00, 0x31,
|
| - 0x00, 0x00, 0x00, 0x01,
|
| - 0x00, 0x00, 0x00, 0x00,
|
| - 0x80, 0x00, 0x38, 0xea,
|
| - 0xe3, 0xc6, 0xa7, 0xc2,
|
| - 0x02, 0xe5, 0x0e, 0x50,
|
| - 0xc2, 0x4b, 0x4a, 0x04,
|
| - 0xe5, 0x0b, 0x66, 0x80,
|
| - 0x00, 0x4a, 0xcb, 0xcf,
|
| - 0x07, 0x08, 0x20, 0x24,
|
| - 0x0a, 0x20, 0x80, 0x92,
|
| - 0x12, 0x8b, 0x00, 0x02,
|
| - 0x00, 0x00, 0x00, 0xff,
|
| - 0xff,
|
| - };
|
| - // clang-format on
|
| -
|
| - SpdySynStreamIR syn_stream(1);
|
| - syn_stream.set_priority(4);
|
| - syn_stream.SetHeader("bar", "foo");
|
| - syn_stream.SetHeader("foo", "bar");
|
| - SpdySerializedFrame frame(framer.SerializeSynStream(syn_stream));
|
| - const unsigned char* frame_data =
|
| - reinterpret_cast<const unsigned char*>(frame.data());
|
| - if (IsSpdy3()) {
|
| - if (memcmp(frame_data, kV3SIMDFrameData,
|
| - std::min(arraysize(kV3SIMDFrameData), frame.size())) != 0) {
|
| - CompareCharArraysWithHexError(kDescription, frame_data, frame.size(),
|
| - kV3FrameData, arraysize(kV3FrameData));
|
| - }
|
| - } else {
|
| - LOG(FATAL) << "Unsupported version in test.";
|
| - }
|
| - }
|
| -}
|
| -#endif // !defined(USE_SYSTEM_ZLIB)
|
| -
|
| -TEST_P(SpdyFramerTest, CreateSynReplyUncompressed) {
|
| - if (!IsSpdy3()) {
|
| - return;
|
| - }
|
| -
|
| - SpdyFramer framer(spdy_version_);
|
| - framer.set_enable_compression(false);
|
| -
|
| - {
|
| - const char kDescription[] = "SYN_REPLY frame, no FIN";
|
| -
|
| - // clang-format off
|
| - const unsigned char kV3FrameData[] = {
|
| - 0x80, 0x03, 0x00, 0x02,
|
| - 0x00, 0x00, 0x00, 0x24,
|
| - 0x00, 0x00, 0x00, 0x01,
|
| - 0x00, 0x00, 0x00, 0x02,
|
| - 0x00, 0x00, 0x00, 0x03,
|
| - 'b', 'a', 'r', 0x00,
|
| - 0x00, 0x00, 0x03, 'f',
|
| - 'o', 'o', 0x00, 0x00,
|
| - 0x00, 0x03, 'f', 'o',
|
| - 'o', 0x00, 0x00, 0x00,
|
| - 0x03, 'b', 'a', 'r'
|
| - };
|
| - // clang-format on
|
| - SpdySynReplyIR syn_reply(1);
|
| - syn_reply.SetHeader("bar", "foo");
|
| - syn_reply.SetHeader("foo", "bar");
|
| - SpdySerializedFrame frame(framer.SerializeSynReply(syn_reply));
|
| - if (IsSpdy3()) {
|
| - CompareFrame(kDescription, frame, kV3FrameData, arraysize(kV3FrameData));
|
| - } else {
|
| - LOG(FATAL) << "Unsupported version in test.";
|
| - }
|
| - }
|
| -
|
| - {
|
| - const char kDescription[] =
|
| - "SYN_REPLY frame with a 0-length header name, FIN, max stream ID";
|
| -
|
| - // clang-format off
|
| - const unsigned char kV3FrameData[] = {
|
| - 0x80, 0x03, 0x00, 0x02,
|
| - 0x01, 0x00, 0x00, 0x21,
|
| - 0x7f, 0xff, 0xff, 0xff,
|
| - 0x00, 0x00, 0x00, 0x02,
|
| - 0x00, 0x00, 0x00, 0x00,
|
| - 0x00, 0x00, 0x00, 0x03,
|
| - 'f', 'o', 'o', 0x00,
|
| - 0x00, 0x00, 0x03, 'f',
|
| - 'o', 'o', 0x00, 0x00,
|
| - 0x00, 0x03, 'b', 'a',
|
| - 'r'
|
| - };
|
| - // clang-format on
|
| - SpdySynReplyIR syn_reply(0x7fffffff);
|
| - syn_reply.set_fin(true);
|
| - syn_reply.SetHeader("", "foo");
|
| - syn_reply.SetHeader("foo", "bar");
|
| - SpdySerializedFrame frame(framer.SerializeSynReply(syn_reply));
|
| - if (IsSpdy3()) {
|
| - CompareFrame(kDescription, frame, kV3FrameData, arraysize(kV3FrameData));
|
| - } else {
|
| - LOG(FATAL) << "Unsupported version in test.";
|
| - }
|
| - }
|
| -
|
| - {
|
| - const char kDescription[] =
|
| - "SYN_REPLY frame with a 0-length header val, FIN, max stream ID";
|
| -
|
| - // clang-format off
|
| - const unsigned char kV3FrameData[] = {
|
| - 0x80, 0x03, 0x00, 0x02,
|
| - 0x01, 0x00, 0x00, 0x21,
|
| - 0x7f, 0xff, 0xff, 0xff,
|
| - 0x00, 0x00, 0x00, 0x02,
|
| - 0x00, 0x00, 0x00, 0x03,
|
| - 'b', 'a', 'r', 0x00,
|
| - 0x00, 0x00, 0x03, 'f',
|
| - 'o', 'o', 0x00, 0x00,
|
| - 0x00, 0x03, 'f', 'o',
|
| - 'o', 0x00, 0x00, 0x00,
|
| - 0x00
|
| - };
|
| - // clang-format on
|
| - SpdySynReplyIR syn_reply(0x7fffffff);
|
| - syn_reply.set_fin(true);
|
| - syn_reply.SetHeader("bar", "foo");
|
| - syn_reply.SetHeader("foo", "");
|
| - SpdySerializedFrame frame(framer.SerializeSynReply(syn_reply));
|
| - if (IsSpdy3()) {
|
| - CompareFrame(kDescription, frame, kV3FrameData, arraysize(kV3FrameData));
|
| - } else {
|
| - LOG(FATAL) << "Unsupported version in test.";
|
| - }
|
| - }
|
| -}
|
| -
|
| -// TODO(phajdan.jr): Clean up after we no longer need
|
| -// to workaround http://crbug.com/139744.
|
| -#if !defined(USE_SYSTEM_ZLIB)
|
| -TEST_P(SpdyFramerTest, CreateSynReplyCompressed) {
|
| - if (!IsSpdy3()) {
|
| - return;
|
| - }
|
| -
|
| - SpdyFramer framer(spdy_version_);
|
| - framer.set_enable_compression(true);
|
| -
|
| - {
|
| - const char kDescription[] = "SYN_REPLY frame, no FIN";
|
| -
|
| - // clang-format off
|
| - const unsigned char kV3FrameData[] = {
|
| - 0x80, 0x03, 0x00, 0x02,
|
| - 0x00, 0x00, 0x00, 0x30,
|
| - 0x00, 0x00, 0x00, 0x01,
|
| - 0x38, 0xea, 0xe3, 0xc6,
|
| - 0xa7, 0xc2, 0x02, 0xe5,
|
| - 0x0e, 0x50, 0xc2, 0x4b,
|
| - 0x4a, 0x04, 0xe5, 0x0b,
|
| - 0x66, 0x80, 0x00, 0x4a,
|
| - 0xcb, 0xcf, 0x07, 0x08,
|
| - 0x20, 0x10, 0x95, 0x96,
|
| - 0x9f, 0x0f, 0xa2, 0x00,
|
| - 0x02, 0x28, 0x29, 0xb1,
|
| - 0x08, 0x20, 0x00, 0x00,
|
| - 0x00, 0x00, 0xff, 0xff,
|
| - };
|
| -
|
| - const unsigned char kV3SIMDFrameData[] = {
|
| - 0x80, 0x03, 0x00, 0x02,
|
| - 0x00, 0x00, 0x00, 0x2b,
|
| - 0x00, 0x00, 0x00, 0x01,
|
| - 0x38, 0xea, 0xe3, 0xc6,
|
| - 0xa7, 0xc2, 0x02, 0xe5,
|
| - 0x0e, 0x50, 0xc2, 0x4b,
|
| - 0x4a, 0x04, 0xe5, 0x0b,
|
| - 0x66, 0x80, 0x00, 0x4a,
|
| - 0xcb, 0xcf, 0x07, 0x08,
|
| - 0x20, 0x24, 0x0a, 0x20,
|
| - 0x80, 0x92, 0x12, 0x8b,
|
| - 0x00, 0x02, 0x00, 0x00,
|
| - 0x00, 0xff, 0xff,
|
| - };
|
| - // clang-format on
|
| -
|
| - SpdySynReplyIR syn_reply(1);
|
| - syn_reply.SetHeader("bar", "foo");
|
| - syn_reply.SetHeader("foo", "bar");
|
| - SpdySerializedFrame frame(framer.SerializeSynReply(syn_reply));
|
| - const unsigned char* frame_data =
|
| - reinterpret_cast<const unsigned char*>(frame.data());
|
| - if (IsSpdy3()) {
|
| - if (memcmp(frame_data, kV3SIMDFrameData,
|
| - std::min(arraysize(kV3SIMDFrameData), frame.size())) != 0) {
|
| - CompareCharArraysWithHexError(kDescription, frame_data, frame.size(),
|
| - kV3FrameData, arraysize(kV3FrameData));
|
| - }
|
| - } else {
|
| - LOG(FATAL) << "Unsupported version in test.";
|
| - }
|
| - }
|
| -}
|
| -#endif // !defined(USE_SYSTEM_ZLIB)
|
| -
|
| -TEST_P(SpdyFramerTest, CreateRstStream) {
|
| - SpdyFramer framer(spdy_version_);
|
| -
|
| - {
|
| - const char kDescription[] = "RST_STREAM frame";
|
| - // clang-format off
|
| - const unsigned char kV3FrameData[] = {
|
| - 0x80, 0x03, 0x00, 0x03,
|
| - 0x00, 0x00, 0x00, 0x08,
|
| - 0x00, 0x00, 0x00, 0x01,
|
| - 0x00, 0x00, 0x00, 0x01,
|
| - };
|
| - // clang-format on
|
| - const unsigned char kH2FrameData[] = {
|
| - 0x00, 0x00, 0x04, // Length: 4
|
| - 0x03, // Type: RST_STREAM
|
| - 0x00, // Flags: none
|
| - 0x00, 0x00, 0x00, 0x01, // Stream: 1
|
| - 0x00, 0x00, 0x00, 0x01, // Error: PROTOCOL_ERROR
|
| - };
|
| - SpdyRstStreamIR rst_stream(1, RST_STREAM_PROTOCOL_ERROR);
|
| - SpdySerializedFrame frame(framer.SerializeRstStream(rst_stream));
|
| - if (IsSpdy3()) {
|
| - CompareFrame(kDescription, frame, kV3FrameData, arraysize(kV3FrameData));
|
| - } else {
|
| - CompareFrame(kDescription, frame, kH2FrameData, arraysize(kH2FrameData));
|
| - }
|
| + SpdyRstStreamIR rst_stream(1, RST_STREAM_PROTOCOL_ERROR);
|
| + SpdySerializedFrame frame(framer.SerializeRstStream(rst_stream));
|
| + CompareFrame(kDescription, frame, kH2FrameData, arraysize(kH2FrameData));
|
| }
|
|
|
| {
|
| const char kDescription[] = "RST_STREAM frame with max stream ID";
|
| - // clang-format off
|
| - const unsigned char kV3FrameData[] = {
|
| - 0x80, 0x03, 0x00, 0x03,
|
| - 0x00, 0x00, 0x00, 0x08,
|
| - 0x7f, 0xff, 0xff, 0xff,
|
| - 0x00, 0x00, 0x00, 0x01,
|
| - };
|
| - // clang-format on
|
| const unsigned char kH2FrameData[] = {
|
| 0x00, 0x00, 0x04, // Length: 4
|
| 0x03, // Type: RST_STREAM
|
| @@ -2690,23 +1721,11 @@ TEST_P(SpdyFramerTest, CreateRstStream) {
|
| };
|
| SpdyRstStreamIR rst_stream(0x7FFFFFFF, RST_STREAM_PROTOCOL_ERROR);
|
| SpdySerializedFrame frame(framer.SerializeRstStream(rst_stream));
|
| - if (IsSpdy3()) {
|
| - CompareFrame(kDescription, frame, kV3FrameData, arraysize(kV3FrameData));
|
| - } else {
|
| - CompareFrame(kDescription, frame, kH2FrameData, arraysize(kH2FrameData));
|
| - }
|
| + CompareFrame(kDescription, frame, kH2FrameData, arraysize(kH2FrameData));
|
| }
|
|
|
| {
|
| const char kDescription[] = "RST_STREAM frame with max status code";
|
| - // clang-format off
|
| - const unsigned char kV3FrameData[] = {
|
| - 0x80, 0x03, 0x00, 0x03,
|
| - 0x00, 0x00, 0x00, 0x08,
|
| - 0x7f, 0xff, 0xff, 0xff,
|
| - 0x00, 0x00, 0x00, 0x06,
|
| - };
|
| - // clang-format on
|
| const unsigned char kH2FrameData[] = {
|
| 0x00, 0x00, 0x04, // Length: 4
|
| 0x03, // Type: RST_STREAM
|
| @@ -2716,11 +1735,7 @@ TEST_P(SpdyFramerTest, CreateRstStream) {
|
| };
|
| SpdyRstStreamIR rst_stream(0x7FFFFFFF, RST_STREAM_INTERNAL_ERROR);
|
| SpdySerializedFrame frame(framer.SerializeRstStream(rst_stream));
|
| - if (IsSpdy3()) {
|
| - CompareFrame(kDescription, frame, kV3FrameData, arraysize(kV3FrameData));
|
| - } else {
|
| - CompareFrame(kDescription, frame, kH2FrameData, arraysize(kH2FrameData));
|
| - }
|
| + CompareFrame(kDescription, frame, kH2FrameData, arraysize(kH2FrameData));
|
| }
|
| }
|
|
|
| @@ -2730,15 +1745,6 @@ TEST_P(SpdyFramerTest, CreateSettings) {
|
| {
|
| const char kDescription[] = "Network byte order SETTINGS frame";
|
|
|
| - // clang-format off
|
| - const unsigned char kV3FrameData[] = {
|
| - 0x80, 0x03, 0x00, 0x04,
|
| - 0x00, 0x00, 0x00, 0x0c,
|
| - 0x00, 0x00, 0x00, 0x01,
|
| - 0x01, 0x00, 0x00, 0x07,
|
| - 0x0a, 0x0b, 0x0c, 0x0d,
|
| - };
|
| - // clang-format on
|
| const unsigned char kH2FrameData[] = {
|
| 0x00, 0x00, 0x06, // Length: 6
|
| 0x04, // Type: SETTINGS
|
| @@ -2757,31 +1763,11 @@ TEST_P(SpdyFramerTest, CreateSettings) {
|
| kFlags & SETTINGS_FLAG_PERSISTED, kValue);
|
|
|
| SpdySerializedFrame frame(framer.SerializeSettings(settings_ir));
|
| - if (IsSpdy3()) {
|
| - CompareFrame(kDescription, frame, kV3FrameData, arraysize(kV3FrameData));
|
| - } else {
|
| - CompareFrame(kDescription, frame, kH2FrameData, arraysize(kH2FrameData));
|
| - }
|
| + CompareFrame(kDescription, frame, kH2FrameData, arraysize(kH2FrameData));
|
| }
|
|
|
| {
|
| const char kDescription[] = "Basic SETTINGS frame";
|
| -
|
| - // clang-format off
|
| - const unsigned char kV3FrameData[] = {
|
| - 0x80, 0x03, 0x00, 0x04,
|
| - 0x00, 0x00, 0x00, 0x24,
|
| - 0x00, 0x00, 0x00, 0x04,
|
| - 0x00, 0x00, 0x00, 0x01, // 1st Setting
|
| - 0x00, 0x00, 0x00, 0x05,
|
| - 0x00, 0x00, 0x00, 0x02, // 2nd Setting
|
| - 0x00, 0x00, 0x00, 0x06,
|
| - 0x00, 0x00, 0x00, 0x03, // 3rd Setting
|
| - 0x00, 0x00, 0x00, 0x07,
|
| - 0x00, 0x00, 0x00, 0x04, // 4th Setting
|
| - 0x00, 0x00, 0x00, 0x08,
|
| - };
|
| - // clang-format on
|
| // These end up seemingly out of order because of the way that our internal
|
| // ordering for settings_ir works. HTTP2 has no requirement on ordering on
|
| // the wire.
|
| @@ -2819,23 +1805,12 @@ TEST_P(SpdyFramerTest, CreateSettings) {
|
| 8);
|
| SpdySerializedFrame frame(framer.SerializeSettings(settings_ir));
|
|
|
| - if (IsSpdy3()) {
|
| - CompareFrame(kDescription, frame, kV3FrameData, arraysize(kV3FrameData));
|
| - } else {
|
| - CompareFrame(kDescription, frame, kH2FrameData, arraysize(kH2FrameData));
|
| - }
|
| + CompareFrame(kDescription, frame, kH2FrameData, arraysize(kH2FrameData));
|
| }
|
|
|
| {
|
| const char kDescription[] = "Empty SETTINGS frame";
|
|
|
| - // clang-format off
|
| - const unsigned char kV3FrameData[] = {
|
| - 0x80, 0x03, 0x00, 0x04,
|
| - 0x00, 0x00, 0x00, 0x04,
|
| - 0x00, 0x00, 0x00, 0x00,
|
| - };
|
| - // clang-format on
|
| const unsigned char kH2FrameData[] = {
|
| 0x00, 0x00, 0x00, // Length: 0
|
| 0x04, // Type: SETTINGS
|
| @@ -2844,11 +1819,7 @@ TEST_P(SpdyFramerTest, CreateSettings) {
|
| };
|
| SpdySettingsIR settings_ir;
|
| SpdySerializedFrame frame(framer.SerializeSettings(settings_ir));
|
| - if (IsSpdy3()) {
|
| - CompareFrame(kDescription, frame, kV3FrameData, arraysize(kV3FrameData));
|
| - } else {
|
| - CompareFrame(kDescription, frame, kH2FrameData, arraysize(kH2FrameData));
|
| - }
|
| + CompareFrame(kDescription, frame, kH2FrameData, arraysize(kH2FrameData));
|
| }
|
| }
|
|
|
| @@ -2857,13 +1828,6 @@ TEST_P(SpdyFramerTest, CreatePingFrame) {
|
|
|
| {
|
| const char kDescription[] = "PING frame";
|
| - // clang-format off
|
| - const unsigned char kV3FrameData[] = {
|
| - 0x80, 0x03, 0x00, 0x06,
|
| - 0x00, 0x00, 0x00, 0x04,
|
| - 0x12, 0x34, 0x56, 0x78,
|
| - };
|
| - // clang-format on
|
| const unsigned char kH2FrameData[] = {
|
| 0x00, 0x00, 0x08, // Length: 8
|
| 0x06, // Type: PING
|
| @@ -2881,23 +1845,18 @@ TEST_P(SpdyFramerTest, CreatePingFrame) {
|
| 0x9a, 0xbc, 0xde, 0xff, // Data
|
| };
|
| SpdySerializedFrame frame;
|
| - if (IsSpdy3()) {
|
| - frame = framer.SerializePing(SpdyPingIR(0x12345678ull));
|
| - CompareFrame(kDescription, frame, kV3FrameData, arraysize(kV3FrameData));
|
| - } else {
|
| - const SpdyPingId kPingId = 0x123456789abcdeffULL;
|
| - SpdyPingIR ping_ir(kPingId);
|
| - // Tests SpdyPingIR when the ping is not an ack.
|
| - ASSERT_FALSE(ping_ir.is_ack());
|
| - frame = framer.SerializePing(ping_ir);
|
| - CompareFrame(kDescription, frame, kH2FrameData, arraysize(kH2FrameData));
|
| -
|
| - // Tests SpdyPingIR when the ping is an ack.
|
| - ping_ir.set_is_ack(true);
|
| - frame = framer.SerializePing(ping_ir);
|
| - CompareFrame(kDescription, frame, kH2FrameDataWithAck,
|
| - arraysize(kH2FrameDataWithAck));
|
| - }
|
| + const SpdyPingId kPingId = 0x123456789abcdeffULL;
|
| + SpdyPingIR ping_ir(kPingId);
|
| + // Tests SpdyPingIR when the ping is not an ack.
|
| + ASSERT_FALSE(ping_ir.is_ack());
|
| + frame = framer.SerializePing(ping_ir);
|
| + CompareFrame(kDescription, frame, kH2FrameData, arraysize(kH2FrameData));
|
| +
|
| + // Tests SpdyPingIR when the ping is an ack.
|
| + ping_ir.set_is_ack(true);
|
| + frame = framer.SerializePing(ping_ir);
|
| + CompareFrame(kDescription, frame, kH2FrameDataWithAck,
|
| + arraysize(kH2FrameDataWithAck));
|
| }
|
| }
|
|
|
| @@ -2906,14 +1865,6 @@ TEST_P(SpdyFramerTest, CreateGoAway) {
|
|
|
| {
|
| const char kDescription[] = "GOAWAY frame";
|
| - // clang-format off
|
| - const unsigned char kV3FrameData[] = {
|
| - 0x80, 0x03, 0x00, 0x07,
|
| - 0x00, 0x00, 0x00, 0x08,
|
| - 0x00, 0x00, 0x00, 0x00, // Stream Id
|
| - 0x00, 0x00, 0x00, 0x00, // Status
|
| - };
|
| - // clang-format on
|
| const unsigned char kH2FrameData[] = {
|
| 0x00, 0x00, 0x0a, // Length: 10
|
| 0x07, // Type: GOAWAY
|
| @@ -2925,23 +1876,11 @@ TEST_P(SpdyFramerTest, CreateGoAway) {
|
| };
|
| SpdyGoAwayIR goaway_ir(0, GOAWAY_OK, "GA");
|
| SpdySerializedFrame frame(framer.SerializeGoAway(goaway_ir));
|
| - if (IsSpdy3()) {
|
| - CompareFrame(kDescription, frame, kV3FrameData, arraysize(kV3FrameData));
|
| - } else {
|
| - CompareFrame(kDescription, frame, kH2FrameData, arraysize(kH2FrameData));
|
| - }
|
| + CompareFrame(kDescription, frame, kH2FrameData, arraysize(kH2FrameData));
|
| }
|
|
|
| {
|
| const char kDescription[] = "GOAWAY frame with max stream ID, status";
|
| - // clang-format off
|
| - const unsigned char kV3FrameData[] = {
|
| - 0x80, 0x03, 0x00, 0x07,
|
| - 0x00, 0x00, 0x00, 0x08,
|
| - 0x7f, 0xff, 0xff, 0xff, // Stream Id
|
| - 0x00, 0x00, 0x00, 0x01, // Status: PROTOCOL_ERROR.
|
| - };
|
| - // clang-format on
|
| const unsigned char kH2FrameData[] = {
|
| 0x00, 0x00, 0x0a, // Length: 10
|
| 0x07, // Type: GOAWAY
|
| @@ -2953,11 +1892,7 @@ TEST_P(SpdyFramerTest, CreateGoAway) {
|
| };
|
| SpdyGoAwayIR goaway_ir(0x7FFFFFFF, GOAWAY_INTERNAL_ERROR, "GA");
|
| SpdySerializedFrame frame(framer.SerializeGoAway(goaway_ir));
|
| - if (IsSpdy3()) {
|
| - CompareFrame(kDescription, frame, kV3FrameData, arraysize(kV3FrameData));
|
| - } else {
|
| - CompareFrame(kDescription, frame, kH2FrameData, arraysize(kH2FrameData));
|
| - }
|
| + CompareFrame(kDescription, frame, kH2FrameData, arraysize(kH2FrameData));
|
| }
|
| }
|
|
|
| @@ -2967,22 +1902,6 @@ TEST_P(SpdyFramerTest, CreateHeadersUncompressed) {
|
|
|
| {
|
| const char kDescription[] = "HEADERS frame, no FIN";
|
| -
|
| - // clang-format off
|
| - const unsigned char kV3FrameData[] = {
|
| - 0x80, 0x03, 0x00, 0x08,
|
| - 0x00, 0x00, 0x00, 0x24,
|
| - 0x00, 0x00, 0x00, 0x01,
|
| - 0x00, 0x00, 0x00, 0x02,
|
| - 0x00, 0x00, 0x00, 0x03,
|
| - 'b', 'a', 'r', 0x00,
|
| - 0x00, 0x00, 0x03, 'f',
|
| - 'o', 'o', 0x00, 0x00,
|
| - 0x00, 0x03, 'f', 'o',
|
| - 'o', 0x00, 0x00, 0x00,
|
| - 0x03, 'b', 'a', 'r'
|
| - };
|
| - // clang-format on
|
| // frame-format off
|
| const unsigned char kH2FrameData[] = {
|
| 0x00, 0x00, 0x12, // Length: 18
|
| @@ -3009,32 +1928,12 @@ TEST_P(SpdyFramerTest, CreateHeadersUncompressed) {
|
| headers.SetHeader("foo", "bar");
|
| SpdySerializedFrame frame(
|
| SpdyFramerPeer::SerializeHeaders(&framer, headers));
|
| - if (IsSpdy3()) {
|
| - CompareFrame(kDescription, frame, kV3FrameData, arraysize(kV3FrameData));
|
| - } else {
|
| - CompareFrame(kDescription, frame, kH2FrameData, arraysize(kH2FrameData));
|
| - }
|
| + CompareFrame(kDescription, frame, kH2FrameData, arraysize(kH2FrameData));
|
| }
|
|
|
| {
|
| const char kDescription[] =
|
| "HEADERS frame with a 0-length header name, FIN, max stream ID";
|
| -
|
| - // clang-format off
|
| - const unsigned char kV3FrameData[] = {
|
| - 0x80, 0x03, 0x00, 0x08,
|
| - 0x01, 0x00, 0x00, 0x21,
|
| - 0x7f, 0xff, 0xff, 0xff,
|
| - 0x00, 0x00, 0x00, 0x02,
|
| - 0x00, 0x00, 0x00, 0x00,
|
| - 0x00, 0x00, 0x00, 0x03,
|
| - 'f', 'o', 'o', 0x00,
|
| - 0x00, 0x00, 0x03, 'f',
|
| - 'o', 'o', 0x00, 0x00,
|
| - 0x00, 0x03, 'b', 'a',
|
| - 'r'
|
| - };
|
| - // clang-format on
|
| // frame-format off
|
| const unsigned char kH2FrameData[] = {
|
| 0x00, 0x00, 0x0f, // Length: 15
|
| @@ -3060,32 +1959,12 @@ TEST_P(SpdyFramerTest, CreateHeadersUncompressed) {
|
| headers.SetHeader("foo", "bar");
|
| SpdySerializedFrame frame(
|
| SpdyFramerPeer::SerializeHeaders(&framer, headers));
|
| - if (IsSpdy3()) {
|
| - CompareFrame(kDescription, frame, kV3FrameData, arraysize(kV3FrameData));
|
| - } else {
|
| - CompareFrame(kDescription, frame, kH2FrameData, arraysize(kH2FrameData));
|
| - }
|
| + CompareFrame(kDescription, frame, kH2FrameData, arraysize(kH2FrameData));
|
| }
|
|
|
| {
|
| const char kDescription[] =
|
| "HEADERS frame with a 0-length header val, FIN, max stream ID";
|
| -
|
| - // clang-format off
|
| - const unsigned char kV3FrameData[] = {
|
| - 0x80, 0x03, 0x00, 0x08,
|
| - 0x01, 0x00, 0x00, 0x21,
|
| - 0x7f, 0xff, 0xff, 0xff,
|
| - 0x00, 0x00, 0x00, 0x02,
|
| - 0x00, 0x00, 0x00, 0x03,
|
| - 'b', 'a', 'r', 0x00,
|
| - 0x00, 0x00, 0x03, 'f',
|
| - 'o', 'o', 0x00, 0x00,
|
| - 0x00, 0x03, 'f', 'o',
|
| - 'o', 0x00, 0x00, 0x00,
|
| - 0x00
|
| - };
|
| - // clang-format on
|
| // frame-format off
|
| const unsigned char kH2FrameData[] = {
|
| 0x00, 0x00, 0x0f, // Length: 15
|
| @@ -3111,11 +1990,7 @@ TEST_P(SpdyFramerTest, CreateHeadersUncompressed) {
|
| headers_ir.SetHeader("foo", "");
|
| SpdySerializedFrame frame(
|
| SpdyFramerPeer::SerializeHeaders(&framer, headers_ir));
|
| - if (IsSpdy3()) {
|
| - CompareFrame(kDescription, frame, kV3FrameData, arraysize(kV3FrameData));
|
| - } else {
|
| - CompareFrame(kDescription, frame, kH2FrameData, arraysize(kH2FrameData));
|
| - }
|
| + CompareFrame(kDescription, frame, kH2FrameData, arraysize(kH2FrameData));
|
| }
|
|
|
| {
|
| @@ -3151,11 +2026,7 @@ TEST_P(SpdyFramerTest, CreateHeadersUncompressed) {
|
| headers_ir.SetHeader("foo", "");
|
| SpdySerializedFrame frame(
|
| SpdyFramerPeer::SerializeHeaders(&framer, headers_ir));
|
| - if (IsSpdy3()) {
|
| - // HEADERS with priority not supported.
|
| - } else {
|
| - CompareFrame(kDescription, frame, kH2FrameData, arraysize(kH2FrameData));
|
| - }
|
| + CompareFrame(kDescription, frame, kH2FrameData, arraysize(kH2FrameData));
|
| }
|
|
|
| {
|
| @@ -3194,11 +2065,7 @@ TEST_P(SpdyFramerTest, CreateHeadersUncompressed) {
|
| headers_ir.SetHeader("foo", "");
|
| SpdySerializedFrame frame(
|
| SpdyFramerPeer::SerializeHeaders(&framer, headers_ir));
|
| - if (IsSpdy3()) {
|
| - // HEADERS with priority not supported.
|
| - } else {
|
| - CompareFrame(kDescription, frame, kV4FrameData, arraysize(kV4FrameData));
|
| - }
|
| + CompareFrame(kDescription, frame, kV4FrameData, arraysize(kV4FrameData));
|
| }
|
|
|
| {
|
| @@ -3237,11 +2104,7 @@ TEST_P(SpdyFramerTest, CreateHeadersUncompressed) {
|
| headers_ir.SetHeader("foo", "");
|
| SpdySerializedFrame frame(
|
| SpdyFramerPeer::SerializeHeaders(&framer, headers_ir));
|
| - if (IsSpdy3()) {
|
| - // HEADERS with priority not supported.
|
| - } else {
|
| - CompareFrame(kDescription, frame, kV4FrameData, arraysize(kV4FrameData));
|
| - }
|
| + CompareFrame(kDescription, frame, kV4FrameData, arraysize(kV4FrameData));
|
| }
|
|
|
| {
|
| @@ -3278,11 +2141,7 @@ TEST_P(SpdyFramerTest, CreateHeadersUncompressed) {
|
| headers_ir.set_padding_len(6);
|
| SpdySerializedFrame frame(
|
| SpdyFramerPeer::SerializeHeaders(&framer, headers_ir));
|
| - if (IsSpdy3()) {
|
| - // Padding is not supported.
|
| - } else {
|
| - CompareFrame(kDescription, frame, kH2FrameData, arraysize(kH2FrameData));
|
| - }
|
| + CompareFrame(kDescription, frame, kH2FrameData, arraysize(kH2FrameData));
|
| }
|
| }
|
|
|
| @@ -3294,58 +2153,12 @@ TEST_P(SpdyFramerTest, CreateHeadersCompressed) {
|
| framer.set_enable_compression(true);
|
|
|
| {
|
| - const char kDescription[] = "HEADERS frame, no FIN";
|
| -
|
| - // clang-format off
|
| - const unsigned char kV3FrameData[] = {
|
| - 0x80, 0x03, 0x00, 0x08,
|
| - 0x00, 0x00, 0x00, 0x30,
|
| - 0x00, 0x00, 0x00, 0x01,
|
| - 0x38, 0xea, 0xe3, 0xc6,
|
| - 0xa7, 0xc2, 0x02, 0xe5,
|
| - 0x0e, 0x50, 0xc2, 0x4b,
|
| - 0x4a, 0x04, 0xe5, 0x0b,
|
| - 0x66, 0x80, 0x00, 0x4a,
|
| - 0xcb, 0xcf, 0x07, 0x08,
|
| - 0x20, 0x10, 0x95, 0x96,
|
| - 0x9f, 0x0f, 0xa2, 0x00,
|
| - 0x02, 0x28, 0x29, 0xb1,
|
| - 0x08, 0x20, 0x00, 0x00,
|
| - 0x00, 0x00, 0xff, 0xff,
|
| - };
|
| - const unsigned char kV3SIMDFrameData[] = {
|
| - 0x80, 0x03, 0x00, 0x08,
|
| - 0x00, 0x00, 0x00, 0x2b,
|
| - 0x00, 0x00, 0x00, 0x01,
|
| - 0x38, 0xea, 0xe3, 0xc6,
|
| - 0xa7, 0xc2, 0x02, 0xe5,
|
| - 0x0e, 0x50, 0xc2, 0x4b,
|
| - 0x4a, 0x04, 0xe5, 0x0b,
|
| - 0x66, 0x80, 0x00, 0x4a,
|
| - 0xcb, 0xcf, 0x07, 0x08,
|
| - 0x20, 0x24, 0x0a, 0x20,
|
| - 0x80, 0x92, 0x12, 0x8b,
|
| - 0x00, 0x02, 0x00, 0x00,
|
| - 0x00, 0xff, 0xff,
|
| - };
|
| - // clang-format on
|
| -
|
| SpdyHeadersIR headers_ir(1);
|
| headers_ir.SetHeader("bar", "foo");
|
| headers_ir.SetHeader("foo", "bar");
|
| SpdySerializedFrame frame(
|
| SpdyFramerPeer::SerializeHeaders(&framer, headers_ir));
|
| - const unsigned char* frame_data =
|
| - reinterpret_cast<const unsigned char*>(frame.data());
|
| - if (IsSpdy3()) {
|
| - if (memcmp(frame_data, kV3SIMDFrameData,
|
| - std::min(arraysize(kV3SIMDFrameData), frame.size())) != 0) {
|
| - CompareCharArraysWithHexError(kDescription, frame_data, frame.size(),
|
| - kV3FrameData, arraysize(kV3FrameData));
|
| - }
|
| - } else {
|
| - // Deflate compression doesn't apply to HPACK.
|
| - }
|
| + // Deflate compression doesn't apply to HPACK.
|
| }
|
| }
|
| #endif // !defined(USE_SYSTEM_ZLIB)
|
| @@ -3355,14 +2168,6 @@ TEST_P(SpdyFramerTest, CreateWindowUpdate) {
|
|
|
| {
|
| const char kDescription[] = "WINDOW_UPDATE frame";
|
| - // clang-format off
|
| - const unsigned char kV3FrameData[] = {
|
| - 0x80, 0x03, 0x00, 0x09,
|
| - 0x00, 0x00, 0x00, 0x08,
|
| - 0x00, 0x00, 0x00, 0x01,
|
| - 0x00, 0x00, 0x00, 0x01,
|
| - };
|
| - // clang-format on
|
| const unsigned char kH2FrameData[] = {
|
| 0x00, 0x00, 0x04, // Length: 4
|
| 0x08, // Type: WINDOW_UPDATE
|
| @@ -3372,23 +2177,11 @@ TEST_P(SpdyFramerTest, CreateWindowUpdate) {
|
| };
|
| SpdySerializedFrame frame(
|
| framer.SerializeWindowUpdate(SpdyWindowUpdateIR(1, 1)));
|
| - if (IsSpdy3()) {
|
| - CompareFrame(kDescription, frame, kV3FrameData, arraysize(kV3FrameData));
|
| - } else {
|
| - CompareFrame(kDescription, frame, kH2FrameData, arraysize(kH2FrameData));
|
| - }
|
| + CompareFrame(kDescription, frame, kH2FrameData, arraysize(kH2FrameData));
|
| }
|
|
|
| {
|
| const char kDescription[] = "WINDOW_UPDATE frame with max stream ID";
|
| - // clang-format off
|
| - const unsigned char kV3FrameData[] = {
|
| - 0x80, 0x03, 0x00, 0x09,
|
| - 0x00, 0x00, 0x00, 0x08,
|
| - 0x7f, 0xff, 0xff, 0xff,
|
| - 0x00, 0x00, 0x00, 0x01,
|
| - };
|
| - // clang-format on
|
| const unsigned char kH2FrameData[] = {
|
| 0x00, 0x00, 0x04, // Length: 4
|
| 0x08, // Type: WINDOW_UPDATE
|
| @@ -3398,23 +2191,11 @@ TEST_P(SpdyFramerTest, CreateWindowUpdate) {
|
| };
|
| SpdySerializedFrame frame(
|
| framer.SerializeWindowUpdate(SpdyWindowUpdateIR(0x7FFFFFFF, 1)));
|
| - if (IsSpdy3()) {
|
| - CompareFrame(kDescription, frame, kV3FrameData, arraysize(kV3FrameData));
|
| - } else {
|
| - CompareFrame(kDescription, frame, kH2FrameData, arraysize(kH2FrameData));
|
| - }
|
| + CompareFrame(kDescription, frame, kH2FrameData, arraysize(kH2FrameData));
|
| }
|
|
|
| {
|
| const char kDescription[] = "WINDOW_UPDATE frame with max window delta";
|
| - // clang-format off
|
| - const unsigned char kV3FrameData[] = {
|
| - 0x80, 0x03, 0x00, 0x09,
|
| - 0x00, 0x00, 0x00, 0x08,
|
| - 0x00, 0x00, 0x00, 0x01,
|
| - 0x7f, 0xff, 0xff, 0xff,
|
| - };
|
| - // clang-format on
|
| const unsigned char kH2FrameData[] = {
|
| 0x00, 0x00, 0x04, // Length: 4
|
| 0x08, // Type: WINDOW_UPDATE
|
| @@ -3424,19 +2205,11 @@ TEST_P(SpdyFramerTest, CreateWindowUpdate) {
|
| };
|
| SpdySerializedFrame frame(
|
| framer.SerializeWindowUpdate(SpdyWindowUpdateIR(1, 0x7FFFFFFF)));
|
| - if (IsSpdy3()) {
|
| - CompareFrame(kDescription, frame, kV3FrameData, arraysize(kV3FrameData));
|
| - } else {
|
| - CompareFrame(kDescription, frame, kH2FrameData, arraysize(kH2FrameData));
|
| - }
|
| + CompareFrame(kDescription, frame, kH2FrameData, arraysize(kH2FrameData));
|
| }
|
| }
|
|
|
| TEST_P(SpdyFramerTest, SerializeBlocked) {
|
| - if (!IsHttp2()) {
|
| - return;
|
| - }
|
| -
|
| SpdyFramer framer(spdy_version_);
|
|
|
| const char kDescription[] = "BLOCKED frame";
|
| @@ -3454,10 +2227,6 @@ TEST_P(SpdyFramerTest, SerializeBlocked) {
|
| }
|
|
|
| TEST_P(SpdyFramerTest, CreateBlocked) {
|
| - if (!IsHttp2()) {
|
| - return;
|
| - }
|
| -
|
| SpdyFramer framer(spdy_version_);
|
|
|
| const char kDescription[] = "BLOCKED frame";
|
| @@ -3472,10 +2241,6 @@ TEST_P(SpdyFramerTest, CreateBlocked) {
|
| }
|
|
|
| TEST_P(SpdyFramerTest, CreatePushPromiseUncompressed) {
|
| - if (!IsHttp2()) {
|
| - return;
|
| - }
|
| -
|
| {
|
| // Test framing PUSH_PROMISE without padding.
|
| SpdyFramer framer(spdy_version_);
|
| @@ -3608,10 +2373,6 @@ TEST_P(SpdyFramerTest, CreatePushPromiseUncompressed) {
|
|
|
| // Regression test for https://crbug.com/464748.
|
| TEST_P(SpdyFramerTest, GetNumberRequiredContinuationFrames) {
|
| - if (!IsHttp2()) {
|
| - return;
|
| - }
|
| -
|
| SpdyFramer framer(spdy_version_);
|
| EXPECT_EQ(1u, SpdyFramerPeer::GetNumberRequiredContinuationFrames(
|
| &framer, 16383 + 16374));
|
| @@ -3624,10 +2385,6 @@ TEST_P(SpdyFramerTest, GetNumberRequiredContinuationFrames) {
|
| }
|
|
|
| TEST_P(SpdyFramerTest, CreateContinuationUncompressed) {
|
| - if (!IsHttp2()) {
|
| - return;
|
| - }
|
| -
|
| SpdyFramer framer(spdy_version_);
|
| framer.set_enable_compression(false);
|
| const char kDescription[] = "CONTINUATION frame";
|
| @@ -3671,10 +2428,6 @@ TEST_P(SpdyFramerTest, CreateContinuationUncompressed) {
|
| // Test that if we send an unexpected CONTINUATION
|
| // we signal an error (but don't crash).
|
| TEST_P(SpdyFramerTest, SendUnexpectedContinuation) {
|
| - if (!IsHttp2()) {
|
| - return;
|
| - }
|
| -
|
| testing::StrictMock<test::MockSpdyFramerVisitor> visitor;
|
| SpdyFramer framer(spdy_version_);
|
| framer.set_visitor(&visitor);
|
| @@ -3711,10 +2464,6 @@ TEST_P(SpdyFramerTest, SendUnexpectedContinuation) {
|
| }
|
|
|
| TEST_P(SpdyFramerTest, CreatePushPromiseThenContinuationUncompressed) {
|
| - if (!IsHttp2()) {
|
| - return;
|
| - }
|
| -
|
| {
|
| // Test framing in a case such that a PUSH_PROMISE frame, with one byte of
|
| // padding, cannot hold all the data payload, which is overflowed to the
|
| @@ -3816,10 +2565,6 @@ TEST_P(SpdyFramerTest, CreatePushPromiseThenContinuationUncompressed) {
|
| }
|
|
|
| TEST_P(SpdyFramerTest, CreateAltSvc) {
|
| - if (!IsHttp2()) {
|
| - return;
|
| - }
|
| -
|
| SpdyFramer framer(spdy_version_);
|
|
|
| const char kDescription[] = "ALTSVC frame";
|
| @@ -3845,10 +2590,6 @@ TEST_P(SpdyFramerTest, CreateAltSvc) {
|
| }
|
|
|
| TEST_P(SpdyFramerTest, CreatePriority) {
|
| - if (!IsHttp2()) {
|
| - return;
|
| - }
|
| -
|
| SpdyFramer framer(spdy_version_);
|
|
|
| const char kDescription[] = "PRIORITY frame";
|
| @@ -3871,46 +2612,6 @@ TEST_P(SpdyFramerTest, CreatePriority) {
|
| CompareFrame(kDescription, frame, kFrameData, arraysize(kFrameData));
|
| }
|
|
|
| -TEST_P(SpdyFramerTest, ReadCompressedSynStreamHeaderBlock) {
|
| - if (!IsSpdy3()) {
|
| - return;
|
| - }
|
| -
|
| - SpdyFramer framer(spdy_version_);
|
| - SpdySynStreamIR syn_stream(1);
|
| - syn_stream.set_priority(1);
|
| - syn_stream.SetHeader("aa", "vv");
|
| - syn_stream.SetHeader("bb", "ww");
|
| - SpdySerializedFrame control_frame(framer.SerializeSynStream(syn_stream));
|
| - TestSpdyVisitor visitor(spdy_version_);
|
| - visitor.use_compression_ = true;
|
| - visitor.SimulateInFramer(
|
| - reinterpret_cast<unsigned char*>(control_frame.data()),
|
| - control_frame.size());
|
| - EXPECT_EQ(1, visitor.syn_frame_count_);
|
| - EXPECT_EQ(syn_stream.header_block(), visitor.headers_);
|
| -}
|
| -
|
| -TEST_P(SpdyFramerTest, ReadCompressedSynReplyHeaderBlock) {
|
| - if (!IsSpdy3()) {
|
| - return;
|
| - }
|
| -
|
| - SpdyFramer framer(spdy_version_);
|
| - SpdySynReplyIR syn_reply(1);
|
| - syn_reply.SetHeader("alpha", "beta");
|
| - syn_reply.SetHeader("gamma", "delta");
|
| - SpdySerializedFrame control_frame(framer.SerializeSynReply(syn_reply));
|
| - TestSpdyVisitor visitor(spdy_version_);
|
| - visitor.use_compression_ = true;
|
| - visitor.SimulateInFramer(
|
| - reinterpret_cast<unsigned char*>(control_frame.data()),
|
| - control_frame.size());
|
| - EXPECT_EQ(1, visitor.syn_reply_frame_count_);
|
| - EXPECT_EQ(0, visitor.headers_frame_count_);
|
| - EXPECT_EQ(syn_reply.header_block(), visitor.headers_);
|
| -}
|
| -
|
| TEST_P(SpdyFramerTest, ReadCompressedHeadersHeaderBlock) {
|
| SpdyFramer framer(spdy_version_);
|
| SpdyHeadersIR headers_ir(1);
|
| @@ -3950,91 +2651,7 @@ TEST_P(SpdyFramerTest, ReadCompressedHeadersHeaderBlockWithHalfClose) {
|
| EXPECT_EQ(headers_ir.header_block(), visitor.headers_);
|
| }
|
|
|
| -TEST_P(SpdyFramerTest, ControlFrameAtMaxSizeLimit) {
|
| - if (!IsSpdy3()) {
|
| - // TODO(jgraettinger): This test setup doesn't work with HPACK.
|
| - return;
|
| - }
|
| -
|
| - // First find the size of the header value in order to just reach the control
|
| - // frame max size.
|
| - SpdyFramer framer(spdy_version_);
|
| - framer.set_enable_compression(false);
|
| - SpdySynStreamIR syn_stream(1);
|
| - syn_stream.set_priority(1);
|
| - syn_stream.SetHeader("aa", "");
|
| - SpdySerializedFrame control_frame(framer.SerializeSynStream(syn_stream));
|
| - const size_t kBigValueSize =
|
| - TestSpdyVisitor::sent_control_frame_max_size() - control_frame.size();
|
| -
|
| - // Create a frame at exactly that size.
|
| - string big_value(kBigValueSize, 'x');
|
| - syn_stream.SetHeader("aa", big_value);
|
| - control_frame = framer.SerializeSynStream(syn_stream);
|
| - EXPECT_EQ(TestSpdyVisitor::sent_control_frame_max_size(),
|
| - control_frame.size());
|
| -
|
| - TestSpdyVisitor visitor(spdy_version_);
|
| - visitor.SimulateInFramer(
|
| - reinterpret_cast<unsigned char*>(control_frame.data()),
|
| - control_frame.size());
|
| - EXPECT_TRUE(visitor.header_buffer_valid_);
|
| - EXPECT_EQ(0, visitor.error_count_);
|
| - EXPECT_EQ(1, visitor.syn_frame_count_);
|
| - EXPECT_EQ(0, visitor.zero_length_control_frame_header_data_count_);
|
| - EXPECT_EQ(0, visitor.end_of_stream_count_);
|
| -}
|
| -
|
| -TEST_P(SpdyFramerTest, ControlFrameTooLarge) {
|
| - if (!IsSpdy3()) {
|
| - // TODO(jgraettinger): This test setup doesn't work with HPACK.
|
| - return;
|
| - }
|
| -
|
| - // First find the size of the header value in order to just reach the control
|
| - // frame max size.
|
| - SpdyFramer framer(spdy_version_);
|
| - framer.set_enable_compression(false);
|
| - SpdySynStreamIR syn_stream(1);
|
| - syn_stream.SetHeader("aa", "");
|
| - syn_stream.set_priority(1);
|
| - SpdySerializedFrame control_frame(framer.SerializeSynStream(syn_stream));
|
| - const size_t kBigValueSize =
|
| - TestSpdyVisitor::received_control_frame_max_size() +
|
| - SpdyConstants::GetFrameHeaderSize(spdy_version_) - control_frame.size() +
|
| - 1;
|
| -
|
| - // Create a frame at exatly that size.
|
| - string big_value(kBigValueSize, 'x');
|
| - syn_stream.SetHeader("aa", big_value);
|
| - if (IsSpdy3()) {
|
| - control_frame = framer.SerializeSynStream(syn_stream);
|
| - } else {
|
| - EXPECT_SPDY_BUG({ control_frame = framer.SerializeSynStream(syn_stream); },
|
| - "Serializing frame over-capacity.");
|
| - }
|
| - EXPECT_EQ(TestSpdyVisitor::received_control_frame_max_size() +
|
| - SpdyConstants::GetFrameHeaderSize(spdy_version_) + 1,
|
| - control_frame.size());
|
| -
|
| - TestSpdyVisitor visitor(spdy_version_);
|
| - visitor.SimulateInFramer(
|
| - reinterpret_cast<unsigned char*>(control_frame.data()),
|
| - control_frame.size());
|
| - EXPECT_FALSE(visitor.header_buffer_valid_);
|
| - EXPECT_EQ(1, visitor.error_count_);
|
| - EXPECT_EQ(SpdyFramer::SPDY_CONTROL_PAYLOAD_TOO_LARGE,
|
| - visitor.framer_.error_code())
|
| - << SpdyFramer::ErrorCodeToString(visitor.framer_.error_code());
|
| - EXPECT_EQ(0, visitor.syn_frame_count_);
|
| - EXPECT_EQ(0u, visitor.header_buffer_length_);
|
| -}
|
| -
|
| TEST_P(SpdyFramerTest, TooLargeHeadersFrameUsesContinuation) {
|
| - if (!IsHttp2()) {
|
| - return;
|
| - }
|
| -
|
| SpdyFramer framer(spdy_version_);
|
| framer.set_enable_compression(false);
|
| SpdyHeadersIR headers(1);
|
| @@ -4062,10 +2679,6 @@ TEST_P(SpdyFramerTest, TooLargeHeadersFrameUsesContinuation) {
|
| }
|
|
|
| TEST_P(SpdyFramerTest, MultipleContinuationFramesWithIterator) {
|
| - if (!IsHttp2()) {
|
| - return;
|
| - }
|
| -
|
| SpdyFramer framer(spdy_version_);
|
| framer.set_enable_compression(false);
|
| auto headers = base::MakeUnique<SpdyHeadersIR>(1);
|
| @@ -4128,10 +2741,6 @@ TEST_P(SpdyFramerTest, MultipleContinuationFramesWithIterator) {
|
| }
|
|
|
| TEST_P(SpdyFramerTest, TooLargePushPromiseFrameUsesContinuation) {
|
| - if (!IsHttp2()) {
|
| - return;
|
| - }
|
| -
|
| SpdyFramer framer(spdy_version_);
|
| framer.set_enable_compression(false);
|
| SpdyPushPromiseIR push_promise(1, 2);
|
| @@ -4184,44 +2793,12 @@ TEST_P(SpdyFramerTest, ControlFrameMuchTooLarge) {
|
| EXPECT_EQ(1, visitor.end_of_stream_count_);
|
| }
|
|
|
| -TEST_P(SpdyFramerTest, DecompressCorruptHeaderBlock) {
|
| - if (!IsSpdy3()) {
|
| - // Deflate compression doesn't apply to HPACK.
|
| - return;
|
| - }
|
| -
|
| - SpdyFramer framer(spdy_version_);
|
| - framer.set_enable_compression(false);
|
| - // Construct a SYN_STREAM control frame without compressing the header block,
|
| - // and have the framer try to decompress it. This will cause the framer to
|
| - // deal with a decompression error.
|
| - SpdySynStreamIR syn_stream(1);
|
| - syn_stream.set_priority(1);
|
| - syn_stream.SetHeader("aa", "alpha beta gamma delta");
|
| - SpdySerializedFrame control_frame(framer.SerializeSynStream(syn_stream));
|
| - TestSpdyVisitor visitor(spdy_version_);
|
| - visitor.use_compression_ = true;
|
| - visitor.SimulateInFramer(
|
| - reinterpret_cast<unsigned char*>(control_frame.data()),
|
| - control_frame.size());
|
| - EXPECT_EQ(1, visitor.error_count_);
|
| - EXPECT_EQ(SpdyFramer::SPDY_DECOMPRESS_FAILURE, visitor.framer_.error_code())
|
| - << SpdyFramer::ErrorCodeToString(visitor.framer_.error_code());
|
| - EXPECT_EQ(0u, visitor.header_buffer_length_);
|
| -}
|
| -
|
| TEST_P(SpdyFramerTest, ControlFrameSizesAreValidated) {
|
| SpdyFramer framer(spdy_version_);
|
| // Create a GoAway frame that has a few extra bytes at the end.
|
| // We create enough overhead to overflow the framer's control frame buffer.
|
| ASSERT_LE(SpdyFramerPeer::ControlFrameBufferSize(), 250u);
|
| const size_t length = SpdyFramerPeer::ControlFrameBufferSize() + 1;
|
| - const unsigned char kV3FrameData[] = {
|
| - 0x80, 0x03, 0x00, 0x07,
|
| - 0x00, 0x00, 0x00, static_cast<unsigned char>(length),
|
| - 0x00, 0x00, 0x00, 0x00, // Stream ID
|
| - 0x00, 0x00, 0x00, 0x00, // Status
|
| - };
|
|
|
| // HTTP/2 GOAWAY frames are only bound by a minimal length, since they may
|
| // carry opaque data. Verify that minimal length is tested.
|
| @@ -4239,16 +2816,11 @@ TEST_P(SpdyFramerTest, ControlFrameSizesAreValidated) {
|
| 0x00, 0x00, 0x00, // Truncated Status Field
|
| };
|
| const size_t pad_length =
|
| - length + framer.GetFrameHeaderSize() -
|
| - (IsSpdy3() ? sizeof(kV3FrameData) : sizeof(kH2FrameData));
|
| + length + framer.GetFrameHeaderSize() - sizeof(kH2FrameData);
|
| string pad(pad_length, 'A');
|
| TestSpdyVisitor visitor(spdy_version_);
|
|
|
| - if (IsSpdy3()) {
|
| - visitor.SimulateInFramer(kV3FrameData, sizeof(kV3FrameData));
|
| - } else {
|
| - visitor.SimulateInFramer(kH2FrameData, sizeof(kH2FrameData));
|
| - }
|
| + visitor.SimulateInFramer(kH2FrameData, sizeof(kH2FrameData));
|
| visitor.SimulateInFramer(reinterpret_cast<const unsigned char*>(pad.c_str()),
|
| pad.length());
|
|
|
| @@ -4269,13 +2841,8 @@ TEST_P(SpdyFramerTest, ReadZeroLenSettingsFrame) {
|
| visitor.SimulateInFramer(
|
| reinterpret_cast<unsigned char*>(control_frame.data()),
|
| framer.GetFrameHeaderSize());
|
| - if (IsSpdy3()) {
|
| - // Should generate an error, since zero-len settings frames are unsupported.
|
| - EXPECT_EQ(1, visitor.error_count_);
|
| - } else {
|
| - // Zero-len settings frames are permitted as of HTTP/2.
|
| - EXPECT_EQ(0, visitor.error_count_);
|
| - }
|
| + // Zero-len settings frames are permitted as of HTTP/2.
|
| + EXPECT_EQ(0, visitor.error_count_);
|
| }
|
|
|
| // Tests handling of SETTINGS frames with invalid length.
|
| @@ -4331,9 +2898,7 @@ TEST_P(SpdyFramerTest, ReadLargeSettingsFrame) {
|
| control_frame.size());
|
| EXPECT_EQ(0, visitor.error_count_);
|
| EXPECT_EQ(3, visitor.setting_count_);
|
| - if (IsHttp2()) {
|
| - EXPECT_EQ(1, visitor.settings_ack_sent_);
|
| - }
|
| + EXPECT_EQ(1, visitor.settings_ack_sent_);
|
|
|
| // Read data in small chunks.
|
| size_t framed_data = 0;
|
| @@ -4349,28 +2914,13 @@ TEST_P(SpdyFramerTest, ReadLargeSettingsFrame) {
|
| }
|
| EXPECT_EQ(0, visitor.error_count_);
|
| EXPECT_EQ(3 * 2, visitor.setting_count_);
|
| - if (IsHttp2()) {
|
| - EXPECT_EQ(2, visitor.settings_ack_sent_);
|
| - }
|
| + EXPECT_EQ(2, visitor.settings_ack_sent_);
|
| }
|
|
|
| // Tests handling of SETTINGS frame with duplicate entries.
|
| TEST_P(SpdyFramerTest, ReadDuplicateSettings) {
|
| SpdyFramer framer(spdy_version_);
|
|
|
| - // clang-format off
|
| - const unsigned char kV3FrameData[] = {
|
| - 0x80, 0x03, 0x00, 0x04,
|
| - 0x00, 0x00, 0x00, 0x1C,
|
| - 0x00, 0x00, 0x00, 0x03,
|
| - 0x00, 0x00, 0x00, 0x01, // 1st Setting
|
| - 0x00, 0x00, 0x00, 0x02,
|
| - 0x00, 0x00, 0x00, 0x01, // 2nd (duplicate) Setting
|
| - 0x00, 0x00, 0x00, 0x03,
|
| - 0x00, 0x00, 0x00, 0x03, // 3rd (unprocessed) Setting
|
| - 0x00, 0x00, 0x00, 0x03,
|
| - };
|
| - // clang-format on
|
| const unsigned char kH2FrameData[] = {
|
| 0x00, 0x00, 0x12, // Length: 18
|
| 0x04, // Type: SETTINGS
|
| @@ -4386,37 +2936,18 @@ TEST_P(SpdyFramerTest, ReadDuplicateSettings) {
|
|
|
| TestSpdyVisitor visitor(spdy_version_);
|
| visitor.use_compression_ = false;
|
| - if (IsSpdy3()) {
|
| - visitor.SimulateInFramer(kV3FrameData, sizeof(kV3FrameData));
|
| - } else {
|
| - visitor.SimulateInFramer(kH2FrameData, sizeof(kH2FrameData));
|
| - }
|
| + visitor.SimulateInFramer(kH2FrameData, sizeof(kH2FrameData));
|
|
|
| - if (IsSpdy3()) {
|
| - EXPECT_EQ(1, visitor.setting_count_);
|
| - EXPECT_EQ(1, visitor.error_count_);
|
| - } else {
|
| - // In HTTP/2, duplicate settings are allowed;
|
| - // each setting replaces the previous value for that setting.
|
| - EXPECT_EQ(3, visitor.setting_count_);
|
| - EXPECT_EQ(0, visitor.error_count_);
|
| - EXPECT_EQ(1, visitor.settings_ack_sent_);
|
| - }
|
| + // In HTTP/2, duplicate settings are allowed;
|
| + // each setting replaces the previous value for that setting.
|
| + EXPECT_EQ(3, visitor.setting_count_);
|
| + EXPECT_EQ(0, visitor.error_count_);
|
| + EXPECT_EQ(1, visitor.settings_ack_sent_);
|
| }
|
|
|
| // Tests handling of SETTINGS frame with a setting we don't recognize.
|
| TEST_P(SpdyFramerTest, ReadUnknownSettingsId) {
|
| SpdyFramer framer(spdy_version_);
|
| -
|
| - // clang-format off
|
| - const unsigned char kV3FrameData[] = {
|
| - 0x80, 0x03, 0x00, 0x04,
|
| - 0x00, 0x00, 0x00, 0x1C,
|
| - 0x00, 0x00, 0x00, 0x01,
|
| - 0x00, 0x00, 0x00, 0x10, // 1st Setting
|
| - 0x00, 0x00, 0x00, 0x02,
|
| - };
|
| - // clang-format on
|
| const unsigned char kH2FrameData[] = {
|
| 0x00, 0x00, 0x06, // Length: 6
|
| 0x04, // Type: SETTINGS
|
| @@ -4428,39 +2959,16 @@ TEST_P(SpdyFramerTest, ReadUnknownSettingsId) {
|
|
|
| TestSpdyVisitor visitor(spdy_version_);
|
| visitor.use_compression_ = false;
|
| - if (IsSpdy3()) {
|
| - visitor.SimulateInFramer(kV3FrameData, sizeof(kV3FrameData));
|
| - } else {
|
| - visitor.SimulateInFramer(kH2FrameData, sizeof(kH2FrameData));
|
| - }
|
| + visitor.SimulateInFramer(kH2FrameData, sizeof(kH2FrameData));
|
|
|
| - if (IsSpdy3()) {
|
| - EXPECT_EQ(0, visitor.setting_count_);
|
| - EXPECT_EQ(1, visitor.error_count_);
|
| - } else {
|
| - // In HTTP/2, we ignore unknown settings because of extensions.
|
| - EXPECT_EQ(0, visitor.setting_count_);
|
| - EXPECT_EQ(0, visitor.error_count_);
|
| - }
|
| + // In HTTP/2, we ignore unknown settings because of extensions.
|
| + EXPECT_EQ(0, visitor.setting_count_);
|
| + EXPECT_EQ(0, visitor.error_count_);
|
| }
|
|
|
| // Tests handling of SETTINGS frame with entries out of order.
|
| TEST_P(SpdyFramerTest, ReadOutOfOrderSettings) {
|
| SpdyFramer framer(spdy_version_);
|
| -
|
| - // clang-format off
|
| - const unsigned char kV3FrameData[] = {
|
| - 0x80, 0x03, 0x00, 0x04,
|
| - 0x00, 0x00, 0x00, 0x1C,
|
| - 0x00, 0x00, 0x00, 0x03,
|
| - 0x00, 0x00, 0x00, 0x02, // 1st Setting
|
| - 0x00, 0x00, 0x00, 0x02,
|
| - 0x00, 0x00, 0x00, 0x01, // 2nd (out of order) Setting
|
| - 0x00, 0x00, 0x00, 0x03,
|
| - 0x00, 0x00, 0x01, 0x03, // 3rd (unprocessed) Setting
|
| - 0x00, 0x00, 0x00, 0x03,
|
| - };
|
| - // clang-format on
|
| const unsigned char kH2FrameData[] = {
|
| 0x00, 0x00, 0x12, // Length: 18
|
| 0x04, // Type: SETTINGS
|
| @@ -4475,28 +2983,15 @@ TEST_P(SpdyFramerTest, ReadOutOfOrderSettings) {
|
| };
|
|
|
| TestSpdyVisitor visitor(spdy_version_);
|
| - visitor.use_compression_ = false;
|
| - if (IsSpdy3()) {
|
| - visitor.SimulateInFramer(kV3FrameData, sizeof(kV3FrameData));
|
| - } else {
|
| - visitor.SimulateInFramer(kH2FrameData, sizeof(kH2FrameData));
|
| - }
|
| + visitor.use_compression_ = false;
|
| + visitor.SimulateInFramer(kH2FrameData, sizeof(kH2FrameData));
|
|
|
| - if (IsSpdy3()) {
|
| - EXPECT_EQ(1, visitor.setting_count_);
|
| - EXPECT_EQ(1, visitor.error_count_);
|
| - } else {
|
| - // In HTTP/2, settings are allowed in any order.
|
| - EXPECT_EQ(3, visitor.setting_count_);
|
| - EXPECT_EQ(0, visitor.error_count_);
|
| - }
|
| + // In HTTP/2, settings are allowed in any order.
|
| + EXPECT_EQ(3, visitor.setting_count_);
|
| + EXPECT_EQ(0, visitor.error_count_);
|
| }
|
|
|
| TEST_P(SpdyFramerTest, ProcessSettingsAckFrame) {
|
| - if (!IsHttp2()) {
|
| - return;
|
| - }
|
| -
|
| SpdyFramer framer(spdy_version_);
|
|
|
| const unsigned char kFrameData[] = {
|
| @@ -4516,10 +3011,6 @@ TEST_P(SpdyFramerTest, ProcessSettingsAckFrame) {
|
| }
|
|
|
| TEST_P(SpdyFramerTest, ProcessDataFrameWithPadding) {
|
| - if (!IsHttp2()) {
|
| - return;
|
| - }
|
| -
|
| const int kPaddingLen = 119;
|
| const char data_payload[] = "hello";
|
|
|
| @@ -4590,10 +3081,6 @@ TEST_P(SpdyFramerTest, ReadWindowUpdate) {
|
| }
|
|
|
| TEST_P(SpdyFramerTest, ReadCompressedPushPromise) {
|
| - if (!IsHttp2()) {
|
| - return;
|
| - }
|
| -
|
| SpdyFramer framer(spdy_version_);
|
| SpdyPushPromiseIR push_promise(42, 57);
|
| push_promise.SetHeader("foo", "bar");
|
| @@ -4609,10 +3096,6 @@ TEST_P(SpdyFramerTest, ReadCompressedPushPromise) {
|
| }
|
|
|
| TEST_P(SpdyFramerTest, ReadHeadersWithContinuation) {
|
| - if (!IsHttp2()) {
|
| - return;
|
| - }
|
| -
|
| // frame-format off
|
| const unsigned char kInput[] = {
|
| 0x00, 0x00, 0x14, // Length: 20
|
| @@ -4671,9 +3154,6 @@ TEST_P(SpdyFramerTest, ReadHeadersWithContinuation) {
|
| }
|
|
|
| TEST_P(SpdyFramerTest, ReadHeadersWithContinuationAndFin) {
|
| - if (!IsHttp2()) {
|
| - return;
|
| - }
|
| // frame-format off
|
| const unsigned char kInput[] = {
|
| 0x00, 0x00, 0x10, // Length: 20
|
| @@ -4731,10 +3211,6 @@ TEST_P(SpdyFramerTest, ReadHeadersWithContinuationAndFin) {
|
| }
|
|
|
| TEST_P(SpdyFramerTest, ReadPushPromiseWithContinuation) {
|
| - if (!IsHttp2()) {
|
| - return;
|
| - }
|
| -
|
| // frame-format off
|
| const unsigned char kInput[] = {
|
| 0x00, 0x00, 0x17, 0x05, // PUSH_PROMISE
|
| @@ -4785,10 +3261,6 @@ TEST_P(SpdyFramerTest, ReadPushPromiseWithContinuation) {
|
| // Receiving an unknown frame when a continuation is expected should
|
| // result in a SPDY_UNEXPECTED_FRAME error
|
| TEST_P(SpdyFramerTest, ReceiveUnknownMidContinuation) {
|
| - if (!IsHttp2()) {
|
| - return;
|
| - }
|
| -
|
| const unsigned char kInput[] = {
|
| 0x00, 0x00, 0x10, // Length: 16
|
| 0x01, // Type: HEADERS
|
| @@ -4826,10 +3298,6 @@ TEST_P(SpdyFramerTest, ReceiveUnknownMidContinuation) {
|
| }
|
|
|
| TEST_P(SpdyFramerTest, ReceiveContinuationOnWrongStream) {
|
| - if (!IsHttp2()) {
|
| - return;
|
| - }
|
| -
|
| const unsigned char kInput[] = {
|
| 0x00, 0x00, 0x10, // Length: 16
|
| 0x01, // Type: HEADERS
|
| @@ -4865,10 +3333,6 @@ TEST_P(SpdyFramerTest, ReceiveContinuationOnWrongStream) {
|
| }
|
|
|
| TEST_P(SpdyFramerTest, ReadContinuationOutOfOrder) {
|
| - if (!IsHttp2()) {
|
| - return;
|
| - }
|
| -
|
| const unsigned char kInput[] = {
|
| 0x00, 0x00, 0x18, // Length: 24
|
| 0x09, // Type: CONTINUATION
|
| @@ -4893,10 +3357,6 @@ TEST_P(SpdyFramerTest, ReadContinuationOutOfOrder) {
|
| }
|
|
|
| TEST_P(SpdyFramerTest, ExpectContinuationReceiveData) {
|
| - if (!IsHttp2()) {
|
| - return;
|
| - }
|
| -
|
| const unsigned char kInput[] = {
|
| 0x00, 0x00, 0x10, // Length: 16
|
| 0x01, // Type: HEADERS
|
| @@ -4930,10 +3390,6 @@ TEST_P(SpdyFramerTest, ExpectContinuationReceiveData) {
|
| }
|
|
|
| TEST_P(SpdyFramerTest, ExpectContinuationReceiveControlFrame) {
|
| - if (!IsHttp2()) {
|
| - return;
|
| - }
|
| -
|
| const unsigned char kInput[] = {
|
| 0x00, 0x00, 0x10, // Length: 16
|
| 0x01, // Type: HEADERS
|
| @@ -4979,10 +3435,6 @@ TEST_P(SpdyFramerTest, ReadGarbage) {
|
| }
|
|
|
| TEST_P(SpdyFramerTest, ReadUnknownExtensionFrame) {
|
| - if (!IsHttp2()) {
|
| - return;
|
| - }
|
| -
|
| SpdyFramer framer(spdy_version_);
|
|
|
| // The unrecognized frame type should still have a valid length.
|
| @@ -5019,10 +3471,6 @@ TEST_P(SpdyFramerTest, ReadUnknownExtensionFrame) {
|
| }
|
|
|
| TEST_P(SpdyFramerTest, ReadGarbageWithValidLength) {
|
| - if (!IsHttp2()) {
|
| - return;
|
| - }
|
| -
|
| SpdyFramer framer(spdy_version_);
|
| const unsigned char kFrameData[] = {
|
| 0x00, 0x00, 0x08, // Length: 8
|
| @@ -5038,29 +3486,7 @@ TEST_P(SpdyFramerTest, ReadGarbageWithValidLength) {
|
| EXPECT_EQ(1, visitor.error_count_);
|
| }
|
|
|
| -TEST_P(SpdyFramerTest, ReadGarbageWithValidVersion) {
|
| - if (!IsSpdy3()) {
|
| - return;
|
| - }
|
| -
|
| - SpdyFramer framer(spdy_version_);
|
| - // clang-format off
|
| - const unsigned char kFrameData[] = {
|
| - 0x80, 0x03, 0xff, 0xff,
|
| - 0xff, 0xff, 0xff, 0xff,
|
| - };
|
| - // clang-format on
|
| - TestSpdyVisitor visitor(spdy_version_);
|
| - visitor.use_compression_ = false;
|
| - visitor.SimulateInFramer(kFrameData, arraysize(kFrameData));
|
| - EXPECT_EQ(1, visitor.error_count_);
|
| -}
|
| -
|
| TEST_P(SpdyFramerTest, ReadGarbageHPACKEncoding) {
|
| - if (!IsHttp2()) {
|
| - return;
|
| - }
|
| -
|
| const unsigned char kInput[] = {
|
| 0x00, 0x12, 0x01, // Length: 4609
|
| 0x04, // Type: SETTINGS
|
| @@ -5081,38 +3507,22 @@ TEST_P(SpdyFramerTest, ReadGarbageHPACKEncoding) {
|
|
|
| TEST_P(SpdyFramerTest, SizesTest) {
|
| SpdyFramer framer(spdy_version_);
|
| - if (IsSpdy3()) {
|
| - EXPECT_EQ(8u, framer.GetDataFrameMinimumSize());
|
| - EXPECT_EQ(8u, framer.GetFrameHeaderSize());
|
| - EXPECT_EQ(18u, framer.GetSynStreamMinimumSize());
|
| - EXPECT_EQ(12u, framer.GetSynReplyMinimumSize());
|
| - EXPECT_EQ(16u, framer.GetRstStreamMinimumSize());
|
| - EXPECT_EQ(12u, framer.GetSettingsMinimumSize());
|
| - EXPECT_EQ(12u, framer.GetPingSize());
|
| - EXPECT_EQ(16u, framer.GetGoAwayMinimumSize());
|
| - EXPECT_EQ(12u, framer.GetHeadersMinimumSize());
|
| - EXPECT_EQ(16u, framer.GetWindowUpdateSize());
|
| - EXPECT_EQ(8u, framer.GetFrameMinimumSize());
|
| - EXPECT_EQ(16777223u, framer.GetFrameMaximumSize());
|
| - EXPECT_EQ(16777215u, framer.GetDataFrameMaximumPayload());
|
| - } else {
|
| - EXPECT_EQ(9u, framer.GetDataFrameMinimumSize());
|
| - EXPECT_EQ(9u, framer.GetFrameHeaderSize());
|
| - EXPECT_EQ(14u, framer.GetSynStreamMinimumSize());
|
| - EXPECT_EQ(9u, framer.GetSynReplyMinimumSize());
|
| - EXPECT_EQ(13u, framer.GetRstStreamMinimumSize());
|
| - EXPECT_EQ(9u, framer.GetSettingsMinimumSize());
|
| - EXPECT_EQ(17u, framer.GetPingSize());
|
| - EXPECT_EQ(17u, framer.GetGoAwayMinimumSize());
|
| - EXPECT_EQ(9u, framer.GetHeadersMinimumSize());
|
| - EXPECT_EQ(13u, framer.GetWindowUpdateSize());
|
| - EXPECT_EQ(9u, framer.GetBlockedSize());
|
| - EXPECT_EQ(13u, framer.GetPushPromiseMinimumSize());
|
| - EXPECT_EQ(11u, framer.GetAltSvcMinimumSize());
|
| - EXPECT_EQ(9u, framer.GetFrameMinimumSize());
|
| - EXPECT_EQ(16393u, framer.GetFrameMaximumSize());
|
| - EXPECT_EQ(16384u, framer.GetDataFrameMaximumPayload());
|
| - }
|
| + EXPECT_EQ(9u, framer.GetDataFrameMinimumSize());
|
| + EXPECT_EQ(9u, framer.GetFrameHeaderSize());
|
| + EXPECT_EQ(14u, framer.GetSynStreamMinimumSize());
|
| + EXPECT_EQ(9u, framer.GetSynReplyMinimumSize());
|
| + EXPECT_EQ(13u, framer.GetRstStreamMinimumSize());
|
| + EXPECT_EQ(9u, framer.GetSettingsMinimumSize());
|
| + EXPECT_EQ(17u, framer.GetPingSize());
|
| + EXPECT_EQ(17u, framer.GetGoAwayMinimumSize());
|
| + EXPECT_EQ(9u, framer.GetHeadersMinimumSize());
|
| + EXPECT_EQ(13u, framer.GetWindowUpdateSize());
|
| + EXPECT_EQ(9u, framer.GetBlockedSize());
|
| + EXPECT_EQ(13u, framer.GetPushPromiseMinimumSize());
|
| + EXPECT_EQ(11u, framer.GetAltSvcMinimumSize());
|
| + EXPECT_EQ(9u, framer.GetFrameMinimumSize());
|
| + EXPECT_EQ(16393u, framer.GetFrameMaximumSize());
|
| + EXPECT_EQ(16384u, framer.GetDataFrameMaximumPayload());
|
| }
|
|
|
| TEST_P(SpdyFramerTest, StateToStringTest) {
|
| @@ -5216,84 +3626,7 @@ TEST_P(SpdyFramerTest, FrameTypeToStringTest) {
|
| EXPECT_STREQ("CONTINUATION", SpdyFramer::FrameTypeToString(CONTINUATION));
|
| }
|
|
|
| -TEST_P(SpdyFramerTest, CatchProbableHttpResponse) {
|
| - if (!IsSpdy3()) {
|
| - // TODO(hkhalil): catch probable HTTP response in HTTP/2?
|
| - return;
|
| - }
|
| -
|
| - {
|
| - testing::StrictMock<test::MockSpdyFramerVisitor> visitor;
|
| - SpdyFramer framer(spdy_version_);
|
| - framer.set_visitor(&visitor);
|
| -
|
| - EXPECT_CALL(visitor, OnError(_));
|
| - framer.ProcessInput("HTTP/1.1", 8);
|
| - EXPECT_TRUE(framer.probable_http_response());
|
| - EXPECT_EQ(SpdyFramer::SPDY_ERROR, framer.state());
|
| - EXPECT_EQ(SpdyFramer::SPDY_INVALID_DATA_FRAME_FLAGS, framer.error_code())
|
| - << SpdyFramer::ErrorCodeToString(framer.error_code());
|
| - }
|
| - {
|
| - testing::StrictMock<test::MockSpdyFramerVisitor> visitor;
|
| - SpdyFramer framer(spdy_version_);
|
| - framer.set_visitor(&visitor);
|
| -
|
| - EXPECT_CALL(visitor, OnError(_));
|
| - framer.ProcessInput("HTTP/1.0", 8);
|
| - EXPECT_TRUE(framer.probable_http_response());
|
| - EXPECT_EQ(SpdyFramer::SPDY_ERROR, framer.state());
|
| - EXPECT_EQ(SpdyFramer::SPDY_INVALID_DATA_FRAME_FLAGS, framer.error_code())
|
| - << SpdyFramer::ErrorCodeToString(framer.error_code());
|
| - }
|
| -}
|
| -
|
| -TEST_P(SpdyFramerTest, DataFrameFlagsV2V3) {
|
| - if (!IsSpdy3()) {
|
| - return;
|
| - }
|
| -
|
| - uint8_t flags = 0;
|
| - do {
|
| - SCOPED_TRACE(testing::Message() << "Flags " << flags << std::hex
|
| - << static_cast<int>(flags));
|
| -
|
| - testing::StrictMock<test::MockSpdyFramerVisitor> visitor;
|
| - SpdyFramer framer(spdy_version_);
|
| - framer.set_visitor(&visitor);
|
| -
|
| - SpdyDataIR data_ir(1, "hello");
|
| - SpdySerializedFrame frame(framer.SerializeData(data_ir));
|
| - SetFrameFlags(&frame, flags, spdy_version_);
|
| -
|
| - if (flags & ~DATA_FLAG_FIN) {
|
| - EXPECT_CALL(visitor, OnError(_));
|
| - } else {
|
| - EXPECT_CALL(visitor, OnDataFrameHeader(1, 5, flags & DATA_FLAG_FIN));
|
| - EXPECT_CALL(visitor, OnStreamFrameData(_, _, 5));
|
| - if (flags & DATA_FLAG_FIN) {
|
| - EXPECT_CALL(visitor, OnStreamEnd(_));
|
| - }
|
| - }
|
| -
|
| - framer.ProcessInput(frame.data(), frame.size());
|
| - if (flags & ~DATA_FLAG_FIN) {
|
| - EXPECT_EQ(SpdyFramer::SPDY_ERROR, framer.state());
|
| - EXPECT_EQ(SpdyFramer::SPDY_INVALID_DATA_FRAME_FLAGS, framer.error_code())
|
| - << SpdyFramer::ErrorCodeToString(framer.error_code());
|
| - } else {
|
| - EXPECT_EQ(SpdyFramer::SPDY_READY_FOR_FRAME, framer.state());
|
| - EXPECT_EQ(SpdyFramer::SPDY_NO_ERROR, framer.error_code())
|
| - << SpdyFramer::ErrorCodeToString(framer.error_code());
|
| - }
|
| - } while (++flags != 0);
|
| -}
|
| -
|
| TEST_P(SpdyFramerTest, DataFrameFlagsV4) {
|
| - if (!IsHttp2()) {
|
| - return;
|
| - }
|
| -
|
| uint8_t valid_data_flags = DATA_FLAG_FIN | DATA_FLAG_PADDED;
|
|
|
| uint8_t flags = 0;
|
| @@ -5344,105 +3677,6 @@ TEST_P(SpdyFramerTest, DataFrameFlagsV4) {
|
| } while (++flags != 0);
|
| }
|
|
|
| -TEST_P(SpdyFramerTest, SynStreamFrameFlags) {
|
| - if (!IsSpdy3()) {
|
| - return;
|
| - }
|
| -
|
| - uint8_t flags = 0;
|
| - do {
|
| - SCOPED_TRACE(testing::Message() << "Flags " << flags << std::hex
|
| - << static_cast<int>(flags));
|
| -
|
| - testing::StrictMock<test::MockSpdyFramerVisitor> visitor;
|
| - testing::StrictMock<test::MockDebugVisitor> debug_visitor;
|
| - SpdyFramer framer(spdy_version_);
|
| - framer.set_visitor(&visitor);
|
| - framer.set_debug_visitor(&debug_visitor);
|
| -
|
| - EXPECT_CALL(debug_visitor, OnSendCompressedFrame(8, SYN_STREAM, _, _));
|
| -
|
| - SpdySynStreamIR syn_stream(8);
|
| - syn_stream.set_associated_to_stream_id(3);
|
| - syn_stream.set_priority(1);
|
| - syn_stream.SetHeader("foo", "bar");
|
| - SpdySerializedFrame frame(framer.SerializeSynStream(syn_stream));
|
| - SetFrameFlags(&frame, flags, spdy_version_);
|
| -
|
| - if (flags & ~(CONTROL_FLAG_FIN | CONTROL_FLAG_UNIDIRECTIONAL)) {
|
| - EXPECT_CALL(visitor, OnError(_));
|
| - } else {
|
| - EXPECT_CALL(debug_visitor, OnReceiveCompressedFrame(8, SYN_STREAM, _));
|
| - EXPECT_CALL(visitor, OnSynStream(8, 3, 1, flags & CONTROL_FLAG_FIN,
|
| - flags & CONTROL_FLAG_UNIDIRECTIONAL));
|
| - EXPECT_CALL(visitor, OnHeaderFrameStart(8)).Times(1);
|
| - EXPECT_CALL(visitor, OnHeaderFrameEnd(8, _)).Times(1);
|
| - if (flags & DATA_FLAG_FIN) {
|
| - EXPECT_CALL(visitor, OnStreamEnd(_));
|
| - } else {
|
| - // Do not close the stream if we are expecting a CONTINUATION frame.
|
| - EXPECT_CALL(visitor, OnStreamEnd(_)).Times(0);
|
| - }
|
| - }
|
| -
|
| - framer.ProcessInput(frame.data(), frame.size());
|
| - if (flags & ~(CONTROL_FLAG_FIN | CONTROL_FLAG_UNIDIRECTIONAL)) {
|
| - EXPECT_EQ(SpdyFramer::SPDY_ERROR, framer.state());
|
| - EXPECT_EQ(SpdyFramer::SPDY_INVALID_CONTROL_FRAME_FLAGS,
|
| - framer.error_code())
|
| - << SpdyFramer::ErrorCodeToString(framer.error_code());
|
| - } else {
|
| - EXPECT_EQ(SpdyFramer::SPDY_READY_FOR_FRAME, framer.state());
|
| - EXPECT_EQ(SpdyFramer::SPDY_NO_ERROR, framer.error_code())
|
| - << SpdyFramer::ErrorCodeToString(framer.error_code());
|
| - }
|
| - } while (++flags != 0);
|
| -}
|
| -
|
| -TEST_P(SpdyFramerTest, SynReplyFrameFlags) {
|
| - if (!IsSpdy3()) {
|
| - return;
|
| - }
|
| -
|
| - uint8_t flags = 0;
|
| - do {
|
| - SCOPED_TRACE(testing::Message() << "Flags " << flags << std::hex
|
| - << static_cast<int>(flags));
|
| -
|
| - testing::StrictMock<test::MockSpdyFramerVisitor> visitor;
|
| - SpdyFramer framer(spdy_version_);
|
| - framer.set_visitor(&visitor);
|
| -
|
| - SpdySynReplyIR syn_reply(37);
|
| - syn_reply.SetHeader("foo", "bar");
|
| - SpdySerializedFrame frame(framer.SerializeSynReply(syn_reply));
|
| - SetFrameFlags(&frame, flags, spdy_version_);
|
| -
|
| - if (flags & ~CONTROL_FLAG_FIN) {
|
| - EXPECT_CALL(visitor, OnError(_));
|
| - } else {
|
| - EXPECT_CALL(visitor, OnSynReply(37, flags & CONTROL_FLAG_FIN));
|
| - EXPECT_CALL(visitor, OnHeaderFrameStart(37)).Times(1);
|
| - EXPECT_CALL(visitor, OnHeaderFrameEnd(37, _)).Times(1);
|
| - if (flags & DATA_FLAG_FIN) {
|
| - EXPECT_CALL(visitor, OnStreamEnd(_));
|
| - }
|
| - }
|
| -
|
| - framer.ProcessInput(frame.data(), frame.size());
|
| - if (flags & ~CONTROL_FLAG_FIN) {
|
| - EXPECT_EQ(SpdyFramer::SPDY_ERROR, framer.state());
|
| - EXPECT_EQ(SpdyFramer::SPDY_INVALID_CONTROL_FRAME_FLAGS,
|
| - framer.error_code())
|
| - << SpdyFramer::ErrorCodeToString(framer.error_code());
|
| - } else {
|
| - EXPECT_EQ(SpdyFramer::SPDY_READY_FOR_FRAME, framer.state());
|
| - EXPECT_EQ(SpdyFramer::SPDY_NO_ERROR, framer.error_code())
|
| - << SpdyFramer::ErrorCodeToString(framer.error_code());
|
| - }
|
| - } while (++flags != 0);
|
| -}
|
| -
|
| TEST_P(SpdyFramerTest, RstStreamFrameFlags) {
|
| uint8_t flags = 0;
|
| do {
|
| @@ -5467,56 +3701,7 @@ TEST_P(SpdyFramerTest, RstStreamFrameFlags) {
|
| } while (++flags != 0);
|
| }
|
|
|
| -TEST_P(SpdyFramerTest, SettingsFrameFlagsOldFormat) {
|
| - if (!IsSpdy3()) {
|
| - return;
|
| - }
|
| -
|
| - uint8_t flags = 0;
|
| - do {
|
| - SCOPED_TRACE(testing::Message() << "Flags " << flags << std::hex
|
| - << static_cast<int>(flags));
|
| -
|
| - testing::StrictMock<test::MockSpdyFramerVisitor> visitor;
|
| - SpdyFramer framer(spdy_version_);
|
| - framer.set_visitor(&visitor);
|
| -
|
| - SpdySettingsIR settings_ir;
|
| - settings_ir.AddSetting(SETTINGS_UPLOAD_BANDWIDTH, false, false, 54321);
|
| - SpdySerializedFrame frame(framer.SerializeSettings(settings_ir));
|
| - SetFrameFlags(&frame, flags, spdy_version_);
|
| -
|
| - if (flags & ~SETTINGS_FLAG_CLEAR_PREVIOUSLY_PERSISTED_SETTINGS) {
|
| - EXPECT_CALL(visitor, OnError(_));
|
| - } else {
|
| - EXPECT_CALL(
|
| - visitor,
|
| - OnSettings(flags &
|
| - SETTINGS_FLAG_CLEAR_PREVIOUSLY_PERSISTED_SETTINGS));
|
| - EXPECT_CALL(visitor, OnSetting(SETTINGS_UPLOAD_BANDWIDTH,
|
| - SETTINGS_FLAG_NONE, 54321));
|
| - EXPECT_CALL(visitor, OnSettingsEnd());
|
| - }
|
| -
|
| - framer.ProcessInput(frame.data(), frame.size());
|
| - if (flags & ~SETTINGS_FLAG_CLEAR_PREVIOUSLY_PERSISTED_SETTINGS) {
|
| - EXPECT_EQ(SpdyFramer::SPDY_ERROR, framer.state());
|
| - EXPECT_EQ(SpdyFramer::SPDY_INVALID_CONTROL_FRAME_FLAGS,
|
| - framer.error_code())
|
| - << SpdyFramer::ErrorCodeToString(framer.error_code());
|
| - } else {
|
| - EXPECT_EQ(SpdyFramer::SPDY_READY_FOR_FRAME, framer.state());
|
| - EXPECT_EQ(SpdyFramer::SPDY_NO_ERROR, framer.error_code())
|
| - << SpdyFramer::ErrorCodeToString(framer.error_code());
|
| - }
|
| - } while (++flags != 0);
|
| -}
|
| -
|
| TEST_P(SpdyFramerTest, SettingsFrameFlags) {
|
| - if (!IsHttp2()) {
|
| - return;
|
| - }
|
| -
|
| uint8_t flags = 0;
|
| do {
|
| SCOPED_TRACE(testing::Message() << "Flags " << flags << std::hex
|
| @@ -5588,7 +3773,7 @@ TEST_P(SpdyFramerTest, HeadersFrameFlags) {
|
| framer.set_visitor(&visitor);
|
|
|
| SpdyHeadersIR headers_ir(57);
|
| - if (IsHttp2() && (flags & HEADERS_FLAG_PRIORITY)) {
|
| + if (flags & HEADERS_FLAG_PRIORITY) {
|
| headers_ir.set_weight(3);
|
| headers_ir.set_has_priority(true);
|
| headers_ir.set_parent_stream_id(5);
|
| @@ -5597,12 +3782,7 @@ TEST_P(SpdyFramerTest, HeadersFrameFlags) {
|
| headers_ir.SetHeader("foo", "bar");
|
| SpdySerializedFrame frame(
|
| SpdyFramerPeer::SerializeHeaders(&framer, headers_ir));
|
| - uint8_t set_flags = flags;
|
| - if (IsHttp2()) {
|
| - // TODO(jgraettinger): Add padding to SpdyHeadersIR,
|
| - // and implement framing.
|
| - set_flags &= ~HEADERS_FLAG_PADDED;
|
| - }
|
| + uint8_t set_flags = flags & ~HEADERS_FLAG_PADDED;
|
| SetFrameFlags(&frame, set_flags, spdy_version_);
|
|
|
| // Expected callback values
|
| @@ -5612,8 +3792,8 @@ TEST_P(SpdyFramerTest, HeadersFrameFlags) {
|
| SpdyStreamId parent_stream_id = 0;
|
| bool exclusive = false;
|
| bool fin = flags & CONTROL_FLAG_FIN;
|
| - bool end = IsSpdy3() || (flags & HEADERS_FLAG_END_HEADERS);
|
| - if (IsHttp2() && flags & HEADERS_FLAG_PRIORITY) {
|
| + bool end = flags & HEADERS_FLAG_END_HEADERS;
|
| + if (flags & HEADERS_FLAG_PRIORITY) {
|
| has_priority = true;
|
| priority = 3;
|
| parent_stream_id = 5;
|
| @@ -5625,8 +3805,7 @@ TEST_P(SpdyFramerTest, HeadersFrameFlags) {
|
| if (end) {
|
| EXPECT_CALL(visitor, OnHeaderFrameEnd(57, _)).Times(1);
|
| }
|
| - if (flags & DATA_FLAG_FIN &&
|
| - (IsSpdy3() || flags & HEADERS_FLAG_END_HEADERS)) {
|
| + if (flags & DATA_FLAG_FIN && end) {
|
| EXPECT_CALL(visitor, OnStreamEnd(_));
|
| } else {
|
| // Do not close the stream if we are expecting a CONTINUATION frame.
|
| @@ -5653,7 +3832,7 @@ TEST_P(SpdyFramerTest, PingFrameFlags) {
|
| SpdySerializedFrame frame(framer.SerializePing(SpdyPingIR(42)));
|
| SetFrameFlags(&frame, flags, spdy_version_);
|
|
|
| - if (IsHttp2() && (flags & PING_FLAG_ACK)) {
|
| + if (flags & PING_FLAG_ACK) {
|
| EXPECT_CALL(visitor, OnPing(42, true));
|
| } else {
|
| EXPECT_CALL(visitor, OnPing(42, false));
|
| @@ -5690,10 +3869,6 @@ TEST_P(SpdyFramerTest, WindowUpdateFrameFlags) {
|
| }
|
|
|
| TEST_P(SpdyFramerTest, PushPromiseFrameFlags) {
|
| - if (!IsHttp2()) {
|
| - return;
|
| - }
|
| -
|
| const SpdyStreamId client_id = 123; // Must be odd.
|
| const SpdyStreamId promised_id = 22; // Must be even.
|
| uint8_t flags = 0;
|
| @@ -5734,10 +3909,6 @@ TEST_P(SpdyFramerTest, PushPromiseFrameFlags) {
|
| }
|
|
|
| TEST_P(SpdyFramerTest, ContinuationFrameFlags) {
|
| - if (!IsHttp2()) {
|
| - return;
|
| - }
|
| -
|
| uint8_t flags = 0;
|
| do {
|
| SCOPED_TRACE(testing::Message() << "Flags " << flags << std::hex
|
| @@ -5783,38 +3954,6 @@ TEST_P(SpdyFramerTest, ContinuationFrameFlags) {
|
|
|
| // TODO(hkhalil): Add TEST_P(SpdyFramerTest, BlockedFrameFlags)
|
|
|
| -TEST_P(SpdyFramerTest, EmptySynStream) {
|
| - if (!IsSpdy3()) {
|
| - return;
|
| - }
|
| -
|
| - testing::StrictMock<test::MockSpdyFramerVisitor> visitor;
|
| - testing::StrictMock<test::MockDebugVisitor> debug_visitor;
|
| - SpdyFramer framer(spdy_version_);
|
| - framer.set_visitor(&visitor);
|
| - framer.set_debug_visitor(&debug_visitor);
|
| -
|
| - EXPECT_CALL(debug_visitor, OnSendCompressedFrame(1, SYN_STREAM, _, _));
|
| -
|
| - SpdySynStreamIR syn_stream(1);
|
| - syn_stream.set_priority(1);
|
| - SpdySerializedFrame frame(framer.SerializeSynStream(syn_stream));
|
| - // Adjust size to remove the header block.
|
| - SetFrameLength(&frame,
|
| - framer.GetSynStreamMinimumSize() - framer.GetFrameHeaderSize(),
|
| - spdy_version_);
|
| -
|
| - EXPECT_CALL(debug_visitor, OnReceiveCompressedFrame(1, SYN_STREAM, _));
|
| - EXPECT_CALL(visitor, OnSynStream(1, 0, 1, false, false));
|
| - EXPECT_CALL(visitor, OnHeaderFrameStart(1)).Times(1);
|
| - EXPECT_CALL(visitor, OnHeaderFrameEnd(1, _)).Times(1);
|
| -
|
| - framer.ProcessInput(frame.data(), framer.GetSynStreamMinimumSize());
|
| - EXPECT_EQ(SpdyFramer::SPDY_READY_FOR_FRAME, framer.state());
|
| - EXPECT_EQ(SpdyFramer::SPDY_NO_ERROR, framer.error_code())
|
| - << SpdyFramer::ErrorCodeToString(framer.error_code());
|
| -}
|
| -
|
| TEST_P(SpdyFramerTest, SettingsFlagsAndId) {
|
| const uint32_t kId = 0x020304;
|
| const uint32_t kFlags = 0x01;
|
| @@ -5829,16 +3968,6 @@ TEST_P(SpdyFramerTest, SettingsFlagsAndId) {
|
|
|
| // Test handling of a RST_STREAM with out-of-bounds status codes.
|
| TEST_P(SpdyFramerTest, RstStreamStatusBounds) {
|
| - const unsigned char kRstStreamStatusTooLow = 0x00;
|
| - const unsigned char kRstStreamStatusTooHigh = 0xff;
|
| - // clang-format off
|
| - const unsigned char kV3RstStreamInvalid[] = {
|
| - 0x80, 0x03, 0x00, 0x03,
|
| - 0x00, 0x00, 0x00, 0x08,
|
| - 0x00, 0x00, 0x00, 0x01,
|
| - 0x00, 0x00, 0x00, kRstStreamStatusTooLow
|
| - };
|
| - // clang-format on
|
| const unsigned char kH2RstStreamInvalid[] = {
|
| 0x00, 0x00, 0x04, // Length: 4
|
| 0x03, // Type: RST_STREAM
|
| @@ -5846,15 +3975,6 @@ TEST_P(SpdyFramerTest, RstStreamStatusBounds) {
|
| 0x00, 0x00, 0x00, 0x01, // Stream: 1
|
| 0x00, 0x00, 0x00, 0x00, // Error: NO_ERROR
|
| };
|
| -
|
| - // clang-format off
|
| - const unsigned char kV3RstStreamNumStatusCodes[] = {
|
| - 0x80, 0x03, 0x00, 0x03,
|
| - 0x00, 0x00, 0x00, 0x08,
|
| - 0x00, 0x00, 0x00, 0x01,
|
| - 0x00, 0x00, 0x00, kRstStreamStatusTooHigh
|
| - };
|
| - // clang-format on
|
| const unsigned char kH2RstStreamNumStatusCodes[] = {
|
| 0x00, 0x00, 0x04, // Length: 4
|
| 0x03, // Type: RST_STREAM
|
| @@ -5867,32 +3987,18 @@ TEST_P(SpdyFramerTest, RstStreamStatusBounds) {
|
| SpdyFramer framer(spdy_version_);
|
| framer.set_visitor(&visitor);
|
|
|
| - if (IsSpdy3()) {
|
| - EXPECT_CALL(visitor, OnRstStream(1, RST_STREAM_NO_ERROR));
|
| - framer.ProcessInput(reinterpret_cast<const char*>(kV3RstStreamInvalid),
|
| - arraysize(kV3RstStreamInvalid));
|
| - } else {
|
| - EXPECT_CALL(visitor, OnRstStream(1, RST_STREAM_NO_ERROR));
|
| - framer.ProcessInput(reinterpret_cast<const char*>(kH2RstStreamInvalid),
|
| - arraysize(kH2RstStreamInvalid));
|
| - }
|
| + EXPECT_CALL(visitor, OnRstStream(1, RST_STREAM_NO_ERROR));
|
| + framer.ProcessInput(reinterpret_cast<const char*>(kH2RstStreamInvalid),
|
| + arraysize(kH2RstStreamInvalid));
|
| EXPECT_EQ(SpdyFramer::SPDY_READY_FOR_FRAME, framer.state());
|
| EXPECT_EQ(SpdyFramer::SPDY_NO_ERROR, framer.error_code())
|
| << SpdyFramer::ErrorCodeToString(framer.error_code());
|
|
|
| framer.Reset();
|
|
|
| - if (IsSpdy3()) {
|
| - EXPECT_CALL(visitor, OnRstStream(1, RST_STREAM_NO_ERROR));
|
| - framer.ProcessInput(
|
| - reinterpret_cast<const char*>(kV3RstStreamNumStatusCodes),
|
| - arraysize(kV3RstStreamNumStatusCodes));
|
| - } else {
|
| - EXPECT_CALL(visitor, OnRstStream(1, RST_STREAM_INTERNAL_ERROR));
|
| - framer.ProcessInput(
|
| - reinterpret_cast<const char*>(kH2RstStreamNumStatusCodes),
|
| - arraysize(kH2RstStreamNumStatusCodes));
|
| - }
|
| + EXPECT_CALL(visitor, OnRstStream(1, RST_STREAM_INTERNAL_ERROR));
|
| + framer.ProcessInput(reinterpret_cast<const char*>(kH2RstStreamNumStatusCodes),
|
| + arraysize(kH2RstStreamNumStatusCodes));
|
| EXPECT_EQ(SpdyFramer::SPDY_READY_FOR_FRAME, framer.state());
|
| EXPECT_EQ(SpdyFramer::SPDY_NO_ERROR, framer.error_code())
|
| << SpdyFramer::ErrorCodeToString(framer.error_code());
|
| @@ -5901,15 +4007,6 @@ TEST_P(SpdyFramerTest, RstStreamStatusBounds) {
|
| // Test handling of GOAWAY frames with out-of-bounds status code.
|
| TEST_P(SpdyFramerTest, GoAwayStatusBounds) {
|
| SpdyFramer framer(spdy_version_);
|
| -
|
| - // clang-format off
|
| - const unsigned char kV3FrameData[] = {
|
| - 0x80, 0x03, 0x00, 0x07,
|
| - 0x00, 0x00, 0x00, 0x08,
|
| - 0x00, 0x00, 0x00, 0x01, // Stream Id
|
| - 0xff, 0xff, 0xff, 0xff, // Status
|
| - };
|
| - // clang-format on
|
| const unsigned char kH2FrameData[] = {
|
| 0x00, 0x00, 0x0a, // Length: 10
|
| 0x07, // Type: GOAWAY
|
| @@ -5922,15 +4019,9 @@ TEST_P(SpdyFramerTest, GoAwayStatusBounds) {
|
| testing::StrictMock<test::MockSpdyFramerVisitor> visitor;
|
| framer.set_visitor(&visitor);
|
|
|
| - if (IsSpdy3()) {
|
| - EXPECT_CALL(visitor, OnGoAway(1, GOAWAY_OK));
|
| - framer.ProcessInput(reinterpret_cast<const char*>(kV3FrameData),
|
| - arraysize(kV3FrameData));
|
| - } else {
|
| - EXPECT_CALL(visitor, OnGoAway(1, GOAWAY_INTERNAL_ERROR));
|
| - framer.ProcessInput(reinterpret_cast<const char*>(kH2FrameData),
|
| - arraysize(kH2FrameData));
|
| - }
|
| + EXPECT_CALL(visitor, OnGoAway(1, GOAWAY_INTERNAL_ERROR));
|
| + framer.ProcessInput(reinterpret_cast<const char*>(kH2FrameData),
|
| + arraysize(kH2FrameData));
|
| EXPECT_EQ(SpdyFramer::SPDY_READY_FOR_FRAME, framer.state());
|
| EXPECT_EQ(SpdyFramer::SPDY_NO_ERROR, framer.error_code())
|
| << SpdyFramer::ErrorCodeToString(framer.error_code());
|
| @@ -5938,14 +4029,6 @@ TEST_P(SpdyFramerTest, GoAwayStatusBounds) {
|
|
|
| // Tests handling of a GOAWAY frame with out-of-bounds stream ID.
|
| TEST_P(SpdyFramerTest, GoAwayStreamIdBounds) {
|
| - // clang-format off
|
| - const unsigned char kV3FrameData[] = {
|
| - 0x80, 0x03, 0x00, 0x07,
|
| - 0x00, 0x00, 0x00, 0x08,
|
| - 0xff, 0xff, 0xff, 0xff,
|
| - 0x00, 0x00, 0x00, 0x00,
|
| - };
|
| - // clang-format on
|
| const unsigned char kH2FrameData[] = {
|
| 0x00, 0x00, 0x08, // Length: 8
|
| 0x07, // Type: GOAWAY
|
| @@ -5960,23 +4043,14 @@ TEST_P(SpdyFramerTest, GoAwayStreamIdBounds) {
|
| framer.set_visitor(&visitor);
|
|
|
| EXPECT_CALL(visitor, OnGoAway(0x7fffffff, GOAWAY_OK));
|
| - if (IsSpdy3()) {
|
| - framer.ProcessInput(reinterpret_cast<const char*>(kV3FrameData),
|
| - arraysize(kV3FrameData));
|
| - } else {
|
| - framer.ProcessInput(reinterpret_cast<const char*>(kH2FrameData),
|
| - arraysize(kH2FrameData));
|
| - }
|
| + framer.ProcessInput(reinterpret_cast<const char*>(kH2FrameData),
|
| + arraysize(kH2FrameData));
|
| EXPECT_EQ(SpdyFramer::SPDY_READY_FOR_FRAME, framer.state());
|
| EXPECT_EQ(SpdyFramer::SPDY_NO_ERROR, framer.error_code())
|
| << SpdyFramer::ErrorCodeToString(framer.error_code());
|
| }
|
|
|
| TEST_P(SpdyFramerTest, OnBlocked) {
|
| - if (!IsHttp2()) {
|
| - return;
|
| - }
|
| -
|
| const SpdyStreamId kStreamId = 0;
|
|
|
| testing::StrictMock<test::MockSpdyFramerVisitor> visitor;
|
| @@ -5995,10 +4069,6 @@ TEST_P(SpdyFramerTest, OnBlocked) {
|
| }
|
|
|
| TEST_P(SpdyFramerTest, OnAltSvc) {
|
| - if (!IsHttp2()) {
|
| - return;
|
| - }
|
| -
|
| const SpdyStreamId kStreamId = 1;
|
|
|
| testing::StrictMock<test::MockSpdyFramerVisitor> visitor;
|
| @@ -6028,10 +4098,6 @@ TEST_P(SpdyFramerTest, OnAltSvc) {
|
| }
|
|
|
| TEST_P(SpdyFramerTest, OnAltSvcNoOrigin) {
|
| - if (!IsHttp2()) {
|
| - return;
|
| - }
|
| -
|
| const SpdyStreamId kStreamId = 1;
|
|
|
| testing::StrictMock<test::MockSpdyFramerVisitor> visitor;
|
| @@ -6059,10 +4125,6 @@ TEST_P(SpdyFramerTest, OnAltSvcNoOrigin) {
|
| }
|
|
|
| TEST_P(SpdyFramerTest, OnAltSvcEmptyProtocolId) {
|
| - if (!IsHttp2()) {
|
| - return;
|
| - }
|
| -
|
| testing::StrictMock<test::MockSpdyFramerVisitor> visitor;
|
| SpdyFramer framer(spdy_version_);
|
| framer.set_visitor(&visitor);
|
| @@ -6084,10 +4146,6 @@ TEST_P(SpdyFramerTest, OnAltSvcEmptyProtocolId) {
|
| }
|
|
|
| TEST_P(SpdyFramerTest, OnAltSvcBadLengths) {
|
| - if (!IsHttp2()) {
|
| - return;
|
| - }
|
| -
|
| const SpdyStreamId kStreamId = 1;
|
|
|
| testing::StrictMock<test::MockSpdyFramerVisitor> visitor;
|
| @@ -6113,10 +4171,6 @@ TEST_P(SpdyFramerTest, OnAltSvcBadLengths) {
|
|
|
| // Tests handling of ALTSVC frames delivered in small chunks.
|
| TEST_P(SpdyFramerTest, ReadChunkedAltSvcFrame) {
|
| - if (!IsHttp2()) {
|
| - return;
|
| - }
|
| -
|
| SpdyFramer framer(spdy_version_);
|
| SpdyAltSvcIR altsvc_ir(1);
|
| SpdyAltSvcWireFormat::AlternativeService altsvc1(
|
| @@ -6151,10 +4205,6 @@ TEST_P(SpdyFramerTest, ReadChunkedAltSvcFrame) {
|
|
|
| // Tests handling of PRIORITY frames.
|
| TEST_P(SpdyFramerTest, ReadPriority) {
|
| - if (!IsHttp2()) {
|
| - return;
|
| - }
|
| -
|
| SpdyFramer framer(spdy_version_);
|
| SpdyPriorityIR priority(3, 1, 256, false);
|
| SpdySerializedFrame frame(framer.SerializePriority(priority));
|
| @@ -6172,10 +4222,6 @@ TEST_P(SpdyFramerTest, ReadPriority) {
|
|
|
| // Tests handling of PRIORITY frame with incorrect size.
|
| TEST_P(SpdyFramerTest, ReadIncorrectlySizedPriority) {
|
| - if (!IsHttp2()) {
|
| - return;
|
| - }
|
| -
|
| // PRIORITY frame of size 4, which isn't correct.
|
| const unsigned char kFrameData[] = {
|
| 0x00, 0x00, 0x04, // Length: 4
|
| @@ -6196,10 +4242,6 @@ TEST_P(SpdyFramerTest, ReadIncorrectlySizedPriority) {
|
|
|
| // Tests handling of PING frame with incorrect size.
|
| TEST_P(SpdyFramerTest, ReadIncorrectlySizedPing) {
|
| - if (!IsHttp2()) {
|
| - return;
|
| - }
|
| -
|
| // PING frame of size 4, which isn't correct.
|
| const unsigned char kFrameData[] = {
|
| 0x00, 0x00, 0x04, // Length: 4
|
| @@ -6220,10 +4262,6 @@ TEST_P(SpdyFramerTest, ReadIncorrectlySizedPing) {
|
|
|
| // Tests handling of WINDOW_UPDATE frame with incorrect size.
|
| TEST_P(SpdyFramerTest, ReadIncorrectlySizedWindowUpdate) {
|
| - if (!IsHttp2()) {
|
| - return;
|
| - }
|
| -
|
| // WINDOW_UPDATE frame of size 3, which isn't correct.
|
| const unsigned char kFrameData[] = {
|
| 0x00, 0x00, 0x03, // Length: 3
|
| @@ -6244,10 +4282,6 @@ TEST_P(SpdyFramerTest, ReadIncorrectlySizedWindowUpdate) {
|
|
|
| // Tests handling of RST_STREAM frame with incorrect size.
|
| TEST_P(SpdyFramerTest, ReadIncorrectlySizedRstStream) {
|
| - if (!IsHttp2()) {
|
| - return;
|
| - }
|
| -
|
| // RST_STREAM frame of size 3, which isn't correct.
|
| const unsigned char kFrameData[] = {
|
| 0x00, 0x00, 0x03, // Length: 3
|
|
|