Index: net/tools/quic/quic_server_session_test.cc |
diff --git a/net/tools/quic/quic_server_session_test.cc b/net/tools/quic/quic_server_session_test.cc |
index 4705c05aa0145d34e00f2e222173d420759bfae9..c8f8bce227beb62d635bfa288faa3af5e702b1e7 100644 |
--- a/net/tools/quic/quic_server_session_test.cc |
+++ b/net/tools/quic/quic_server_session_test.cc |
@@ -37,6 +37,7 @@ using net::test::kClientDataStreamId1; |
using net::test::kClientDataStreamId2; |
using net::test::kClientDataStreamId3; |
using net::test::kClientDataStreamId4; |
+using std::string; |
using testing::StrictMock; |
using testing::_; |
@@ -305,7 +306,8 @@ TEST_P(QuicServerSessionTest, BandwidthEstimates) { |
} |
// Test that bandwidth estimate updates are sent to the client, only after the |
- // bandwidth estimate has changes sufficiently, and enough time has passed. |
+ // bandwidth estimate has changes sufficiently, and enough time has passed, |
+ // and we don't have any other data to write. |
int32 bandwidth_estimate_kbytes_per_second = 123; |
int32 max_bandwidth_estimate_kbytes_per_second = 134; |
@@ -332,6 +334,10 @@ TEST_P(QuicServerSessionTest, BandwidthEstimates) { |
QuicSustainedBandwidthRecorderPeer::SetMaxBandwidthEstimate( |
&bandwidth_recorder, max_bandwidth_estimate_kbytes_per_second, |
max_bandwidth_estimate_timestamp); |
+ // Queue up some pending data. |
+ session_->MarkWriteBlocked(kCryptoStreamId, |
+ QuicWriteBlockedList::kHighestPriority); |
+ EXPECT_TRUE(session_->HasDataToWrite()); |
// There will be no update sent yet - not enough time has passed. |
QuicTime now = QuicTime::Zero(); |
@@ -351,6 +357,11 @@ TEST_P(QuicServerSessionTest, BandwidthEstimates) { |
kMinIntervalBetweenServerConfigUpdatesRTTs * srtt_ms)); |
session_->OnCongestionWindowChange(now); |
+ // The connection no longer has pending data to be written. |
+ session_->OnCanWrite(); |
+ EXPECT_FALSE(session_->HasDataToWrite()); |
+ session_->OnCongestionWindowChange(now); |
+ |
// Bandwidth estimate has now changed sufficiently, enough time has passed, |
// and enough packets have been sent. |
QuicConnectionPeer::SetSequenceNumberOfLastSentPacket( |