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

Unified Diff: net/quic/quic_session_test.cc

Issue 327393004: Close QUIC connection with correct flow control error code, added a test (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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_session.cc ('k') | no next file » | 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 45987e6b9401b422f143d025df0c5f6234121cf9..b5fb5654949664d98dcba22043f20324d9366231 100644
--- a/net/quic/quic_session_test.cc
+++ b/net/quic/quic_session_test.cc
@@ -576,15 +576,14 @@ TEST_P(QuicSessionTest, IncreasedTimeoutAfterCryptoHandshake) {
}
TEST_P(QuicSessionTest, RstStreamBeforeHeadersDecompressed) {
- QuicStreamId stream_id1 = kClientDataStreamId1;
// Send two bytes of payload.
- QuicStreamFrame data1(stream_id1, false, 0, MakeIOVector("HT"));
+ QuicStreamFrame data1(kClientDataStreamId1, false, 0, MakeIOVector("HT"));
vector<QuicStreamFrame> frames;
frames.push_back(data1);
session_.OnStreamFrames(frames);
EXPECT_EQ(1u, session_.GetNumOpenStreams());
- QuicRstStreamFrame rst1(stream_id1, QUIC_STREAM_NO_ERROR, 0);
+ QuicRstStreamFrame rst1(kClientDataStreamId1, QUIC_STREAM_NO_ERROR, 0);
session_.OnRstStream(rst1);
EXPECT_EQ(0u, session_.GetNumOpenStreams());
// Connection should remain alive.
@@ -669,7 +668,10 @@ TEST_P(QuicSessionTest, InvalidFlowControlWindowInHandshake) {
session_.OnConfigNegotiated();
}
+
TEST_P(QuicSessionTest, InvalidFlowControlWindow) {
+ // Test that an attempt to create a QuicSession with an invalid (< default)
+ // flow control window results in a QuicSession using the default.
QuicConnection* connection =
new MockConnection(true, SupportedVersions(GetParam()));
@@ -826,6 +828,32 @@ TEST_P(QuicSessionTest, ConnectionFlowControlAccountingRstAfterRst) {
session_.flow_controller()->highest_received_byte_offset());
}
+TEST_P(QuicSessionTest, FlowControlWithInvalidFinalOffset) {
+ // Test that if we receive a stream RST with a highest byte offset that
+ // violates flow control, that we close the connection.
+ if (version() < QUIC_VERSION_17) {
+ return;
+ }
+ FLAGS_enable_quic_stream_flow_control_2 = true;
+ FLAGS_enable_quic_connection_flow_control = true;
+
+ const uint64 kLargeOffset = kInitialFlowControlWindowForTest + 1;
+ EXPECT_CALL(*connection_,
+ SendConnectionClose(QUIC_FLOW_CONTROL_RECEIVED_TOO_MUCH_DATA))
+ .Times(2);
+
+ // Check that stream frame + FIN results in connection close.
+ TestStream* stream = session_.CreateOutgoingDataStream();
+ stream->Reset(QUIC_STREAM_CANCELLED);
+ QuicStreamFrame frame(stream->id(), true, kLargeOffset, IOVector());
+ session_.OnStreamFrames({frame});
+
+ // Check that RST results in connection close.
+ QuicRstStreamFrame rst_frame(stream->id(), QUIC_STREAM_CANCELLED,
+ kLargeOffset);
+ session_.OnRstStream(rst_frame);
+}
+
TEST_P(QuicSessionTest, VersionNegotiationDisablesFlowControl) {
ValueRestore<bool> old_stream_flag(
&FLAGS_enable_quic_stream_flow_control_2, true);
« no previous file with comments | « net/quic/quic_session.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698