| 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 field_trial_group_ = "Enabled"; | 228 field_trial_group_ = "Enabled"; |
| 229 | 229 |
| 230 ConfigureQuicGlobals(); | 230 ConfigureQuicGlobals(); |
| 231 net::HttpNetworkSession::Params default_params; | 231 net::HttpNetworkSession::Params default_params; |
| 232 net::HttpNetworkSession::Params params; | 232 net::HttpNetworkSession::Params params; |
| 233 InitializeNetworkSessionParams(¶ms); | 233 InitializeNetworkSessionParams(¶ms); |
| 234 EXPECT_TRUE(params.enable_quic); | 234 EXPECT_TRUE(params.enable_quic); |
| 235 EXPECT_FALSE(params.disable_quic_on_timeout_with_open_streams); | 235 EXPECT_FALSE(params.disable_quic_on_timeout_with_open_streams); |
| 236 EXPECT_TRUE(params.enable_quic_for_proxies); | 236 EXPECT_TRUE(params.enable_quic_for_proxies); |
| 237 EXPECT_EQ(1350u, params.quic_max_packet_length); | 237 EXPECT_EQ(1350u, params.quic_max_packet_length); |
| 238 EXPECT_EQ(1.0, params.alternative_service_probability_threshold); |
| 238 EXPECT_EQ(default_params.quic_supported_versions, | 239 EXPECT_EQ(default_params.quic_supported_versions, |
| 239 params.quic_supported_versions); | 240 params.quic_supported_versions); |
| 240 EXPECT_EQ(net::QuicTagVector(), params.quic_connection_options); | 241 EXPECT_EQ(net::QuicTagVector(), params.quic_connection_options); |
| 241 EXPECT_FALSE(params.quic_always_require_handshake_confirmation); | 242 EXPECT_FALSE(params.quic_always_require_handshake_confirmation); |
| 242 EXPECT_FALSE(params.quic_disable_connection_pooling); | 243 EXPECT_FALSE(params.quic_disable_connection_pooling); |
| 243 EXPECT_EQ(0.25f, params.quic_load_server_info_timeout_srtt_multiplier); | 244 EXPECT_EQ(0.25f, params.quic_load_server_info_timeout_srtt_multiplier); |
| 244 EXPECT_FALSE(params.quic_enable_connection_racing); | 245 EXPECT_FALSE(params.quic_enable_connection_racing); |
| 245 EXPECT_FALSE(params.quic_enable_non_blocking_io); | 246 EXPECT_FALSE(params.quic_enable_non_blocking_io); |
| 246 EXPECT_FALSE(params.quic_disable_disk_cache); | 247 EXPECT_FALSE(params.quic_disable_disk_cache); |
| 247 EXPECT_FALSE(params.quic_prefer_aes); | 248 EXPECT_FALSE(params.quic_prefer_aes); |
| (...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 596 | 597 |
| 597 TEST_F(IOThreadTest, QuicDelayTcpConnection) { | 598 TEST_F(IOThreadTest, QuicDelayTcpConnection) { |
| 598 field_trial_group_ = "Enabled"; | 599 field_trial_group_ = "Enabled"; |
| 599 field_trial_params_["delay_tcp_race"] = "true"; | 600 field_trial_params_["delay_tcp_race"] = "true"; |
| 600 ConfigureQuicGlobals(); | 601 ConfigureQuicGlobals(); |
| 601 net::HttpNetworkSession::Params params; | 602 net::HttpNetworkSession::Params params; |
| 602 InitializeNetworkSessionParams(¶ms); | 603 InitializeNetworkSessionParams(¶ms); |
| 603 EXPECT_TRUE(params.quic_delay_tcp_race); | 604 EXPECT_TRUE(params.quic_delay_tcp_race); |
| 604 } | 605 } |
| 605 | 606 |
| 607 TEST_F(IOThreadTest, AlternativeServiceProbabilityThresholdFromFlag) { |
| 608 command_line_.AppendSwitchASCII("alternative-service-probability-threshold", |
| 609 "0.5"); |
| 610 |
| 611 ConfigureQuicGlobals(); |
| 612 net::HttpNetworkSession::Params params; |
| 613 InitializeNetworkSessionParams(¶ms); |
| 614 EXPECT_EQ(.5, params.alternative_service_probability_threshold); |
| 615 } |
| 616 |
| 617 TEST_F(IOThreadTest, AlternativeServiceProbabilityThresholdFromEnableQuicFlag) { |
| 618 command_line_.AppendSwitch("enable-quic"); |
| 619 |
| 620 ConfigureQuicGlobals(); |
| 621 net::HttpNetworkSession::Params params; |
| 622 InitializeNetworkSessionParams(¶ms); |
| 623 EXPECT_EQ(0, params.alternative_service_probability_threshold); |
| 624 } |
| 625 |
| 626 // TODO(bnc): Remove when new parameter name rolls out and server configuration |
| 627 // is changed. |
| 628 TEST_F(IOThreadTest, AlternativeServiceProbabilityThresholdFromOldParams) { |
| 629 field_trial_group_ = "Enabled"; |
| 630 field_trial_params_["alternate_protocol_probability_threshold"] = ".5"; |
| 631 |
| 632 ConfigureQuicGlobals(); |
| 633 net::HttpNetworkSession::Params params; |
| 634 InitializeNetworkSessionParams(¶ms); |
| 635 EXPECT_EQ(.5, params.alternative_service_probability_threshold); |
| 636 } |
| 637 |
| 638 TEST_F(IOThreadTest, AlternativeServiceProbabilityThresholdFromParams) { |
| 639 field_trial_group_ = "Enabled"; |
| 640 field_trial_params_["alternative_service_probability_threshold"] = ".5"; |
| 641 |
| 642 ConfigureQuicGlobals(); |
| 643 net::HttpNetworkSession::Params params; |
| 644 InitializeNetworkSessionParams(¶ms); |
| 645 EXPECT_EQ(.5, params.alternative_service_probability_threshold); |
| 646 } |
| 647 |
| 606 TEST_F(IOThreadTest, QuicWhitelistFromCommandLinet) { | 648 TEST_F(IOThreadTest, QuicWhitelistFromCommandLinet) { |
| 607 command_line_.AppendSwitch("enable-quic"); | 649 command_line_.AppendSwitch("enable-quic"); |
| 608 command_line_.AppendSwitchASCII("quic-host-whitelist", | 650 command_line_.AppendSwitchASCII("quic-host-whitelist", |
| 609 "www.example.org, www.example.com"); | 651 "www.example.org, www.example.com"); |
| 610 | 652 |
| 611 ConfigureQuicGlobals(); | 653 ConfigureQuicGlobals(); |
| 612 net::HttpNetworkSession::Params params; | 654 net::HttpNetworkSession::Params params; |
| 613 InitializeNetworkSessionParams(¶ms); | 655 InitializeNetworkSessionParams(¶ms); |
| 614 EXPECT_EQ(2u, params.quic_host_whitelist.size()); | 656 EXPECT_EQ(2u, params.quic_host_whitelist.size()); |
| 615 EXPECT_TRUE(ContainsKey(params.quic_host_whitelist, "www.example.org")); | 657 EXPECT_TRUE(ContainsKey(params.quic_host_whitelist, "www.example.org")); |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 819 &IOThreadTestWithIOThreadObject::CheckAuthAndroidNegoitateAccountType, | 861 &IOThreadTestWithIOThreadObject::CheckAuthAndroidNegoitateAccountType, |
| 820 base::Unretained(this), "acc1")); | 862 base::Unretained(this), "acc1")); |
| 821 pref_service()->SetString(prefs::kAuthAndroidNegotiateAccountType, "acc2"); | 863 pref_service()->SetString(prefs::kAuthAndroidNegotiateAccountType, "acc2"); |
| 822 RunOnIOThreadBlocking(base::Bind( | 864 RunOnIOThreadBlocking(base::Bind( |
| 823 &IOThreadTestWithIOThreadObject::CheckAuthAndroidNegoitateAccountType, | 865 &IOThreadTestWithIOThreadObject::CheckAuthAndroidNegoitateAccountType, |
| 824 base::Unretained(this), "acc2")); | 866 base::Unretained(this), "acc2")); |
| 825 } | 867 } |
| 826 #endif | 868 #endif |
| 827 | 869 |
| 828 } // namespace test | 870 } // namespace test |
| OLD | NEW |