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

Unified Diff: net/quic/quic_stream_factory_test.cc

Issue 1025573002: QUIC - disable QUIC if packet loss rate is bad for a connection. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Disable quic when there is high packet loss rate Created 5 years, 9 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
Index: net/quic/quic_stream_factory_test.cc
diff --git a/net/quic/quic_stream_factory_test.cc b/net/quic/quic_stream_factory_test.cc
index fdc023b28ac5d8420c165d16d3cc5baf0530cb7b..1b408203ebd967f2a7ad889b06ede231daa4eca5 100644
--- a/net/quic/quic_stream_factory_test.cc
+++ b/net/quic/quic_stream_factory_test.cc
@@ -135,6 +135,10 @@ class QuicStreamFactoryPeer {
factory->disable_disk_cache_ = disable_disk_cache;
}
+ static bool GetQuicIsDisabled(QuicStreamFactory* factory) {
+ return factory->quic_is_disabled_;
+ }
+
static size_t GetNumberOfActiveJobs(QuicStreamFactory* factory,
const QuicServerId& server_id) {
return (factory->active_jobs_[server_id]).size();
@@ -206,6 +210,8 @@ class QuicStreamFactoryTest : public ::testing::TestWithParam<TestParams> {
/*enable_connection_racing=*/false,
/*enable_non_blocking_io=*/true,
/*disable_disk_cache=*/false,
+ /*max_number_of_lossy_connections=*/0,
+ /*packet_loss_threshold=*/1000.0f,
/*receive_buffer_size=*/0,
QuicTagVector()),
host_port_pair_(kDefaultServerHostName, kDefaultServerPort),
@@ -1681,5 +1687,21 @@ TEST_P(QuicStreamFactoryTest, EnableNotLoadFromDiskCache) {
EXPECT_TRUE(socket_data.at_write_eof());
}
+TEST_P(QuicStreamFactoryTest, BadPacketLoss) {
+ factory_.set_quic_server_info_factory(&quic_server_info_factory_);
+ QuicStreamFactoryPeer::SetTaskRunner(&factory_, runner_.get());
+ EXPECT_FALSE(QuicStreamFactoryPeer::GetQuicIsDisabled(&factory_));
+
+ // OnBadPacketLoss should disable QUIC.
+ QuicServerId server_id(host_port_pair_, is_https_, privacy_mode_);
+ factory_.OnBadPacketLoss(server_id);
+ EXPECT_TRUE(QuicStreamFactoryPeer::GetQuicIsDisabled(&factory_));
+
+ QuicStreamRequest request(&factory_);
+ EXPECT_EQ(ERR_QUIC_PROTOCOL_ERROR,
+ request.Request(host_port_pair_, is_https_, privacy_mode_, "GET",
+ net_log_, callback_.callback()));
+}
+
} // namespace test
} // namespace net

Powered by Google App Engine
This is Rietveld 408576698