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

Side by Side Diff: net/quic/quic_session_test.cc

Issue 2176323002: Deprecate FLAGS_quic_disable_pre_30. Remove QUIC versions [25-29]. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@127879468
Patch Set: Created 4 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/quic/quic_session.h" 5 #include "net/quic/quic_session.h"
6 6
7 #include <set> 7 #include <set>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/rand_util.h" 10 #include "base/rand_util.h"
(...skipping 1023 matching lines...) Expand 10 before | Expand all | Expand 10 after
1034 QuicWindowUpdateFrame window_update_frame(headers_stream->id(), 1034 QuicWindowUpdateFrame window_update_frame(headers_stream->id(),
1035 2 * kMinimumFlowControlSendWindow); 1035 2 * kMinimumFlowControlSendWindow);
1036 session_.OnWindowUpdateFrame(window_update_frame); 1036 session_.OnWindowUpdateFrame(window_update_frame);
1037 EXPECT_FALSE(headers_stream->flow_controller()->IsBlocked()); 1037 EXPECT_FALSE(headers_stream->flow_controller()->IsBlocked());
1038 EXPECT_FALSE(session_.IsConnectionFlowControlBlocked()); 1038 EXPECT_FALSE(session_.IsConnectionFlowControlBlocked());
1039 EXPECT_FALSE(session_.IsStreamFlowControlBlocked()); 1039 EXPECT_FALSE(session_.IsStreamFlowControlBlocked());
1040 } 1040 }
1041 1041
1042 TEST_P(QuicSessionTestServer, TooManyUnfinishedStreamsCauseServerRejectStream) { 1042 TEST_P(QuicSessionTestServer, TooManyUnfinishedStreamsCauseServerRejectStream) {
1043 // If a buggy/malicious peer creates too many streams that are not ended 1043 // If a buggy/malicious peer creates too many streams that are not ended
1044 // with a FIN or RST then we send a connection close or an RST to 1044 // with a FIN or RST then we send an RST to refuse streams.
1045 // refuse streams.
1046 const QuicStreamId kMaxStreams = 5; 1045 const QuicStreamId kMaxStreams = 5;
1047 QuicSessionPeer::SetMaxOpenIncomingStreams(&session_, kMaxStreams); 1046 QuicSessionPeer::SetMaxOpenIncomingStreams(&session_, kMaxStreams);
1048 const QuicStreamId kFirstStreamId = kClientDataStreamId1; 1047 const QuicStreamId kFirstStreamId = kClientDataStreamId1;
1049 const QuicStreamId kFinalStreamId = kClientDataStreamId1 + 2 * kMaxStreams; 1048 const QuicStreamId kFinalStreamId = kClientDataStreamId1 + 2 * kMaxStreams;
1050 1049
1051 // Create kMaxStreams data streams, and close them all without receiving a 1050 // Create kMaxStreams data streams, and close them all without receiving a
1052 // FIN or a RST_STREAM from the client. 1051 // FIN or a RST_STREAM from the client.
1053 for (QuicStreamId i = kFirstStreamId; i < kFinalStreamId; i += 2) { 1052 for (QuicStreamId i = kFirstStreamId; i < kFinalStreamId; i += 2) {
1054 QuicStreamFrame data1(i, false, 0, StringPiece("HT")); 1053 QuicStreamFrame data1(i, false, 0, StringPiece("HT"));
1055 session_.OnStreamFrame(data1); 1054 session_.OnStreamFrame(data1);
1056 // EXPECT_EQ(1u, session_.GetNumOpenStreams()); 1055 // EXPECT_EQ(1u, session_.GetNumOpenStreams());
1057 EXPECT_CALL(*connection_, SendRstStream(i, _, _)); 1056 EXPECT_CALL(*connection_, SendRstStream(i, _, _));
1058 session_.CloseStream(i); 1057 session_.CloseStream(i);
1059 } 1058 }
1060 1059
1061 if (GetParam() <= QUIC_VERSION_27) { 1060 EXPECT_CALL(*connection_,
1062 EXPECT_CALL(*connection_, 1061 SendRstStream(kFinalStreamId, QUIC_REFUSED_STREAM, _))
1063 CloseConnection(QUIC_TOO_MANY_OPEN_STREAMS, _, _)); 1062 .Times(1);
1064 EXPECT_CALL(*connection_, SendRstStream(kFinalStreamId, _, _)).Times(0);
1065 } else {
1066 EXPECT_CALL(*connection_,
1067 SendRstStream(kFinalStreamId, QUIC_REFUSED_STREAM, _))
1068 .Times(1);
1069 }
1070 // Create one more data streams to exceed limit of open stream. 1063 // Create one more data streams to exceed limit of open stream.
1071 QuicStreamFrame data1(kFinalStreamId, false, 0, StringPiece("HT")); 1064 QuicStreamFrame data1(kFinalStreamId, false, 0, StringPiece("HT"));
1072 session_.OnStreamFrame(data1); 1065 session_.OnStreamFrame(data1);
1073 1066
1074 // Called after any new data is received by the session, and triggers the 1067 // Called after any new data is received by the session, and triggers the
1075 // call to close the connection. 1068 // call to close the connection.
1076 session_.PostProcessAfterData(); 1069 session_.PostProcessAfterData();
1077 } 1070 }
1078 1071
1079 TEST_P(QuicSessionTestServer, DrainingStreamsDoNotCountAsOpened) { 1072 TEST_P(QuicSessionTestServer, DrainingStreamsDoNotCountAsOpened) {
1080 // Verify that a draining stream (which has received a FIN but not consumed 1073 // Verify that a draining stream (which has received a FIN but not consumed
1081 // it) does not count against the open quota (because it is closed from the 1074 // it) does not count against the open quota (because it is closed from the
1082 // protocol point of view). 1075 // protocol point of view).
1083 if (GetParam() <= QUIC_VERSION_27) { 1076 EXPECT_CALL(*connection_, SendRstStream(_, QUIC_REFUSED_STREAM, _)).Times(0);
1084 EXPECT_CALL(*connection_, CloseConnection(QUIC_TOO_MANY_OPEN_STREAMS, _, _))
1085 .Times(0);
1086 } else {
1087 EXPECT_CALL(*connection_, SendRstStream(_, QUIC_REFUSED_STREAM, _))
1088 .Times(0);
1089 }
1090 const QuicStreamId kMaxStreams = 5; 1077 const QuicStreamId kMaxStreams = 5;
1091 QuicSessionPeer::SetMaxOpenIncomingStreams(&session_, kMaxStreams); 1078 QuicSessionPeer::SetMaxOpenIncomingStreams(&session_, kMaxStreams);
1092 1079
1093 // Create kMaxStreams + 1 data streams, and mark them draining. 1080 // Create kMaxStreams + 1 data streams, and mark them draining.
1094 const QuicStreamId kFirstStreamId = kClientDataStreamId1; 1081 const QuicStreamId kFirstStreamId = kClientDataStreamId1;
1095 const QuicStreamId kFinalStreamId = 1082 const QuicStreamId kFinalStreamId =
1096 kClientDataStreamId1 + 2 * kMaxStreams + 1; 1083 kClientDataStreamId1 + 2 * kMaxStreams + 1;
1097 for (QuicStreamId i = kFirstStreamId; i < kFinalStreamId; i += 2) { 1084 for (QuicStreamId i = kFirstStreamId; i < kFinalStreamId; i += 2) {
1098 QuicStreamFrame data1(i, true, 0, StringPiece("HT")); 1085 QuicStreamFrame data1(i, true, 0, StringPiece("HT"));
1099 session_.OnStreamFrame(data1); 1086 session_.OnStreamFrame(data1);
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
1216 if (version() <= QUIC_VERSION_35) { 1203 if (version() <= QUIC_VERSION_35) {
1217 EXPECT_FALSE(session_.force_hol_blocking()); 1204 EXPECT_FALSE(session_.force_hol_blocking());
1218 } else { 1205 } else {
1219 EXPECT_TRUE(session_.force_hol_blocking()); 1206 EXPECT_TRUE(session_.force_hol_blocking());
1220 } 1207 }
1221 } 1208 }
1222 1209
1223 } // namespace 1210 } // namespace
1224 } // namespace test 1211 } // namespace test
1225 } // namespace net 1212 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698