| Index: net/spdy/spdy_framer_test.cc
|
| diff --git a/net/spdy/spdy_framer_test.cc b/net/spdy/spdy_framer_test.cc
|
| index ef69dd39c9fb3ae11fd641338bdf205836edfe25..fe052d50af450587dcfc337ebedc4e9fce0318d4 100644
|
| --- a/net/spdy/spdy_framer_test.cc
|
| +++ b/net/spdy/spdy_framer_test.cc
|
| @@ -359,12 +359,12 @@ class TestSpdyVisitor : public SpdyFramerVisitorInterface,
|
| }
|
|
|
| virtual void OnSettingsAck() OVERRIDE {
|
| - DCHECK_GE(4, framer_.protocol_version());
|
| + DCHECK_LT(SPDY3, framer_.protocol_version());
|
| ++settings_ack_received_;
|
| }
|
|
|
| virtual void OnSettingsEnd() OVERRIDE {
|
| - if (framer_.protocol_version() < 4) { return; }
|
| + if (framer_.protocol_version() <= SPDY3) { return; }
|
| ++settings_ack_sent_;
|
| }
|
|
|
| @@ -552,7 +552,8 @@ class SpdyFramerTest : public ::testing::TestWithParam<SpdyMajorVersion> {
|
| protected:
|
| virtual void SetUp() {
|
| spdy_version_ = GetParam();
|
| - spdy_version_ch_ = static_cast<unsigned char>(spdy_version_);
|
| + spdy_version_ch_ = static_cast<unsigned char>(
|
| + SpdyConstants::SerializeMajorVersion(spdy_version_));
|
| }
|
|
|
| void CompareFrame(const string& description,
|
| @@ -785,7 +786,7 @@ TEST_P(SpdyFramerTest, HeadersWithStreamIdZero) {
|
| // Test that if we receive a PUSH_PROMISE with stream ID zero, we signal an
|
| // error (but don't crash).
|
| TEST_P(SpdyFramerTest, PushPromiseWithStreamIdZero) {
|
| - if (spdy_version_ < SPDY4) {
|
| + if (spdy_version_ <= SPDY3) {
|
| return;
|
| }
|
|
|
| @@ -810,7 +811,7 @@ TEST_P(SpdyFramerTest, PushPromiseWithStreamIdZero) {
|
| // Test that if we receive a PUSH_PROMISE with promised stream ID zero, we
|
| // signal an error (but don't crash).
|
| TEST_P(SpdyFramerTest, PushPromiseWithPromisedStreamIdZero) {
|
| - if (spdy_version_ < SPDY4) {
|
| + if (spdy_version_ <= SPDY3) {
|
| return;
|
| }
|
|
|
| @@ -833,7 +834,7 @@ TEST_P(SpdyFramerTest, PushPromiseWithPromisedStreamIdZero) {
|
| }
|
|
|
| TEST_P(SpdyFramerTest, DuplicateHeader) {
|
| - if (spdy_version_ >= 4) {
|
| + if (spdy_version_ > SPDY3) {
|
| // 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.
|
| @@ -842,7 +843,7 @@ TEST_P(SpdyFramerTest, DuplicateHeader) {
|
| SpdyFramer framer(spdy_version_);
|
| // Frame builder with plentiful buffer size.
|
| SpdyFrameBuilder frame(1024, spdy_version_);
|
| - if (spdy_version_ < 4) {
|
| + if (spdy_version_ <= SPDY3) {
|
| frame.WriteControlFrameHeader(framer, SYN_STREAM, CONTROL_FLAG_NONE);
|
| frame.WriteUInt32(3); // stream_id
|
| frame.WriteUInt32(0); // associated stream id
|
| @@ -883,7 +884,7 @@ TEST_P(SpdyFramerTest, MultiValueHeader) {
|
| SpdyFramer framer(spdy_version_);
|
| // Frame builder with plentiful buffer size.
|
| SpdyFrameBuilder frame(1024, spdy_version_);
|
| - if (spdy_version_ < 4) {
|
| + if (spdy_version_ <= SPDY3) {
|
| frame.WriteControlFrameHeader(framer, SYN_STREAM, CONTROL_FLAG_NONE);
|
| frame.WriteUInt32(3); // stream_id
|
| frame.WriteUInt32(0); // associated stream id
|
| @@ -901,7 +902,7 @@ TEST_P(SpdyFramerTest, MultiValueHeader) {
|
| frame.WriteUInt16(1); // Number of headers.
|
| frame.WriteString("name");
|
| frame.WriteString(value);
|
| - } else if (spdy_version_ >= 4) {
|
| + } else if (spdy_version_ > SPDY3) {
|
| HpackOutputStream output_stream(1024);
|
| output_stream.AppendLiteralHeaderNoIndexingWithName("name", value);
|
| string buffer;
|
| @@ -929,7 +930,7 @@ TEST_P(SpdyFramerTest, MultiValueHeader) {
|
| }
|
|
|
| TEST_P(SpdyFramerTest, BasicCompression) {
|
| - if (spdy_version_ >= 4) {
|
| + if (spdy_version_ > SPDY3) {
|
| // Deflate compression doesn't apply to HPACK.
|
| return;
|
| }
|
| @@ -1404,7 +1405,7 @@ TEST_P(SpdyFramerTest, FinOnSynReplyFrame) {
|
| }
|
|
|
| TEST_P(SpdyFramerTest, HeaderCompression) {
|
| - if (spdy_version_ >= 4) {
|
| + if (spdy_version_ > SPDY3) {
|
| // Deflate compression doesn't apply to HPACK.
|
| return;
|
| }
|
| @@ -3111,7 +3112,7 @@ TEST_P(SpdyFramerTest, ReadCompressedHeadersHeaderBlockWithHalfClose) {
|
| }
|
|
|
| TEST_P(SpdyFramerTest, ControlFrameAtMaxSizeLimit) {
|
| - if (spdy_version_ >= 4) {
|
| + if (spdy_version_ > SPDY3) {
|
| // TODO(jgraettinger): This test setup doesn't work with HPACK.
|
| return;
|
| }
|
| @@ -3146,7 +3147,7 @@ TEST_P(SpdyFramerTest, ControlFrameAtMaxSizeLimit) {
|
| }
|
|
|
| TEST_P(SpdyFramerTest, ControlFrameTooLarge) {
|
| - if (spdy_version_ >= 4) {
|
| + if (spdy_version_ > SPDY3) {
|
| // TODO(jgraettinger): This test setup doesn't work with HPACK.
|
| return;
|
| }
|
| @@ -3287,7 +3288,7 @@ TEST_P(SpdyFramerTest, ControlFrameMuchTooLarge) {
|
| }
|
|
|
| TEST_P(SpdyFramerTest, DecompressCorruptHeaderBlock) {
|
| - if (spdy_version_ >= 4) {
|
| + if (spdy_version_ > SPDY3) {
|
| // Deflate compression doesn't apply to HPACK.
|
| return;
|
| }
|
| @@ -3366,7 +3367,7 @@ TEST_P(SpdyFramerTest, ReadZeroLenSettingsFrame) {
|
| visitor.SimulateInFramer(
|
| reinterpret_cast<unsigned char*>(control_frame->data()),
|
| framer.GetControlFrameHeaderSize());
|
| - if (spdy_version_ < 4) {
|
| + if (spdy_version_ <= SPDY3) {
|
| // Should generate an error, since zero-len settings frames are unsupported.
|
| EXPECT_EQ(1, visitor.error_count_);
|
| } else {
|
| @@ -3428,7 +3429,7 @@ TEST_P(SpdyFramerTest, ReadLargeSettingsFrame) {
|
| control_frame->size());
|
| EXPECT_EQ(0, visitor.error_count_);
|
| EXPECT_EQ(3, visitor.setting_count_);
|
| - if (spdy_version_ >= 4) {
|
| + if (spdy_version_ > SPDY3) {
|
| EXPECT_EQ(1, visitor.settings_ack_sent_);
|
| }
|
|
|
| @@ -3446,7 +3447,7 @@ TEST_P(SpdyFramerTest, ReadLargeSettingsFrame) {
|
| }
|
| EXPECT_EQ(0, visitor.error_count_);
|
| EXPECT_EQ(3 * 2, visitor.setting_count_);
|
| - if (spdy_version_ >= 4) {
|
| + if (spdy_version_ > SPDY3) {
|
| EXPECT_EQ(2, visitor.settings_ack_sent_);
|
| }
|
| }
|
| @@ -3569,7 +3570,7 @@ TEST_P(SpdyFramerTest, ReadOutOfOrderSettings) {
|
| }
|
|
|
| TEST_P(SpdyFramerTest, ProcessSettingsAckFrame) {
|
| - if (spdy_version_ < 4) {
|
| + if (spdy_version_ <= SPDY3) {
|
| return;
|
| }
|
| SpdyFramer framer(spdy_version_);
|
| @@ -3590,7 +3591,7 @@ TEST_P(SpdyFramerTest, ProcessSettingsAckFrame) {
|
|
|
|
|
| TEST_P(SpdyFramerTest, ProcessDataFrameWithPadding) {
|
| - if (spdy_version_ < 4) {
|
| + if (spdy_version_ <= SPDY3) {
|
| return;
|
| }
|
|
|
| @@ -3763,7 +3764,7 @@ TEST_P(SpdyFramerTest, CreateContinuation) {
|
| }
|
|
|
| TEST_P(SpdyFramerTest, ReadCompressedPushPromise) {
|
| - if (spdy_version_ < 4) {
|
| + if (spdy_version_ <= SPDY3) {
|
| return;
|
| }
|
|
|
| @@ -3786,7 +3787,7 @@ TEST_P(SpdyFramerTest, ReadCompressedPushPromise) {
|
| }
|
|
|
| TEST_P(SpdyFramerTest, ReadHeadersWithContinuation) {
|
| - if (spdy_version_ < 4) {
|
| + if (spdy_version_ <= SPDY3) {
|
| return;
|
| }
|
|
|
| @@ -3831,7 +3832,7 @@ TEST_P(SpdyFramerTest, ReadHeadersWithContinuation) {
|
| }
|
|
|
| TEST_P(SpdyFramerTest, ReadHeadersWithContinuationAndFin) {
|
| - if (spdy_version_ < 4) {
|
| + if (spdy_version_ <= SPDY3) {
|
| return;
|
| }
|
|
|
| @@ -3877,7 +3878,7 @@ TEST_P(SpdyFramerTest, ReadHeadersWithContinuationAndFin) {
|
| }
|
|
|
| TEST_P(SpdyFramerTest, ReadPushPromiseWithContinuation) {
|
| - if (spdy_version_ < 4) {
|
| + if (spdy_version_ <= SPDY3) {
|
| return;
|
| }
|
|
|
| @@ -3924,7 +3925,7 @@ TEST_P(SpdyFramerTest, ReadPushPromiseWithContinuation) {
|
| }
|
|
|
| TEST_P(SpdyFramerTest, ReadContinuationWithWrongStreamId) {
|
| - if (spdy_version_ < 4) {
|
| + if (spdy_version_ <= SPDY3) {
|
| return;
|
| }
|
|
|
| @@ -3960,7 +3961,7 @@ TEST_P(SpdyFramerTest, ReadContinuationWithWrongStreamId) {
|
| }
|
|
|
| TEST_P(SpdyFramerTest, ReadContinuationOutOfOrder) {
|
| - if (spdy_version_ < 4) {
|
| + if (spdy_version_ <= SPDY3) {
|
| return;
|
| }
|
|
|
| @@ -3987,7 +3988,7 @@ TEST_P(SpdyFramerTest, ReadContinuationOutOfOrder) {
|
| }
|
|
|
| TEST_P(SpdyFramerTest, ExpectContinuationReceiveData) {
|
| - if (spdy_version_ < 4) {
|
| + if (spdy_version_ <= SPDY3) {
|
| return;
|
| }
|
|
|
| @@ -4020,7 +4021,7 @@ TEST_P(SpdyFramerTest, ExpectContinuationReceiveData) {
|
| }
|
|
|
| TEST_P(SpdyFramerTest, ExpectContinuationReceiveControlFrame) {
|
| - if (spdy_version_ < 4) {
|
| + if (spdy_version_ <= SPDY3) {
|
| return;
|
| }
|
|
|
| @@ -4277,7 +4278,7 @@ TEST_P(SpdyFramerTest, CatchProbableHttpResponse) {
|
| }
|
|
|
| TEST_P(SpdyFramerTest, DataFrameFlagsV2V3) {
|
| - if (spdy_version_ >= 4) {
|
| + if (spdy_version_ > SPDY3) {
|
| return;
|
| }
|
|
|
| @@ -4317,7 +4318,7 @@ TEST_P(SpdyFramerTest, DataFrameFlagsV2V3) {
|
| }
|
|
|
| TEST_P(SpdyFramerTest, DataFrameFlagsV4) {
|
| - if (spdy_version_ < 4) {
|
| + if (spdy_version_ <= SPDY3) {
|
| return;
|
| }
|
|
|
| @@ -4515,7 +4516,7 @@ TEST_P(SpdyFramerTest, RstStreamFrameFlags) {
|
| }
|
|
|
| TEST_P(SpdyFramerTest, SettingsFrameFlagsOldFormat) {
|
| - if (spdy_version_ >= 4) { return; }
|
| + if (spdy_version_ > SPDY3) { return; }
|
| for (int flags = 0; flags < 256; ++flags) {
|
| SCOPED_TRACE(testing::Message() << "Flags " << flags);
|
|
|
| @@ -4556,7 +4557,7 @@ TEST_P(SpdyFramerTest, SettingsFrameFlagsOldFormat) {
|
| }
|
|
|
| TEST_P(SpdyFramerTest, SettingsFrameFlags) {
|
| - if (spdy_version_ < 4) { return; }
|
| + if (spdy_version_ <= SPDY3) { return; }
|
| for (int flags = 0; flags < 256; ++flags) {
|
| SCOPED_TRACE(testing::Message() << "Flags " << flags);
|
|
|
|
|