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

Unified Diff: net/quic/core/quic_connection_test.cc

Issue 2229023002: Track when QUIC connections are application limited. Protected by quic_enable_app_limited_check. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@129327247
Patch Set: git pull upper stream Created 4 years, 4 months 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/quic/core/quic_connection.cc ('k') | net/quic/core/quic_flags.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « net/quic/core/quic_connection.cc ('k') | net/quic/core/quic_flags.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698