Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1393)

Unified Diff: net/quic/quic_session_test.cc

Issue 17302002: Land Recent QUIC changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/quic/quic_crypto_client_stream.cc ('k') | net/quic/quic_stream_sequencer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/quic_session_test.cc
diff --git a/net/quic/quic_session_test.cc b/net/quic/quic_session_test.cc
index f9c6a56e5b384aa43e3b7604e37baffbb46114c7..e417c4368408edf8e671202a5ed21bb3c5aa28aa 100644
--- a/net/quic/quic_session_test.cc
+++ b/net/quic/quic_session_test.cc
@@ -5,6 +5,7 @@
#include "net/quic/quic_session.h"
#include <set>
+#include <vector>
#include "base/containers/hash_tables.h"
#include "net/quic/crypto/crypto_handshake.h"
@@ -12,11 +13,13 @@
#include "net/quic/quic_protocol.h"
#include "net/quic/test_tools/quic_connection_peer.h"
#include "net/quic/test_tools/quic_test_utils.h"
+#include "net/spdy/spdy_framer.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
using base::hash_map;
using std::set;
+using std::vector;
using testing::_;
using testing::InSequence;
@@ -50,6 +53,8 @@ class TestStream : public ReliableQuicStream {
: ReliableQuicStream(id, session) {
}
+ using ReliableQuicStream::CloseWriteSide;
+
virtual uint32 ProcessData(const char* data, uint32 data_len) {
return data_len;
}
@@ -219,6 +224,43 @@ TEST_F(QuicSessionTest, OnCanWriteWithClosedStream) {
EXPECT_TRUE(session_.OnCanWrite());
}
+// Regression test for http://crbug.com/248737
+TEST_F(QuicSessionTest, OutOfOrderHeaders) {
+ QuicSpdyCompressor compressor;
+ SpdyHeaderBlock headers;
+ headers[":host"] = "www.google.com";
+ headers[":path"] = "/index.hml";
+ headers[":scheme"] = "http";
+ vector<QuicStreamFrame> frames;
+ QuicPacketHeader header;
+ header.public_header.guid = session_.guid();
+
+ TestStream* stream2 = session_.CreateOutgoingReliableStream();
+ TestStream* stream4 = session_.CreateOutgoingReliableStream();
+ stream2->CloseWriteSide();
+ stream4->CloseWriteSide();
+
+ // Create frame with headers for stream2.
+ string compressed_headers1 = compressor.CompressHeaders(headers);
+ QuicStreamFrame frame1(stream2->id(), false, 0, compressed_headers1);
+
+ // Create frame with headers for stream4.
+ string compressed_headers2 = compressor.CompressHeaders(headers);
+ QuicStreamFrame frame2(stream4->id(), true, 0, compressed_headers2);
+
+ // Process the second frame first. This will cause the headers to
+ // be queued up and processed after the first frame is processed.
+ frames.push_back(frame2);
+ session_.OnPacket(IPEndPoint(), IPEndPoint(), header, frames);
+
+ // Process the first frame, and un-cork the buffered headers.
+ frames[0] = frame1;
+ session_.OnPacket(IPEndPoint(), IPEndPoint(), header, frames);
+
+ // Ensure that the streams actually close and we don't DCHECK.
+ session_.ConnectionClose(QUIC_CONNECTION_TIMED_OUT, true);
+}
+
TEST_F(QuicSessionTest, SendGoAway) {
// After sending a GoAway, ensure new incoming streams cannot be created and
// result in a RST being sent.
« no previous file with comments | « net/quic/quic_crypto_client_stream.cc ('k') | net/quic/quic_stream_sequencer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698