| OLD | NEW |
| 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 Loading... |
| 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()); | |
| 242 } | 241 } |
| 243 | 242 |
| 244 TEST_F(IOThreadTest, EnableQuicFromQuicProxyFieldTrialGroup) { | 243 TEST_F(IOThreadTest, EnableQuicFromQuicProxyFieldTrialGroup) { |
| 245 const struct { | 244 const struct { |
| 246 std::string field_trial_group_name; | 245 std::string field_trial_group_name; |
| 247 bool expect_enable_quic; | 246 bool expect_enable_quic; |
| 248 } tests[] = { | 247 } tests[] = { |
| 249 { | 248 { |
| 250 std::string(), false, | 249 std::string(), false, |
| 251 }, | 250 }, |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 565 TEST_F(IOThreadTest, AlternativeServiceProbabilityThresholdFromParams) { | 564 TEST_F(IOThreadTest, AlternativeServiceProbabilityThresholdFromParams) { |
| 566 field_trial_group_ = "Enabled"; | 565 field_trial_group_ = "Enabled"; |
| 567 field_trial_params_["alternative_service_probability_threshold"] = ".5"; | 566 field_trial_params_["alternative_service_probability_threshold"] = ".5"; |
| 568 | 567 |
| 569 ConfigureQuicGlobals(); | 568 ConfigureQuicGlobals(); |
| 570 net::HttpNetworkSession::Params params; | 569 net::HttpNetworkSession::Params params; |
| 571 InitializeNetworkSessionParams(¶ms); | 570 InitializeNetworkSessionParams(¶ms); |
| 572 EXPECT_EQ(.5, params.alternative_service_probability_threshold); | 571 EXPECT_EQ(.5, params.alternative_service_probability_threshold); |
| 573 } | 572 } |
| 574 | 573 |
| 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(¶ms); | |
| 583 EXPECT_EQ(2u, params.quic_host_whitelist.size()); | |
| 584 EXPECT_TRUE(ContainsKey(params.quic_host_whitelist, "www.example.org")); | |
| 585 EXPECT_TRUE(ContainsKey(params.quic_host_whitelist, "www.example.com")); | |
| 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(¶ms); | |
| 596 EXPECT_EQ(2u, params.quic_host_whitelist.size()); | |
| 597 EXPECT_TRUE(ContainsKey(params.quic_host_whitelist, "www.example.org")); | |
| 598 EXPECT_TRUE(ContainsKey(params.quic_host_whitelist, "www.example.com")); | |
| 599 } | |
| 600 | |
| 601 TEST_F(IOThreadTest, QuicDisallowedByPolicy) { | 574 TEST_F(IOThreadTest, QuicDisallowedByPolicy) { |
| 602 command_line_.AppendSwitch(switches::kEnableQuic); | 575 command_line_.AppendSwitch(switches::kEnableQuic); |
| 603 is_quic_allowed_by_policy_ = false; | 576 is_quic_allowed_by_policy_ = false; |
| 604 ConfigureQuicGlobals(); | 577 ConfigureQuicGlobals(); |
| 605 | 578 |
| 606 net::HttpNetworkSession::Params params; | 579 net::HttpNetworkSession::Params params; |
| 607 InitializeNetworkSessionParams(¶ms); | 580 InitializeNetworkSessionParams(¶ms); |
| 608 EXPECT_FALSE(params.enable_quic); | 581 EXPECT_FALSE(params.enable_quic); |
| 609 } | 582 } |
| 610 | 583 |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 782 &IOThreadTestWithIOThreadObject::CheckAuthAndroidNegoitateAccountType, | 755 &IOThreadTestWithIOThreadObject::CheckAuthAndroidNegoitateAccountType, |
| 783 base::Unretained(this), "acc1")); | 756 base::Unretained(this), "acc1")); |
| 784 pref_service()->SetString(prefs::kAuthAndroidNegotiateAccountType, "acc2"); | 757 pref_service()->SetString(prefs::kAuthAndroidNegotiateAccountType, "acc2"); |
| 785 RunOnIOThreadBlocking(base::Bind( | 758 RunOnIOThreadBlocking(base::Bind( |
| 786 &IOThreadTestWithIOThreadObject::CheckAuthAndroidNegoitateAccountType, | 759 &IOThreadTestWithIOThreadObject::CheckAuthAndroidNegoitateAccountType, |
| 787 base::Unretained(this), "acc2")); | 760 base::Unretained(this), "acc2")); |
| 788 } | 761 } |
| 789 #endif | 762 #endif |
| 790 | 763 |
| 791 } // namespace test | 764 } // namespace test |
| OLD | NEW |