diff options
author | rch@chromium.org <rch@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-19 00:50:04 +0000 |
---|---|---|
committer | rch@chromium.org <rch@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-19 00:50:04 +0000 |
commit | 38dfd13a2886bd4f002d79d807883c9762f06f44 (patch) | |
tree | b784bd7aa409350de95207c4f256a3a2a8905713 /net/spdy/spdy_write_queue_unittest.cc | |
parent | a71d32455848293246db0766650151a2db3c13d4 (diff) | |
download | chromium_src-38dfd13a2886bd4f002d79d807883c9762f06f44.zip chromium_src-38dfd13a2886bd4f002d79d807883c9762f06f44.tar.gz chromium_src-38dfd13a2886bd4f002d79d807883c9762f06f44.tar.bz2 |
Correctly handle SPDY GOAWAY frames.
Review URL: https://chromiumcodereview.appspot.com/14232014
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@195032 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/spdy/spdy_write_queue_unittest.cc')
-rw-r--r-- | net/spdy/spdy_write_queue_unittest.cc | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/net/spdy/spdy_write_queue_unittest.cc b/net/spdy/spdy_write_queue_unittest.cc index c98074f..564cdbe 100644 --- a/net/spdy/spdy_write_queue_unittest.cc +++ b/net/spdy/spdy_write_queue_unittest.cc @@ -178,6 +178,49 @@ TEST_F(SpdyWriteQueueTest, RemovePendingWritesForStream) { EXPECT_FALSE(write_queue.Dequeue(&frame_type, &frame_producer, &stream)); } +// Enqueue a bunch of writes and then call +// RemovePendingWritesForStreamsAfter(). No dequeued write should be for +// those streams without a stream id, or with a stream_id after that +// argument. +TEST_F(SpdyWriteQueueTest, RemovePendingWritesForStreamsAfter) { + SpdyWriteQueue write_queue; + + scoped_refptr<SpdyStream> stream1(MakeTestStream(DEFAULT_PRIORITY)); + stream1->set_stream_id(1); + scoped_refptr<SpdyStream> stream2(MakeTestStream(DEFAULT_PRIORITY)); + stream2->set_stream_id(3); + scoped_refptr<SpdyStream> stream3(MakeTestStream(DEFAULT_PRIORITY)); + stream3->set_stream_id(5); + // No stream id assigned. + scoped_refptr<SpdyStream> stream4(MakeTestStream(DEFAULT_PRIORITY)); + scoped_refptr<SpdyStream> streams[] = { + stream1, stream2, stream3, stream4 + }; + + for (int i = 0; i < 100; ++i) { + scoped_refptr<SpdyStream> stream = streams[i % arraysize(streams)]; + write_queue.Enqueue(DEFAULT_PRIORITY, SYN_STREAM, IntToProducer(i), stream); + } + + write_queue.RemovePendingWritesForStreamsAfter(stream1->stream_id()); + + for (int i = 0; i < 100; i += arraysize(streams)) { + SpdyFrameType frame_type = DATA; + scoped_ptr<SpdyBufferProducer> frame_producer; + scoped_refptr<SpdyStream> stream; + ASSERT_TRUE(write_queue.Dequeue(&frame_type, &frame_producer, &stream)) + << "Unable to Dequeue i: " << i; + EXPECT_EQ(SYN_STREAM, frame_type); + EXPECT_EQ(i, ProducerToInt(frame_producer.Pass())); + EXPECT_EQ(stream1, stream); + } + + SpdyFrameType frame_type = DATA; + scoped_ptr<SpdyBufferProducer> frame_producer; + scoped_refptr<SpdyStream> stream; + EXPECT_FALSE(write_queue.Dequeue(&frame_type, &frame_producer, &stream)); +} + // Enqueue a bunch of writes and then call Clear(). The write queue // should clean up the memory properly, and Dequeue() should return // false. |