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

Unified Diff: net/quic/quic_session_test.cc

Issue 1277753002: relnote: Close QUIC connections due to too many open streams earlier in (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@format_fix_99250353
Patch Set: Created 5 years, 4 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_session.cc ('k') | net/tools/quic/quic_server_session.cc » ('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 433868a5d5bf685289e745b0de8624a93d7f568c..4a57c31743125047e377c21e0c7586d25a39f574 100644
--- a/net/quic/quic_session_test.cc
+++ b/net/quic/quic_session_test.cc
@@ -134,7 +134,13 @@ class TestSession : public QuicSpdySession {
}
TestStream* CreateIncomingDynamicStream(QuicStreamId id) override {
- return new TestStream(id, this);
+ // Enforce the limit on the number of open streams.
+ if (GetNumOpenStreams() + 1 > get_max_open_streams()) {
+ connection()->SendConnectionClose(QUIC_TOO_MANY_OPEN_STREAMS);
+ return nullptr;
+ } else {
+ return new TestStream(id, this);
+ }
}
bool IsClosedStream(QuicStreamId id) {
@@ -312,11 +318,41 @@ TEST_P(QuicSessionTestServer, IsClosedStreamPeerCreated) {
CheckClosedStreams();
}
-TEST_P(QuicSessionTestServer, StreamIdTooLarge) {
+TEST_P(QuicSessionTestServer, MaximumImplicitlyOpenedStreams) {
+ QuicStreamId stream_id = kClientDataStreamId1;
+ session_.GetIncomingDynamicStream(stream_id);
+ EXPECT_CALL(*connection_, SendConnectionClose(_)).Times(0);
+ EXPECT_NE(nullptr,
+ session_.GetIncomingDynamicStream(
+ stream_id + 2 * (session_.get_max_open_streams() - 1)));
+}
+
+TEST_P(QuicSessionTestServer, TooManyImplicitlyOpenedStreams) {
+ QuicStreamId stream_id1 = kClientDataStreamId1;
+ // A stream ID which is too large to create.
+ const QuicStreamId kMaxStreamIdDelta = 200;
+ QuicStreamId stream_id2 =
+ FLAGS_exact_stream_id_delta
+ ? stream_id1 + 2 * session_.get_max_open_streams()
+ : stream_id1 + kMaxStreamIdDelta + 2;
+ EXPECT_NE(nullptr, session_.GetIncomingDynamicStream(stream_id1));
+ EXPECT_CALL(*connection_, SendConnectionClose(FLAGS_exact_stream_id_delta
+ ? QUIC_TOO_MANY_OPEN_STREAMS
+ : QUIC_INVALID_STREAM_ID));
+ EXPECT_EQ(nullptr, session_.GetIncomingDynamicStream(stream_id2));
+}
+
+TEST_P(QuicSessionTestServer, ManyImplicitlyOpenedStreams) {
+ // When max_open_streams_ is 200, should be able to create 200 streams
+ // out-of-order, that is, creating the one with the largest stream ID first.
+ QuicSessionPeer::SetMaxOpenStreams(&session_, 200);
QuicStreamId stream_id = kClientDataStreamId1;
+ // Create one stream.
session_.GetIncomingDynamicStream(stream_id);
- EXPECT_CALL(*connection_, SendConnectionClose(QUIC_INVALID_STREAM_ID));
- session_.GetIncomingDynamicStream(stream_id + kMaxStreamIdDelta + 2);
+ EXPECT_CALL(*connection_, SendConnectionClose(_))
+ .Times(FLAGS_exact_stream_id_delta ? 0 : 1);
+ // Create the largest stream ID of a threatened total of 200 streams.
+ session_.GetIncomingDynamicStream(stream_id + 2 * (200 - 1));
}
TEST_P(QuicSessionTestServer, DebugDFatalIfMarkingClosedStreamWriteBlocked) {
@@ -597,7 +633,9 @@ TEST_P(QuicSessionTestServer, MultipleRstStreamsCauseSingleConnectionClose) {
// Process first invalid stream reset, resulting in the connection being
// closed.
- EXPECT_CALL(*connection_, SendConnectionClose(QUIC_INVALID_STREAM_ID))
+ EXPECT_CALL(*connection_, SendConnectionClose(FLAGS_exact_stream_id_delta
+ ? QUIC_TOO_MANY_OPEN_STREAMS
+ : QUIC_INVALID_STREAM_ID))
.Times(1);
const QuicStreamId kLargeInvalidStreamId = 99999999;
QuicRstStreamFrame rst1(kLargeInvalidStreamId, QUIC_STREAM_NO_ERROR, 0);
« no previous file with comments | « net/quic/quic_session.cc ('k') | net/tools/quic/quic_server_session.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698