| Index: net/quic/quic_session_test.cc
|
| diff --git a/net/quic/quic_session_test.cc b/net/quic/quic_session_test.cc
|
| index 96d30b8c5819228d29c5773b63b79c9e93ddeb46..2b9b66aa3de4f2be2d7809665b53268b5dcd0fbc 100644
|
| --- a/net/quic/quic_session_test.cc
|
| +++ b/net/quic/quic_session_test.cc
|
| @@ -184,7 +184,9 @@ class TestSession : public QuicSession {
|
| class QuicSessionTest : public ::testing::TestWithParam<QuicVersion> {
|
| protected:
|
| QuicSessionTest()
|
| - : connection_(new MockConnection(true, SupportedVersions(GetParam()))),
|
| + : connection_(
|
| + new StrictMock<MockConnection>(true,
|
| + SupportedVersions(GetParam()))),
|
| session_(connection_) {
|
| session_.config()->SetInitialStreamFlowControlWindowToSend(
|
| kInitialStreamFlowControlWindowForTest);
|
| @@ -231,13 +233,14 @@ class QuicSessionTest : public ::testing::TestWithParam<QuicVersion> {
|
| }
|
|
|
| void CloseStream(QuicStreamId id) {
|
| + EXPECT_CALL(*connection_, SendRstStream(id, _, _));
|
| session_.CloseStream(id);
|
| closed_streams_.insert(id);
|
| }
|
|
|
| QuicVersion version() const { return connection_->version(); }
|
|
|
| - MockConnection* connection_;
|
| + StrictMock<MockConnection>* connection_;
|
| TestSession session_;
|
| set<QuicStreamId> closed_streams_;
|
| SpdyHeaderBlock headers_;
|
| @@ -333,11 +336,12 @@ TEST_P(QuicSessionTest, DecompressionError) {
|
|
|
| TEST_P(QuicSessionTest, DebugDFatalIfMarkingClosedStreamWriteBlocked) {
|
| TestStream* stream2 = session_.CreateOutgoingDataStream();
|
| + QuicStreamId kClosedStreamId = stream2->id();
|
| // Close the stream.
|
| + EXPECT_CALL(*connection_, SendRstStream(kClosedStreamId, _, _));
|
| stream2->Reset(QUIC_BAD_APPLICATION_PAYLOAD);
|
| // TODO(rtenneti): enable when chromium supports EXPECT_DEBUG_DFATAL.
|
| /*
|
| - QuicStreamId kClosedStreamId = stream2->id();
|
| EXPECT_DEBUG_DFATAL(
|
| session_.MarkWriteBlocked(kClosedStreamId, kSomeMiddlePriority),
|
| "Marking unknown stream 2 blocked.");
|
| @@ -589,6 +593,7 @@ TEST_P(QuicSessionTest, RstStreamBeforeHeadersDecompressed) {
|
| session_.OnStreamFrames(frames);
|
| EXPECT_EQ(1u, session_.GetNumOpenStreams());
|
|
|
| + EXPECT_CALL(*connection_, SendRstStream(kClientDataStreamId1, _, _));
|
| QuicRstStreamFrame rst1(kClientDataStreamId1, QUIC_STREAM_NO_ERROR, 0);
|
| session_.OnRstStream(rst1);
|
| EXPECT_EQ(0u, session_.GetNumOpenStreams());
|
| @@ -637,6 +642,8 @@ TEST_P(QuicSessionTest, HandshakeUnblocksFlowControlBlockedStream) {
|
| EXPECT_FALSE(stream2->flow_controller()->IsBlocked());
|
| EXPECT_FALSE(session_.IsConnectionFlowControlBlocked());
|
| EXPECT_FALSE(session_.IsStreamFlowControlBlocked());
|
| + EXPECT_CALL(*connection_, SendBlocked(stream2->id()));
|
| + EXPECT_CALL(*connection_, SendBlocked(0));
|
| stream2->SendBody(body, false);
|
| EXPECT_TRUE(stream2->flow_controller()->IsBlocked());
|
| EXPECT_TRUE(session_.IsConnectionFlowControlBlocked());
|
| @@ -670,6 +677,7 @@ TEST_P(QuicSessionTest, HandshakeUnblocksFlowControlBlockedCryptoStream) {
|
| EXPECT_FALSE(session_.IsConnectionFlowControlBlocked());
|
| EXPECT_FALSE(session_.IsStreamFlowControlBlocked());
|
| // Write until the crypto stream is flow control blocked.
|
| + EXPECT_CALL(*connection_, SendBlocked(kCryptoStreamId));
|
| int i = 0;
|
| while (!crypto_stream->flow_controller()->IsBlocked() && i < 1000) {
|
| EXPECT_FALSE(session_.IsConnectionFlowControlBlocked());
|
| @@ -716,6 +724,7 @@ TEST_P(QuicSessionTest, HandshakeUnblocksFlowControlBlockedHeadersStream) {
|
| EXPECT_FALSE(session_.IsStreamFlowControlBlocked());
|
| QuicStreamId stream_id = 5;
|
| // Write until the header stream is flow control blocked.
|
| + EXPECT_CALL(*connection_, SendBlocked(kHeadersStreamId));
|
| SpdyHeaderBlock headers;
|
| while (!headers_stream->flow_controller()->IsBlocked() && stream_id < 2000) {
|
| EXPECT_FALSE(session_.IsConnectionFlowControlBlocked());
|
| @@ -766,6 +775,7 @@ TEST_P(QuicSessionTest, ConnectionFlowControlAccountingRstOutOfOrder) {
|
| SendWindowUpdate(0, kInitialSessionFlowControlWindowForTest +
|
| kByteOffset)).Times(1);
|
|
|
| + EXPECT_CALL(*connection_, SendRstStream(stream->id(), _, _));
|
| QuicRstStreamFrame rst_frame(stream->id(), QUIC_STREAM_CANCELLED,
|
| kByteOffset);
|
| session_.OnRstStream(rst_frame);
|
| @@ -782,18 +792,20 @@ TEST_P(QuicSessionTest, ConnectionFlowControlAccountingFinAndLocalReset) {
|
| TestStream* stream = session_.CreateOutgoingDataStream();
|
|
|
| const QuicStreamOffset kByteOffset =
|
| - 1 + kInitialSessionFlowControlWindowForTest / 2;
|
| + kInitialSessionFlowControlWindowForTest / 2;
|
| QuicStreamFrame frame(stream->id(), true, kByteOffset, IOVector());
|
| vector<QuicStreamFrame> frames;
|
| frames.push_back(frame);
|
| session_.OnStreamFrames(frames);
|
| session_.PostProcessAfterData();
|
| + EXPECT_TRUE(connection_->connected());
|
|
|
| EXPECT_EQ(0u, stream->flow_controller()->bytes_consumed());
|
| EXPECT_EQ(kByteOffset,
|
| stream->flow_controller()->highest_received_byte_offset());
|
|
|
| // Reset stream locally.
|
| + EXPECT_CALL(*connection_, SendRstStream(stream->id(), _, _));
|
| stream->Reset(QUIC_STREAM_CANCELLED);
|
| EXPECT_EQ(kByteOffset, session_.flow_controller()->bytes_consumed());
|
| }
|
| @@ -815,6 +827,7 @@ TEST_P(QuicSessionTest, ConnectionFlowControlAccountingFinAfterRst) {
|
|
|
| // Reset our stream: this results in the stream being closed locally.
|
| TestStream* stream = session_.CreateOutgoingDataStream();
|
| + EXPECT_CALL(*connection_, SendRstStream(stream->id(), _, _));
|
| stream->Reset(QUIC_STREAM_CANCELLED);
|
|
|
| // Now receive a response from the peer with a FIN. We should handle this by
|
| @@ -854,6 +867,7 @@ TEST_P(QuicSessionTest, ConnectionFlowControlAccountingRstAfterRst) {
|
|
|
| // Reset our stream: this results in the stream being closed locally.
|
| TestStream* stream = session_.CreateOutgoingDataStream();
|
| + EXPECT_CALL(*connection_, SendRstStream(stream->id(), _, _));
|
| stream->Reset(QUIC_STREAM_CANCELLED);
|
|
|
| // Now receive a RST from the peer. We should handle this by adjusting the
|
| @@ -904,6 +918,7 @@ TEST_P(QuicSessionTest, FlowControlWithInvalidFinalOffset) {
|
|
|
| // Check that stream frame + FIN results in connection close.
|
| TestStream* stream = session_.CreateOutgoingDataStream();
|
| + EXPECT_CALL(*connection_, SendRstStream(stream->id(), _, _));
|
| stream->Reset(QUIC_STREAM_CANCELLED);
|
| QuicStreamFrame frame(stream->id(), true, kLargeOffset, IOVector());
|
| vector<QuicStreamFrame> frames;
|
| @@ -959,6 +974,7 @@ TEST_P(QuicSessionTest, TooManyUnfinishedStreamsCauseConnectionClose) {
|
| frames.push_back(data1);
|
| session_.OnStreamFrames(frames);
|
| EXPECT_EQ(1u, session_.GetNumOpenStreams());
|
| + EXPECT_CALL(*connection_, SendRstStream(i, _, _));
|
| session_.CloseStream(i);
|
| }
|
|
|
|
|