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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <stddef.h> 5 #include <stddef.h>
6 6
7 #include "base/at_exit.h" 7 #include "base/at_exit.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/metrics/field_trial.h" 10 #include "base/metrics/field_trial.h"
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 EXPECT_FALSE(params.quic_prefer_aes); 231 EXPECT_FALSE(params.quic_prefer_aes);
232 EXPECT_FALSE(params.use_alternative_services); 232 EXPECT_FALSE(params.use_alternative_services);
233 EXPECT_EQ(0, params.quic_max_number_of_lossy_connections); 233 EXPECT_EQ(0, params.quic_max_number_of_lossy_connections);
234 EXPECT_EQ(1.0f, params.quic_packet_loss_threshold); 234 EXPECT_EQ(1.0f, params.quic_packet_loss_threshold);
235 EXPECT_FALSE(params.quic_delay_tcp_race); 235 EXPECT_FALSE(params.quic_delay_tcp_race);
236 EXPECT_FALSE(params.quic_close_sessions_on_ip_change); 236 EXPECT_FALSE(params.quic_close_sessions_on_ip_change);
237 EXPECT_EQ(net::kIdleConnectionTimeoutSeconds, 237 EXPECT_EQ(net::kIdleConnectionTimeoutSeconds,
238 params.quic_idle_connection_timeout_seconds); 238 params.quic_idle_connection_timeout_seconds);
239 EXPECT_FALSE(params.quic_disable_preconnect_if_0rtt); 239 EXPECT_FALSE(params.quic_disable_preconnect_if_0rtt);
240 EXPECT_FALSE(IOThread::ShouldEnableQuicForDataReductionProxy()); 240 EXPECT_FALSE(IOThread::ShouldEnableQuicForDataReductionProxy());
241 EXPECT_TRUE(params.quic_host_whitelist.empty());
241 } 242 }
242 243
243 TEST_F(IOThreadTest, EnableQuicFromQuicProxyFieldTrialGroup) { 244 TEST_F(IOThreadTest, EnableQuicFromQuicProxyFieldTrialGroup) {
244 const struct { 245 const struct {
245 std::string field_trial_group_name; 246 std::string field_trial_group_name;
246 bool expect_enable_quic; 247 bool expect_enable_quic;
247 } tests[] = { 248 } tests[] = {
248 { 249 {
249 std::string(), false, 250 std::string(), false,
250 }, 251 },
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
564 TEST_F(IOThreadTest, AlternativeServiceProbabilityThresholdFromParams) { 565 TEST_F(IOThreadTest, AlternativeServiceProbabilityThresholdFromParams) {
565 field_trial_group_ = "Enabled"; 566 field_trial_group_ = "Enabled";
566 field_trial_params_["alternative_service_probability_threshold"] = ".5"; 567 field_trial_params_["alternative_service_probability_threshold"] = ".5";
567 568
568 ConfigureQuicGlobals(); 569 ConfigureQuicGlobals();
569 net::HttpNetworkSession::Params params; 570 net::HttpNetworkSession::Params params;
570 InitializeNetworkSessionParams(&params); 571 InitializeNetworkSessionParams(&params);
571 EXPECT_EQ(.5, params.alternative_service_probability_threshold); 572 EXPECT_EQ(.5, params.alternative_service_probability_threshold);
572 } 573 }
573 574
575 TEST_F(IOThreadTest, QuicWhitelistFromCommandLinet) {
576 command_line_.AppendSwitch("enable-quic");
577 command_line_.AppendSwitchASCII("quic-host-whitelist",
578 "www.example.org, www.example.com");
579
580 ConfigureQuicGlobals();
581 net::HttpNetworkSession::Params params;
582 InitializeNetworkSessionParams(&params);
583 EXPECT_EQ(2u, params.quic_host_whitelist.size());
584 EXPECT_EQ("www.example.org", params.quic_host_whitelist[0]);
585 EXPECT_EQ("www.example.com", params.quic_host_whitelist[1]);
586 }
587
588 TEST_F(IOThreadTest, QuicWhitelistFromParams) {
589 field_trial_group_ = "Enabled";
590 field_trial_params_["quic_host_whitelist"] =
591 "www.example.org, www.example.com";
592
593 ConfigureQuicGlobals();
594 net::HttpNetworkSession::Params params;
595 InitializeNetworkSessionParams(&params);
596 EXPECT_EQ(2u, params.quic_host_whitelist.size());
597 EXPECT_EQ("www.example.org", params.quic_host_whitelist[0]);
598 EXPECT_EQ("www.example.com", params.quic_host_whitelist[1]);
599 }
600
574 TEST_F(IOThreadTest, QuicDisallowedByPolicy) { 601 TEST_F(IOThreadTest, QuicDisallowedByPolicy) {
575 command_line_.AppendSwitch(switches::kEnableQuic); 602 command_line_.AppendSwitch(switches::kEnableQuic);
576 is_quic_allowed_by_policy_ = false; 603 is_quic_allowed_by_policy_ = false;
577 ConfigureQuicGlobals(); 604 ConfigureQuicGlobals();
578 605
579 net::HttpNetworkSession::Params params; 606 net::HttpNetworkSession::Params params;
580 InitializeNetworkSessionParams(&params); 607 InitializeNetworkSessionParams(&params);
581 EXPECT_FALSE(params.enable_quic); 608 EXPECT_FALSE(params.enable_quic);
582 } 609 }
583 610
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
755 &IOThreadTestWithIOThreadObject::CheckAuthAndroidNegoitateAccountType, 782 &IOThreadTestWithIOThreadObject::CheckAuthAndroidNegoitateAccountType,
756 base::Unretained(this), "acc1")); 783 base::Unretained(this), "acc1"));
757 pref_service()->SetString(prefs::kAuthAndroidNegotiateAccountType, "acc2"); 784 pref_service()->SetString(prefs::kAuthAndroidNegotiateAccountType, "acc2");
758 RunOnIOThreadBlocking(base::Bind( 785 RunOnIOThreadBlocking(base::Bind(
759 &IOThreadTestWithIOThreadObject::CheckAuthAndroidNegoitateAccountType, 786 &IOThreadTestWithIOThreadObject::CheckAuthAndroidNegoitateAccountType,
760 base::Unretained(this), "acc2")); 787 base::Unretained(this), "acc2"));
761 } 788 }
762 #endif 789 #endif
763 790
764 } // namespace test 791 } // namespace test
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698