Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(709)

Unified Diff: net/tools/quic/quic_server_session_test.cc

Issue 786123002: Update from https://crrev.com/307330 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/tools/quic/quic_server_session.cc ('k') | net/tools/quic/quic_socket_utils.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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(
« no previous file with comments | « net/tools/quic/quic_server_session.cc ('k') | net/tools/quic/quic_socket_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698