| 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 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 EXPECT_FALSE(params.quic_prefer_aes); | 228 EXPECT_FALSE(params.quic_prefer_aes); |
| 229 EXPECT_FALSE(params.use_alternative_services); | 229 EXPECT_FALSE(params.use_alternative_services); |
| 230 EXPECT_EQ(0, params.quic_max_number_of_lossy_connections); | 230 EXPECT_EQ(0, params.quic_max_number_of_lossy_connections); |
| 231 EXPECT_EQ(1.0f, params.quic_packet_loss_threshold); | 231 EXPECT_EQ(1.0f, params.quic_packet_loss_threshold); |
| 232 EXPECT_FALSE(params.quic_delay_tcp_race); | 232 EXPECT_FALSE(params.quic_delay_tcp_race); |
| 233 EXPECT_FALSE(params.quic_close_sessions_on_ip_change); | 233 EXPECT_FALSE(params.quic_close_sessions_on_ip_change); |
| 234 EXPECT_EQ(net::kIdleConnectionTimeoutSeconds, | 234 EXPECT_EQ(net::kIdleConnectionTimeoutSeconds, |
| 235 params.quic_idle_connection_timeout_seconds); | 235 params.quic_idle_connection_timeout_seconds); |
| 236 EXPECT_FALSE(params.quic_disable_preconnect_if_0rtt); | 236 EXPECT_FALSE(params.quic_disable_preconnect_if_0rtt); |
| 237 EXPECT_FALSE(IOThread::ShouldEnableQuicForDataReductionProxy()); | 237 EXPECT_FALSE(IOThread::ShouldEnableQuicForDataReductionProxy()); |
| 238 EXPECT_TRUE(params.quic_host_whitelist.empty()); |
| 238 } | 239 } |
| 239 | 240 |
| 240 TEST_F(IOThreadTest, EnableQuicFromQuicProxyFieldTrialGroup) { | 241 TEST_F(IOThreadTest, EnableQuicFromQuicProxyFieldTrialGroup) { |
| 241 const struct { | 242 const struct { |
| 242 std::string field_trial_group_name; | 243 std::string field_trial_group_name; |
| 243 bool expect_enable_quic; | 244 bool expect_enable_quic; |
| 244 } tests[] = { | 245 } tests[] = { |
| 245 { | 246 { |
| 246 std::string(), false, | 247 std::string(), false, |
| 247 }, | 248 }, |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 561 TEST_F(IOThreadTest, AlternativeServiceProbabilityThresholdFromParams) { | 562 TEST_F(IOThreadTest, AlternativeServiceProbabilityThresholdFromParams) { |
| 562 field_trial_group_ = "Enabled"; | 563 field_trial_group_ = "Enabled"; |
| 563 field_trial_params_["alternative_service_probability_threshold"] = ".5"; | 564 field_trial_params_["alternative_service_probability_threshold"] = ".5"; |
| 564 | 565 |
| 565 ConfigureQuicGlobals(); | 566 ConfigureQuicGlobals(); |
| 566 net::HttpNetworkSession::Params params; | 567 net::HttpNetworkSession::Params params; |
| 567 InitializeNetworkSessionParams(¶ms); | 568 InitializeNetworkSessionParams(¶ms); |
| 568 EXPECT_EQ(.5, params.alternative_service_probability_threshold); | 569 EXPECT_EQ(.5, params.alternative_service_probability_threshold); |
| 569 } | 570 } |
| 570 | 571 |
| 572 TEST_F(IOThreadTest, QuicWhitelistFromCommandLinet) { |
| 573 command_line_.AppendSwitch("enable-quic"); |
| 574 command_line_.AppendSwitchASCII("quic-host-whitelist", |
| 575 "www.example.org, www.example.com"); |
| 576 |
| 577 ConfigureQuicGlobals(); |
| 578 net::HttpNetworkSession::Params params; |
| 579 InitializeNetworkSessionParams(¶ms); |
| 580 EXPECT_EQ(2u, params.quic_host_whitelist.size()); |
| 581 EXPECT_TRUE(ContainsKey(params.quic_host_whitelist, "www.example.org")); |
| 582 EXPECT_TRUE(ContainsKey(params.quic_host_whitelist, "www.example.com")); |
| 583 } |
| 584 |
| 585 TEST_F(IOThreadTest, QuicWhitelistFromParams) { |
| 586 field_trial_group_ = "Enabled"; |
| 587 field_trial_params_["quic_host_whitelist"] = |
| 588 "www.example.org, www.example.com"; |
| 589 |
| 590 ConfigureQuicGlobals(); |
| 591 net::HttpNetworkSession::Params params; |
| 592 InitializeNetworkSessionParams(¶ms); |
| 593 EXPECT_EQ(2u, params.quic_host_whitelist.size()); |
| 594 EXPECT_TRUE(ContainsKey(params.quic_host_whitelist, "www.example.org")); |
| 595 EXPECT_TRUE(ContainsKey(params.quic_host_whitelist, "www.example.com")); |
| 596 } |
| 597 |
| 571 TEST_F(IOThreadTest, QuicDisallowedByPolicy) { | 598 TEST_F(IOThreadTest, QuicDisallowedByPolicy) { |
| 572 command_line_.AppendSwitch(switches::kEnableQuic); | 599 command_line_.AppendSwitch(switches::kEnableQuic); |
| 573 is_quic_allowed_by_policy_ = false; | 600 is_quic_allowed_by_policy_ = false; |
| 574 ConfigureQuicGlobals(); | 601 ConfigureQuicGlobals(); |
| 575 | 602 |
| 576 net::HttpNetworkSession::Params params; | 603 net::HttpNetworkSession::Params params; |
| 577 InitializeNetworkSessionParams(¶ms); | 604 InitializeNetworkSessionParams(¶ms); |
| 578 EXPECT_FALSE(params.enable_quic); | 605 EXPECT_FALSE(params.enable_quic); |
| 579 } | 606 } |
| 580 | 607 |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 758 &IOThreadTestWithIOThreadObject::CheckAuthAndroidNegoitateAccountType, | 785 &IOThreadTestWithIOThreadObject::CheckAuthAndroidNegoitateAccountType, |
| 759 base::Unretained(this), "acc1")); | 786 base::Unretained(this), "acc1")); |
| 760 pref_service()->SetString(prefs::kAuthAndroidNegotiateAccountType, "acc2"); | 787 pref_service()->SetString(prefs::kAuthAndroidNegotiateAccountType, "acc2"); |
| 761 RunOnIOThreadBlocking(base::Bind( | 788 RunOnIOThreadBlocking(base::Bind( |
| 762 &IOThreadTestWithIOThreadObject::CheckAuthAndroidNegoitateAccountType, | 789 &IOThreadTestWithIOThreadObject::CheckAuthAndroidNegoitateAccountType, |
| 763 base::Unretained(this), "acc2")); | 790 base::Unretained(this), "acc2")); |
| 764 } | 791 } |
| 765 #endif | 792 #endif |
| 766 | 793 |
| 767 } // namespace test | 794 } // namespace test |
| OLD | NEW |