| Index: net/quic/core/quic_connection_test.cc
|
| diff --git a/net/quic/core/quic_connection_test.cc b/net/quic/core/quic_connection_test.cc
|
| index 4d5919deb9f9df39a48aef8f2b09c9d6b5e88e80..549d2074afeadec8a9664b78bf6b989ad59dba23 100644
|
| --- a/net/quic/core/quic_connection_test.cc
|
| +++ b/net/quic/core/quic_connection_test.cc
|
| @@ -734,6 +734,7 @@ class QuicConnectionTest : public ::testing::TestWithParam<TestParams> {
|
| .WillRepeatedly(Return(QuicBandwidth::Zero()));
|
| EXPECT_CALL(*send_algorithm_, InSlowStart()).Times(AnyNumber());
|
| EXPECT_CALL(*send_algorithm_, InRecovery()).Times(AnyNumber());
|
| + EXPECT_CALL(*send_algorithm_, OnApplicationLimited(_)).Times(AnyNumber());
|
| EXPECT_CALL(visitor_, WillingAndAbleToWrite()).Times(AnyNumber());
|
| EXPECT_CALL(visitor_, HasPendingHandshake()).Times(AnyNumber());
|
| EXPECT_CALL(visitor_, OnCanWrite()).Times(AnyNumber());
|
| @@ -1944,7 +1945,13 @@ TEST_P(QuicConnectionTest, OnCanWrite) {
|
| &connection_, &TestConnection::SendStreamData3)),
|
| IgnoreResult(InvokeWithoutArgs(
|
| &connection_, &TestConnection::SendStreamData5))));
|
| - EXPECT_CALL(visitor_, WillingAndAbleToWrite()).WillOnce(Return(true));
|
| + {
|
| + InSequence seq;
|
| + EXPECT_CALL(visitor_, WillingAndAbleToWrite()).WillOnce(Return(true));
|
| + EXPECT_CALL(visitor_, WillingAndAbleToWrite())
|
| + .WillRepeatedly(Return(false));
|
| + }
|
| +
|
| EXPECT_CALL(*send_algorithm_, TimeUntilSend(_, _))
|
| .WillRepeatedly(testing::Return(QuicTime::Delta::Zero()));
|
|
|
| @@ -4985,6 +4992,52 @@ TEST_P(QuicConnectionTest, AlwaysGetPacketTooLarge) {
|
| connection_.SendStreamDataWithString(3, "foo", 0, !kFin, nullptr);
|
| }
|
|
|
| +// Verify that if connection has no outstanding data, it notifies the send
|
| +// algorithm after the write.
|
| +TEST_P(QuicConnectionTest, SendDataAndBecomeApplicationLimited) {
|
| + FLAGS_quic_enable_app_limited_check = true;
|
| +
|
| + EXPECT_CALL(*send_algorithm_, OnApplicationLimited(_)).Times(1);
|
| + {
|
| + InSequence seq;
|
| + EXPECT_CALL(visitor_, WillingAndAbleToWrite()).WillRepeatedly(Return(true));
|
| + EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _))
|
| + .WillOnce(Return(true));
|
| + EXPECT_CALL(visitor_, WillingAndAbleToWrite())
|
| + .WillRepeatedly(Return(false));
|
| + }
|
| +
|
| + connection_.SendStreamData3();
|
| +}
|
| +
|
| +// Verify that the connection does not become app-limited if there is
|
| +// outstanding data to send after the write.
|
| +TEST_P(QuicConnectionTest, NotBecomeApplicationLimitedIfMoreDataAvailable) {
|
| + FLAGS_quic_enable_app_limited_check = true;
|
| +
|
| + EXPECT_CALL(*send_algorithm_, OnApplicationLimited(_)).Times(0);
|
| + {
|
| + InSequence seq;
|
| + EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _))
|
| + .WillOnce(Return(true));
|
| + EXPECT_CALL(visitor_, WillingAndAbleToWrite()).WillRepeatedly(Return(true));
|
| + }
|
| +
|
| + connection_.SendStreamData3();
|
| +}
|
| +
|
| +// Verify that the connection does not become app-limited after blocked write
|
| +// even if there is outstanding data to send after the write.
|
| +TEST_P(QuicConnectionTest, NotBecomeApplicationLimitedDueToWriteBlock) {
|
| + FLAGS_quic_enable_app_limited_check = true;
|
| +
|
| + EXPECT_CALL(*send_algorithm_, OnApplicationLimited(_)).Times(0);
|
| + EXPECT_CALL(visitor_, WillingAndAbleToWrite()).WillRepeatedly(Return(true));
|
| + BlockOnNextWrite();
|
| +
|
| + connection_.SendStreamData3();
|
| +}
|
| +
|
| } // namespace
|
| } // namespace test
|
| } // namespace net
|
|
|