| Index: net/quic/core/quic_stream_test.cc
|
| diff --git a/net/quic/core/quic_stream_test.cc b/net/quic/core/quic_stream_test.cc
|
| index c00f2b2b629aea4119a6f0eeb13c4382d7afd2e2..a2aebf5a7cdcbfe2597d903f38f806f156be9649 100644
|
| --- a/net/quic/core/quic_stream_test.cc
|
| +++ b/net/quic/core/quic_stream_test.cc
|
| @@ -62,7 +62,6 @@ class TestStream : public QuicStream {
|
| using QuicStream::WriteOrBufferData;
|
| using QuicStream::CloseWriteSide;
|
| using QuicStream::OnClose;
|
| - using QuicStream::SetIsDeletable;
|
|
|
| private:
|
| bool should_process_data_;
|
| @@ -715,40 +714,40 @@ TEST_F(QuicStreamTest, EarlyResponseFinHandling) {
|
| EXPECT_TRUE(stream_->HasFinalReceivedByteOffset());
|
| }
|
|
|
| -TEST_F(QuicStreamTest, StreamIsDeletable) {
|
| +TEST_F(QuicStreamTest, StreamWaitsForAcks) {
|
| Initialize(kShouldProcessData);
|
| if (!session_->use_stream_notifier()) {
|
| return;
|
| }
|
| EXPECT_CALL(*session_, WritevData(_, _, _, _, _, _))
|
| .WillRepeatedly(Invoke(MockQuicSession::ConsumeAllData));
|
| - // Stream is deletable initially.
|
| - EXPECT_TRUE(stream_->is_deletable());
|
| + // Stream is not waiting for acks initially.
|
| + EXPECT_FALSE(stream_->IsWaitingForAcks());
|
|
|
| // Send kData1.
|
| stream_->WriteOrBufferData(kData1, false, nullptr);
|
| - EXPECT_FALSE(stream_->is_deletable());
|
| + EXPECT_TRUE(stream_->IsWaitingForAcks());
|
| QuicStreamFrame frame1(stream_->id(), false, 0, kData1);
|
| stream_->OnStreamFrameAcked(frame1, QuicTime::Delta::Zero());
|
| - // Stream is deletable as all sent data is acked.
|
| - EXPECT_TRUE(stream_->is_deletable());
|
| + // Stream is not waiting for acks as all sent data is acked.
|
| + EXPECT_FALSE(stream_->IsWaitingForAcks());
|
|
|
| // Send kData2.
|
| stream_->WriteOrBufferData(kData2, false, nullptr);
|
| - EXPECT_FALSE(stream_->is_deletable());
|
| + EXPECT_TRUE(stream_->IsWaitingForAcks());
|
| // Send FIN.
|
| stream_->WriteOrBufferData("", true, nullptr);
|
|
|
| // kData2 is acked.
|
| QuicStreamFrame frame2(stream_->id(), false, 9, kData2);
|
| stream_->OnStreamFrameAcked(frame2, QuicTime::Delta::Zero());
|
| - // Stream is not deletable as FIN is not acked.
|
| - EXPECT_FALSE(stream_->is_deletable());
|
| + // Stream is waiting for acks as FIN is not acked.
|
| + EXPECT_TRUE(stream_->IsWaitingForAcks());
|
|
|
| // FIN is acked.
|
| QuicStreamFrame frame3(stream_->id(), true, 18, "");
|
| stream_->OnStreamFrameAcked(frame3, QuicTime::Delta::Zero());
|
| - EXPECT_TRUE(stream_->is_deletable());
|
| + EXPECT_FALSE(stream_->IsWaitingForAcks());
|
| }
|
|
|
| TEST_F(QuicStreamTest, CancelStream) {
|
| @@ -759,21 +758,21 @@ TEST_F(QuicStreamTest, CancelStream) {
|
|
|
| EXPECT_CALL(*session_, WritevData(_, _, _, _, _, _))
|
| .WillRepeatedly(Invoke(MockQuicSession::ConsumeAllData));
|
| - EXPECT_TRUE(stream_->is_deletable());
|
| + EXPECT_FALSE(stream_->IsWaitingForAcks());
|
|
|
| stream_->WriteOrBufferData(kData1, false, nullptr);
|
| - EXPECT_FALSE(stream_->is_deletable());
|
| + EXPECT_TRUE(stream_->IsWaitingForAcks());
|
| // Cancel stream.
|
| stream_->Reset(QUIC_STREAM_NO_ERROR);
|
| - // stream is not deletable as the error code is QUIC_STREAM_NO_ERROR, and data
|
| - // is going to be retransmitted.
|
| - EXPECT_FALSE(stream_->is_deletable());
|
| + // stream still waits for acks as the error code is QUIC_STREAM_NO_ERROR, and
|
| + // data is going to be retransmitted.
|
| + EXPECT_TRUE(stream_->IsWaitingForAcks());
|
| stream_->Reset(QUIC_STREAM_CANCELLED);
|
| - // Stream is deletable as data is not going to be retransmitted.
|
| - EXPECT_TRUE(stream_->is_deletable());
|
| + // Stream stops waiting for acks as data is not going to be retransmitted.
|
| + EXPECT_FALSE(stream_->IsWaitingForAcks());
|
| }
|
|
|
| -TEST_F(QuicStreamTest, RstFrameReceived) {
|
| +TEST_F(QuicStreamTest, RstFrameReceivedStreamNotFinishSending) {
|
| Initialize(kShouldProcessData);
|
| if (!session_->use_stream_notifier()) {
|
| return;
|
| @@ -781,16 +780,37 @@ TEST_F(QuicStreamTest, RstFrameReceived) {
|
|
|
| EXPECT_CALL(*session_, WritevData(_, _, _, _, _, _))
|
| .WillRepeatedly(Invoke(MockQuicSession::ConsumeAllData));
|
| - EXPECT_TRUE(stream_->is_deletable());
|
| + EXPECT_FALSE(stream_->IsWaitingForAcks());
|
|
|
| stream_->WriteOrBufferData(kData1, false, nullptr);
|
| - EXPECT_FALSE(stream_->is_deletable());
|
| + EXPECT_TRUE(stream_->IsWaitingForAcks());
|
|
|
| // RST_STREAM received.
|
| QuicRstStreamFrame rst_frame(stream_->id(), QUIC_STREAM_CANCELLED, 1234);
|
| stream_->OnStreamReset(rst_frame);
|
| - // Stream is not deletable as it has outstanding data.
|
| - EXPECT_FALSE(stream_->is_deletable());
|
| + // Stream stops waiting for acks as it does not finish sending and rst is
|
| + // sent.
|
| + EXPECT_FALSE(stream_->IsWaitingForAcks());
|
| +}
|
| +
|
| +TEST_F(QuicStreamTest, RstFrameReceivedStreamFinishSending) {
|
| + Initialize(kShouldProcessData);
|
| + if (!session_->use_stream_notifier()) {
|
| + return;
|
| + }
|
| +
|
| + EXPECT_CALL(*session_, WritevData(_, _, _, _, _, _))
|
| + .WillRepeatedly(Invoke(MockQuicSession::ConsumeAllData));
|
| + EXPECT_FALSE(stream_->IsWaitingForAcks());
|
| +
|
| + stream_->WriteOrBufferData(kData1, true, nullptr);
|
| + EXPECT_TRUE(stream_->IsWaitingForAcks());
|
| +
|
| + // RST_STREAM received.
|
| + QuicRstStreamFrame rst_frame(stream_->id(), QUIC_STREAM_CANCELLED, 1234);
|
| + stream_->OnStreamReset(rst_frame);
|
| + // Stream stops waiting for acks as it has unacked data.
|
| + EXPECT_TRUE(stream_->IsWaitingForAcks());
|
| }
|
|
|
| TEST_F(QuicStreamTest, ConnectionClosed) {
|
| @@ -801,15 +821,15 @@ TEST_F(QuicStreamTest, ConnectionClosed) {
|
|
|
| EXPECT_CALL(*session_, WritevData(_, _, _, _, _, _))
|
| .WillRepeatedly(Invoke(MockQuicSession::ConsumeAllData));
|
| - EXPECT_TRUE(stream_->is_deletable());
|
| + EXPECT_FALSE(stream_->IsWaitingForAcks());
|
|
|
| stream_->WriteOrBufferData(kData1, false, nullptr);
|
| - EXPECT_FALSE(stream_->is_deletable());
|
| + EXPECT_TRUE(stream_->IsWaitingForAcks());
|
|
|
| stream_->OnConnectionClosed(QUIC_INTERNAL_ERROR,
|
| ConnectionCloseSource::FROM_SELF);
|
| - // Stream is deletable as connection is closed.
|
| - EXPECT_TRUE(stream_->is_deletable());
|
| + // Stream stops waiting for acks as connection is going to close.
|
| + EXPECT_FALSE(stream_->IsWaitingForAcks());
|
| }
|
|
|
| } // namespace
|
|
|