| 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);
|
|
|