diff options
author | rtenneti@chromium.org <rtenneti@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-07 03:59:25 +0000 |
---|---|---|
committer | rtenneti@chromium.org <rtenneti@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-07 03:59:25 +0000 |
commit | f3ad0a96cd18bb7e902af9fefc8a84570dca5e5d (patch) | |
tree | 7e597c7eb879989fe1f105f79b74205984a60792 /net | |
parent | 0c9ebdff295bc500acd1dbc3db162be7bccb7ac1 (diff) | |
download | chromium_src-f3ad0a96cd18bb7e902af9fefc8a84570dca5e5d.zip chromium_src-f3ad0a96cd18bb7e902af9fefc8a84570dca5e5d.tar.gz chromium_src-f3ad0a96cd18bb7e902af9fefc8a84570dca5e5d.tar.bz2 |
SPDY - delete unused code from spdy_framer.
- Deleted all code associated with SPDY_INTERPRET_CONTROL_FRAME_COMMON_HEADER
- Deleted OldProcessControlFrameHeaderBlock and
OldIncrementallyDecompressControlFrameHeaderData
- Changed unittests to reflect the above changes. Deleted uses of ParseHeaderBlock
(server code doesn't use ParseHeaderBlock).
BUG=108608
R=wtc
TEST=network unit tests.
Review URL: http://codereview.chromium.org/9124022
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@116814 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r-- | net/spdy/spdy_framer.cc | 132 | ||||
-rw-r--r-- | net/spdy/spdy_framer.h | 12 | ||||
-rw-r--r-- | net/spdy/spdy_framer_test.cc | 214 |
3 files changed, 42 insertions, 316 deletions
diff --git a/net/spdy/spdy_framer.cc b/net/spdy/spdy_framer.cc index f0d4efdf..958cb92 100644 --- a/net/spdy/spdy_framer.cc +++ b/net/spdy/spdy_framer.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -180,8 +180,6 @@ const char* SpdyFramer::StateToString(int state) { return "RESET"; case SPDY_READING_COMMON_HEADER: return "READING_COMMON_HEADER"; - case SPDY_INTERPRET_CONTROL_FRAME_COMMON_HEADER: - return "INTERPRET_CONTROL_FRAME_COMMON_HEADER"; case SPDY_CONTROL_FRAME_PAYLOAD: return "CONTROL_FRAME_PAYLOAD"; case SPDY_IGNORE_REMAINING_PAYLOAD: @@ -299,26 +297,15 @@ size_t SpdyFramer::ProcessInput(const char* data, size_t len) { continue; } - // Arguably, this case is not necessary, as no bytes are consumed here. - // I felt it was a nice partitioning, however (which probably indicates - // that it should be refactored into its own function!) - // TODO(hkhalil): Remove -- while loop above prevents proper handling of - // zero-length control frames. - case SPDY_INTERPRET_CONTROL_FRAME_COMMON_HEADER: - ProcessControlFrameHeader(); - continue; - case SPDY_CONTROL_FRAME_BEFORE_HEADER_BLOCK: { // Control frames that contain header blocks (SYN_STREAM, SYN_REPLY, // HEADERS) take a different path through the state machine - they // will go: - // 1. SPDY_INTERPRET_CONTROL_FRAME_COMMON HEADER - // 2. SPDY_CONTROL_FRAME_BEFORE_HEADER_BLOCK - // 3. SPDY_CONTROL_FRAME_HEADER_BLOCK + // 1. SPDY_CONTROL_FRAME_BEFORE_HEADER_BLOCK + // 2. SPDY_CONTROL_FRAME_HEADER_BLOCK // - // All other control frames will use the alternate route: - // 1. SPDY_INTERPRET_CONTROL_FRAME_COMMON_HEADER - // 2. SPDY_CONTROL_FRAME_PAYLOAD + // All other control frames will use the alternate route directly to + // SPDY_CONTROL_FRAME_PAYLOAD int bytes_read = ProcessControlFrameBeforeHeaderBlock(data, len); len -= bytes_read; data += bytes_read; @@ -637,56 +624,6 @@ size_t SpdyFramer::ProcessControlFrameHeaderBlock(const char* data, return process_bytes; } -size_t SpdyFramer::OldProcessControlFrameHeaderBlock(const char* data, - size_t data_len) { - DCHECK_EQ(SPDY_CONTROL_FRAME_HEADER_BLOCK, state_); - size_t original_data_len = data_len; - SpdyControlFrame control_frame(current_frame_buffer_, false); - bool read_successfully = true; - DCHECK(control_frame.type() == SYN_STREAM || - control_frame.type() == SYN_REPLY || - control_frame.type() == HEADERS); - - if (enable_compression_) { - // Note that the header block is held in the frame's payload, and is not - // part of the frame's headers. - if (remaining_control_payload_ > 0) { - size_t bytes_read = UpdateCurrentFrameBuffer( - &data, - &data_len, - remaining_control_payload_); - remaining_control_payload_ -= bytes_read; - if (remaining_control_payload_ == 0) { - read_successfully = OldIncrementallyDecompressControlFrameHeaderData( - &control_frame); - } - } - } else { - size_t bytes_to_send = std::min(data_len, remaining_control_payload_); - DCHECK_GT(bytes_to_send, 0u); - read_successfully = IncrementallyDeliverControlFrameHeaderData( - &control_frame, data, bytes_to_send); - data_len -= bytes_to_send; - remaining_control_payload_ -= bytes_to_send; - } - if (remaining_control_payload_ == 0 && read_successfully) { - // The complete header block has been delivered. - visitor_->OnControlFrameHeaderData(&control_frame, NULL, 0); - - // If this is a FIN, tell the caller. - if (control_frame.flags() & CONTROL_FLAG_FIN) { - visitor_->OnStreamFrameData(GetControlFrameStreamId(&control_frame), - NULL, 0); - } - - CHANGE_STATE(SPDY_RESET); - } - if (!read_successfully) { - return original_data_len; - } - return original_data_len - data_len; -} - size_t SpdyFramer::ProcessControlFramePayload(const char* data, size_t len) { size_t original_len = len; if (remaining_control_payload_) { @@ -699,14 +636,6 @@ size_t SpdyFramer::ProcessControlFramePayload(const char* data, size_t len) { DCHECK(!control_frame.has_header_block()); visitor_->OnControl(&control_frame); - // If this is a FIN, tell the caller. - if (control_frame.type() == SYN_REPLY && - control_frame.flags() & CONTROL_FLAG_FIN) { - visitor_->OnStreamFrameData(reinterpret_cast<SpdySynReplyControlFrame*>( - &control_frame)->stream_id(), - NULL, 0); - } - CHANGE_STATE(SPDY_IGNORE_REMAINING_PAYLOAD); } } @@ -1574,55 +1503,6 @@ SpdyFrame* SpdyFramer::DecompressFrameWithZStream(const SpdyFrame& frame, // result to the visitor in chunks. Continue this until the visitor // indicates that it cannot process any more data, or (more commonly) we // run out of data to deliver. -bool SpdyFramer::OldIncrementallyDecompressControlFrameHeaderData( - const SpdyControlFrame* control_frame) { - z_stream* decomp = GetHeaderDecompressor(); - int payload_length; - int header_length; - const char* payload; - bool read_successfully = true; - bool more = true; - char buffer[kHeaderDataChunkMaxSize]; - - if (!GetFrameBoundaries( - *control_frame, &payload_length, &header_length, &payload)) { - DLOG(ERROR) << "Control frame of type " - << SpdyFramer::ControlTypeToString(control_frame->type()) - <<" doesn't have headers"; - return false; - } - decomp->next_in = reinterpret_cast<Bytef*>(const_cast<char*>(payload)); - decomp->avail_in = payload_length; - const SpdyStreamId stream_id = GetControlFrameStreamId(control_frame); - DCHECK_LT(0u, stream_id); - while (more && read_successfully) { - decomp->next_out = reinterpret_cast<Bytef*>(buffer); - decomp->avail_out = arraysize(buffer); - int rv = DecompressHeaderBlockInZStream(decomp); - if (rv != Z_OK) { - set_error(SPDY_DECOMPRESS_FAILURE); - DLOG(WARNING) << "inflate failure: " << rv; - more = read_successfully = false; - } else { - DCHECK_GT(arraysize(buffer), decomp->avail_out); - size_t len = arraysize(buffer) - decomp->avail_out; - read_successfully = visitor_->OnControlFrameHeaderData( - control_frame, buffer, len); - if (!read_successfully) { - // Assume that the problem was the header block was too large for the - // visitor. - set_error(SPDY_CONTROL_PAYLOAD_TOO_LARGE); - } - more = decomp->avail_in > 0; - } - } - return read_successfully; -} - -// Incrementally decompress the control frame's header block, feeding the -// result to the visitor in chunks. Continue this until the visitor -// indicates that it cannot process any more data, or (more commonly) we -// run out of data to deliver. bool SpdyFramer::IncrementallyDecompressControlFrameHeaderData( const SpdyControlFrame* control_frame, const char* data, @@ -1817,8 +1697,6 @@ size_t SpdyFramer::BytesSafeToRead() const { DCHECK_LT(current_frame_len_, static_cast<size_t>(SpdyFrame::kHeaderSize)); return SpdyFrame::kHeaderSize - current_frame_len_; - case SPDY_INTERPRET_CONTROL_FRAME_COMMON_HEADER: - return 0; // TODO(rtenneti): Add support for SPDY_CONTROL_FRAME_BEFORE_HEADER_BLOCK // and SPDY_CONTROL_FRAME_HEADER_BLOCK. case SPDY_CONTROL_FRAME_BEFORE_HEADER_BLOCK: diff --git a/net/spdy/spdy_framer.h b/net/spdy/spdy_framer.h index 3e16502..4ae2ab3 100644 --- a/net/spdy/spdy_framer.h +++ b/net/spdy/spdy_framer.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -150,7 +150,6 @@ class NET_EXPORT_PRIVATE SpdyFramer { SPDY_RESET, SPDY_AUTO_RESET, SPDY_READING_COMMON_HEADER, - SPDY_INTERPRET_CONTROL_FRAME_COMMON_HEADER, SPDY_CONTROL_FRAME_PAYLOAD, SPDY_IGNORE_REMAINING_PAYLOAD, SPDY_FORWARD_STREAM_FRAME, @@ -383,7 +382,7 @@ class NET_EXPORT_PRIVATE SpdyFramer { static const int kDictionarySize; protected: - FRIEND_TEST_ALL_PREFIXES(SpdyFramerTest, DataCompression); + FRIEND_TEST_ALL_PREFIXES(SpdyFramerTest, HeaderCompression); FRIEND_TEST_ALL_PREFIXES(SpdyFramerTest, ExpandBuffer_HeapSmash); FRIEND_TEST_ALL_PREFIXES(SpdyFramerTest, HugeHeaderBlock); FRIEND_TEST_ALL_PREFIXES(SpdyFramerTest, UnclosedStreamDataCompressors); @@ -412,7 +411,6 @@ class NET_EXPORT_PRIVATE SpdyFramer { size_t ProcessCredentialFramePayload(const char* data, size_t len); size_t ProcessControlFrameBeforeHeaderBlock(const char* data, size_t len); size_t ProcessControlFrameHeaderBlock(const char* data, size_t len); - size_t OldProcessControlFrameHeaderBlock(const char* data, size_t len); size_t ProcessDataFramePayload(const char* data, size_t len); // Get (and lazily initialize) the ZLib state. @@ -440,12 +438,6 @@ class NET_EXPORT_PRIVATE SpdyFramer { // Deliver the given control frame's compressed headers block to the visitor // in decompressed form, in chunks. Returns true if the visitor has // accepted all of the chunks. - bool OldIncrementallyDecompressControlFrameHeaderData( - const SpdyControlFrame* frame); - - // Deliver the given control frame's compressed headers block to the visitor - // in decompressed form, in chunks. Returns true if the visitor has - // accepted all of the chunks. bool IncrementallyDecompressControlFrameHeaderData( const SpdyControlFrame* frame, const char* data, diff --git a/net/spdy/spdy_framer_test.cc b/net/spdy/spdy_framer_test.cc index c6fccb3..389c90e 100644 --- a/net/spdy/spdy_framer_test.cc +++ b/net/spdy/spdy_framer_test.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -382,26 +382,6 @@ class SpdyFramerTest : public PlatformTest { }; -// Test that we can encode and decode a SpdyHeaderBlock. -TEST_F(SpdyFramerTest, HeaderBlock) { - SpdyHeaderBlock headers; - headers["alpha"] = "beta"; - headers["gamma"] = "charlie"; - SpdyFramer framer; - - // Encode the header block into a SynStream frame. - scoped_ptr<SpdySynStreamControlFrame> frame( - framer.CreateSynStream(1, 0, 1, CONTROL_FLAG_NONE, true, &headers)); - EXPECT_TRUE(frame.get() != NULL); - - SpdyHeaderBlock new_headers; - EXPECT_TRUE(framer.ParseHeaderBlock(frame.get(), &new_headers)); - - EXPECT_EQ(headers.size(), new_headers.size()); - EXPECT_EQ(headers["alpha"], new_headers["alpha"]); - EXPECT_EQ(headers["gamma"], new_headers["gamma"]); -} - // Test that we can encode and decode a SpdyHeaderBlock in serialized form. TEST_F(SpdyFramerTest, HeaderBlockInBuffer) { SpdyHeaderBlock headers; @@ -477,49 +457,6 @@ TEST_F(SpdyFramerTest, OutOfOrderHeaders) { &new_headers)); } -TEST_F(SpdyFramerTest, WrongNumberOfHeaders) { - SpdyFrameBuilder frame1; - SpdyFrameBuilder frame2; - - // a frame with smaller number of actual headers - frame1.WriteUInt16(kControlFlagMask | 1); - frame1.WriteUInt16(SYN_STREAM); - frame1.WriteUInt32(0); // Placeholder for the length. - frame1.WriteUInt32(3); // stream_id - frame1.WriteUInt16(0); // Priority. - - frame1.WriteUInt16(1); // Wrong number of headers (underflow) - frame1.WriteString("gamma"); - frame1.WriteString("gamma"); - frame1.WriteString("alpha"); - frame1.WriteString("alpha"); - // write the length - frame1.WriteUInt32ToOffset(4, frame1.length() - SpdyFrame::kHeaderSize); - - // a frame with larger number of actual headers - frame2.WriteUInt16(kControlFlagMask | 1); - frame2.WriteUInt16(SYN_STREAM); - frame2.WriteUInt32(0); // Placeholder for the length. - frame2.WriteUInt32(3); // stream_id - frame2.WriteUInt16(0); // Priority. - - frame2.WriteUInt16(100); // Wrong number of headers (overflow) - frame2.WriteString("gamma"); - frame2.WriteString("gamma"); - frame2.WriteString("alpha"); - frame2.WriteString("alpha"); - // write the length - frame2.WriteUInt32ToOffset(4, frame2.length() - SpdyFrame::kHeaderSize); - - SpdyHeaderBlock new_headers; - scoped_ptr<SpdyFrame> syn_frame1(frame1.take()); - scoped_ptr<SpdyFrame> syn_frame2(frame2.take()); - SpdyFramer framer; - framer.set_enable_compression(false); - EXPECT_FALSE(framer.ParseHeaderBlock(syn_frame1.get(), &new_headers)); - EXPECT_FALSE(framer.ParseHeaderBlock(syn_frame2.get(), &new_headers)); -} - TEST_F(SpdyFramerTest, DuplicateHeader) { // Frame builder with plentiful buffer size. SpdyFrameBuilder frame(1024); @@ -586,34 +523,6 @@ TEST_F(SpdyFramerTest, MultiValueHeader) { EXPECT_EQ(value, new_headers.find("name")->second); } -TEST_F(SpdyFramerTest, ZeroLengthHeader) { - SpdyHeaderBlock header1; - SpdyHeaderBlock header2; - SpdyHeaderBlock header3; - - header1[""] = "value2"; - header2["name3"] = ""; - header3[""] = ""; - - SpdyFramer framer; - SpdyHeaderBlock parsed_headers; - - scoped_ptr<SpdySynStreamControlFrame> frame1( - framer.CreateSynStream(1, 0, 1, CONTROL_FLAG_NONE, true, &header1)); - EXPECT_TRUE(frame1.get() != NULL); - EXPECT_FALSE(framer.ParseHeaderBlock(frame1.get(), &parsed_headers)); - - scoped_ptr<SpdySynStreamControlFrame> frame2( - framer.CreateSynStream(1, 0, 1, CONTROL_FLAG_NONE, true, &header2)); - EXPECT_TRUE(frame2.get() != NULL); - EXPECT_FALSE(framer.ParseHeaderBlock(frame2.get(), &parsed_headers)); - - scoped_ptr<SpdySynStreamControlFrame> frame3( - framer.CreateSynStream(1, 0, 1, CONTROL_FLAG_NONE, true, &header3)); - EXPECT_TRUE(frame3.get() != NULL); - EXPECT_FALSE(framer.ParseHeaderBlock(frame3.get(), &parsed_headers)); -} - TEST_F(SpdyFramerTest, BasicCompression) { SpdyHeaderBlock headers; headers["server"] = "SpdyServer 1.0"; @@ -824,15 +733,13 @@ TEST_F(SpdyFramerTest, FinOnSynReplyFrame) { EXPECT_EQ(0, visitor.data_frame_count_); } -// Basic compression & decompression -TEST_F(SpdyFramerTest, DataCompression) { +TEST_F(SpdyFramerTest, HeaderCompression) { SpdyFramer send_framer; SpdyFramer recv_framer; send_framer.set_enable_compression(true); recv_framer.set_enable_compression(true); - // Mix up some SYNs and DATA frames since they use different compressors. const char kHeader1[] = "header1"; const char kHeader2[] = "header2"; const char kHeader3[] = "header3"; @@ -849,76 +756,64 @@ TEST_F(SpdyFramerTest, DataCompression) { send_framer.CreateSynStream(1, 0, 0, flags, true, &block)); EXPECT_TRUE(syn_frame_1.get() != NULL); - // DATA #1 - const char bytes[] = "this is a test test test test test!"; - scoped_ptr<SpdyFrame> data_frame_1( - send_framer.CreateDataFrame(1, bytes, arraysize(bytes), - DATA_FLAG_COMPRESSED)); - EXPECT_TRUE(data_frame_1.get() != NULL); - // SYN_STREAM #2 block[kHeader3] = kValue3; - scoped_ptr<SpdyFrame> syn_frame_2( + scoped_ptr<spdy::SpdyFrame> syn_frame_2( send_framer.CreateSynStream(3, 0, 0, flags, true, &block)); EXPECT_TRUE(syn_frame_2.get() != NULL); - // DATA #2 - scoped_ptr<SpdyFrame> data_frame_2( - send_framer.CreateDataFrame(3, bytes, arraysize(bytes), - DATA_FLAG_COMPRESSED)); - EXPECT_TRUE(data_frame_2.get() != NULL); - // Now start decompressing scoped_ptr<SpdyFrame> decompressed; - SpdyControlFrame* control_frame; - SpdyDataFrame* data_frame; + scoped_ptr<SpdyFrame> decompressed_syn_frame; + SpdySynStreamControlFrame* syn_frame; + scoped_ptr<std::string> serialized_headers; SpdyHeaderBlock decompressed_headers; - decompressed.reset(recv_framer.DuplicateFrame(*syn_frame_1.get())); + // Decompress SYN_STREAM #1 + decompressed.reset(recv_framer.DecompressFrame(*syn_frame_1.get())); EXPECT_TRUE(decompressed.get() != NULL); EXPECT_TRUE(decompressed->is_control_frame()); - control_frame = reinterpret_cast<SpdyControlFrame*>(decompressed.get()); - EXPECT_EQ(SYN_STREAM, control_frame->type()); - EXPECT_TRUE(recv_framer.ParseHeaderBlock( - control_frame, &decompressed_headers)); + EXPECT_EQ(SYN_STREAM, + reinterpret_cast<SpdyControlFrame*>(decompressed.get())->type()); + decompressed_syn_frame.reset( + new SpdySynStreamControlFrame(decompressed->data(), false)); + syn_frame = reinterpret_cast<SpdySynStreamControlFrame*>( + decompressed_syn_frame.get()); + serialized_headers.reset(new std::string(syn_frame->header_block(), + syn_frame->header_block_len())); + EXPECT_TRUE(recv_framer.ParseHeaderBlockInBuffer(serialized_headers->c_str(), + serialized_headers->size(), + &decompressed_headers)); EXPECT_EQ(2u, decompressed_headers.size()); - EXPECT_EQ(SYN_STREAM, control_frame->type()); EXPECT_EQ(kValue1, decompressed_headers[kHeader1]); EXPECT_EQ(kValue2, decompressed_headers[kHeader2]); - decompressed.reset(recv_framer.DecompressFrame(*data_frame_1.get())); - EXPECT_TRUE(decompressed.get() != NULL); - EXPECT_FALSE(decompressed->is_control_frame()); - data_frame = reinterpret_cast<SpdyDataFrame*>(decompressed.get()); - EXPECT_EQ(arraysize(bytes), data_frame->length()); - EXPECT_EQ(0, memcmp(data_frame->payload(), bytes, data_frame->length())); - - decompressed.reset(recv_framer.DuplicateFrame(*syn_frame_2.get())); + // Decompress SYN_STREAM #2 + decompressed.reset(recv_framer.DecompressFrame(*syn_frame_2.get())); EXPECT_TRUE(decompressed.get() != NULL); EXPECT_TRUE(decompressed->is_control_frame()); - control_frame = reinterpret_cast<SpdyControlFrame*>(decompressed.get()); - EXPECT_EQ(control_frame->type(), SYN_STREAM); + EXPECT_EQ(SYN_STREAM, + reinterpret_cast<SpdyControlFrame*>(decompressed.get())->type()); + decompressed_syn_frame.reset( + new SpdySynStreamControlFrame(decompressed->data(), false)); + syn_frame = reinterpret_cast<SpdySynStreamControlFrame*>( + decompressed_syn_frame.get()); + serialized_headers.reset(new std::string(syn_frame->header_block(), + syn_frame->header_block_len())); decompressed_headers.clear(); - EXPECT_TRUE(recv_framer.ParseHeaderBlock( - control_frame, &decompressed_headers)); + EXPECT_TRUE(recv_framer.ParseHeaderBlockInBuffer(serialized_headers->c_str(), + serialized_headers->size(), + &decompressed_headers)); EXPECT_EQ(3u, decompressed_headers.size()); - EXPECT_EQ(SYN_STREAM, control_frame->type()); EXPECT_EQ(kValue1, decompressed_headers[kHeader1]); EXPECT_EQ(kValue2, decompressed_headers[kHeader2]); EXPECT_EQ(kValue3, decompressed_headers[kHeader3]); - decompressed.reset(recv_framer.DecompressFrame(*data_frame_2.get())); - EXPECT_TRUE(decompressed.get() != NULL); - EXPECT_FALSE(decompressed->is_control_frame()); - data_frame = reinterpret_cast<SpdyDataFrame*>(decompressed.get()); - EXPECT_EQ(arraysize(bytes), data_frame->length()); - EXPECT_EQ(0, memcmp(data_frame->payload(), bytes, data_frame->length())); - - // We didn't close these streams, so the compressors should be active. - EXPECT_EQ(2, send_framer.num_stream_compressors()); + // We didn't have data streams, so we shouldn't have (de)compressors. + EXPECT_EQ(0, send_framer.num_stream_compressors()); EXPECT_EQ(0, send_framer.num_stream_decompressors()); EXPECT_EQ(0, recv_framer.num_stream_compressors()); - EXPECT_EQ(2, recv_framer.num_stream_decompressors()); + EXPECT_EQ(0, recv_framer.num_stream_decompressors()); } // Verify we don't leak when we leave streams unclosed @@ -1887,9 +1782,6 @@ TEST(SpdyFramer, StateToStringTest) { EXPECT_STREQ("READING_COMMON_HEADER", SpdyFramer::StateToString( SpdyFramer::SPDY_READING_COMMON_HEADER)); - EXPECT_STREQ("INTERPRET_CONTROL_FRAME_COMMON_HEADER", - SpdyFramer::StateToString( - SpdyFramer::SPDY_INTERPRET_CONTROL_FRAME_COMMON_HEADER)); EXPECT_STREQ("CONTROL_FRAME_PAYLOAD", SpdyFramer::StateToString( SpdyFramer::SPDY_CONTROL_FRAME_PAYLOAD)); @@ -2016,40 +1908,4 @@ std::string RandomString(int length) { return rv; } -// Stress that we can handle a really large header block compression and -// decompression. -TEST_F(SpdyFramerTest, DISABLED_HugeHeaderBlock) { - // Loop targetting various sizes which will potentially jam up the - // frame compressor/decompressor. - SpdyFramer compress_framer; - SpdyFramer decompress_framer; - for (size_t target_size = 1024; - target_size < SpdyFramer::kControlFrameBufferInitialSize; - target_size += 1024) { - SpdyHeaderBlock headers; - for (size_t index = 0; index < target_size; ++index) { - std::string name = RandomString(4); - std::string value = RandomString(8); - headers[name] = value; - } - - // Encode the header block into a SynStream frame. - scoped_ptr<SpdySynStreamControlFrame> frame( - compress_framer.CreateSynStream(1, - 0, - 1, - CONTROL_FLAG_NONE, - true, - &headers)); - // The point of this test is to exercise the limits. So, it is ok if the - // frame was too large to encode, or if the decompress fails. We just want - // to make sure we don't crash. - if (frame.get() != NULL) { - // Now that same header block should decompress just fine. - SpdyHeaderBlock new_headers; - decompress_framer.ParseHeaderBlock(frame.get(), &new_headers); - } - } -} - } // namespace |