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

Unified Diff: chrome/browser/io_thread_unittest.cc

Issue 1580583002: Add a whitelist for QUIC hosts. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix comments Created 4 years, 11 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: chrome/browser/io_thread_unittest.cc
diff --git a/chrome/browser/io_thread_unittest.cc b/chrome/browser/io_thread_unittest.cc
index f3321ee333ee20d0974201282fab9850204c03a9..fbf783a24c424d3564202416cf770340cecd2353 100644
--- a/chrome/browser/io_thread_unittest.cc
+++ b/chrome/browser/io_thread_unittest.cc
@@ -238,6 +238,7 @@ TEST_F(IOThreadTest, EnableQuicFromFieldTrialGroup) {
params.quic_idle_connection_timeout_seconds);
EXPECT_FALSE(params.quic_disable_preconnect_if_0rtt);
EXPECT_FALSE(IOThread::ShouldEnableQuicForDataReductionProxy());
+ EXPECT_TRUE(params.quic_host_whitelist.empty());
}
TEST_F(IOThreadTest, EnableQuicFromQuicProxyFieldTrialGroup) {
@@ -571,6 +572,32 @@ TEST_F(IOThreadTest, AlternativeServiceProbabilityThresholdFromParams) {
EXPECT_EQ(.5, params.alternative_service_probability_threshold);
}
+TEST_F(IOThreadTest, QuicWhitelistFromCommandLinet) {
+ command_line_.AppendSwitch("enable-quic");
+ command_line_.AppendSwitchASCII("quic-host-whitelist",
+ "www.example.org, www.example.com");
+
+ ConfigureQuicGlobals();
+ net::HttpNetworkSession::Params params;
+ InitializeNetworkSessionParams(&params);
+ EXPECT_EQ(2u, params.quic_host_whitelist.size());
+ EXPECT_EQ("www.example.org", params.quic_host_whitelist[0]);
+ EXPECT_EQ("www.example.com", params.quic_host_whitelist[1]);
+}
+
+TEST_F(IOThreadTest, QuicWhitelistFromParams) {
+ field_trial_group_ = "Enabled";
+ field_trial_params_["quic_host_whitelist"] =
+ "www.example.org, www.example.com";
+
+ ConfigureQuicGlobals();
+ net::HttpNetworkSession::Params params;
+ InitializeNetworkSessionParams(&params);
+ EXPECT_EQ(2u, params.quic_host_whitelist.size());
+ EXPECT_EQ("www.example.org", params.quic_host_whitelist[0]);
+ EXPECT_EQ("www.example.com", params.quic_host_whitelist[1]);
+}
+
TEST_F(IOThreadTest, QuicDisallowedByPolicy) {
command_line_.AppendSwitch(switches::kEnableQuic);
is_quic_allowed_by_policy_ = false;

Powered by Google App Engine
This is Rietveld 408576698