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); | |
239 EXPECT_EQ(default_params.quic_supported_versions, | 238 EXPECT_EQ(default_params.quic_supported_versions, |
240 params.quic_supported_versions); | 239 params.quic_supported_versions); |
241 EXPECT_EQ(net::QuicTagVector(), params.quic_connection_options); | 240 EXPECT_EQ(net::QuicTagVector(), params.quic_connection_options); |
242 EXPECT_FALSE(params.quic_always_require_handshake_confirmation); | 241 EXPECT_FALSE(params.quic_always_require_handshake_confirmation); |
243 EXPECT_FALSE(params.quic_disable_connection_pooling); | 242 EXPECT_FALSE(params.quic_disable_connection_pooling); |
244 EXPECT_EQ(0.25f, params.quic_load_server_info_timeout_srtt_multiplier); | 243 EXPECT_EQ(0.25f, params.quic_load_server_info_timeout_srtt_multiplier); |
245 EXPECT_FALSE(params.quic_enable_connection_racing); | 244 EXPECT_FALSE(params.quic_enable_connection_racing); |
246 EXPECT_FALSE(params.quic_enable_non_blocking_io); | 245 EXPECT_FALSE(params.quic_enable_non_blocking_io); |
247 EXPECT_FALSE(params.quic_disable_disk_cache); | 246 EXPECT_FALSE(params.quic_disable_disk_cache); |
248 EXPECT_FALSE(params.quic_prefer_aes); | 247 EXPECT_FALSE(params.quic_prefer_aes); |
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
597 | 596 |
598 TEST_F(IOThreadTest, QuicDelayTcpConnection) { | 597 TEST_F(IOThreadTest, QuicDelayTcpConnection) { |
599 field_trial_group_ = "Enabled"; | 598 field_trial_group_ = "Enabled"; |
600 field_trial_params_["delay_tcp_race"] = "true"; | 599 field_trial_params_["delay_tcp_race"] = "true"; |
601 ConfigureQuicGlobals(); | 600 ConfigureQuicGlobals(); |
602 net::HttpNetworkSession::Params params; | 601 net::HttpNetworkSession::Params params; |
603 InitializeNetworkSessionParams(¶ms); | 602 InitializeNetworkSessionParams(¶ms); |
604 EXPECT_TRUE(params.quic_delay_tcp_race); | 603 EXPECT_TRUE(params.quic_delay_tcp_race); |
605 } | 604 } |
606 | 605 |
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 | |
648 TEST_F(IOThreadTest, QuicWhitelistFromCommandLinet) { | 606 TEST_F(IOThreadTest, QuicWhitelistFromCommandLinet) { |
649 command_line_.AppendSwitch("enable-quic"); | 607 command_line_.AppendSwitch("enable-quic"); |
650 command_line_.AppendSwitchASCII("quic-host-whitelist", | 608 command_line_.AppendSwitchASCII("quic-host-whitelist", |
651 "www.example.org, www.example.com"); | 609 "www.example.org, www.example.com"); |
652 | 610 |
653 ConfigureQuicGlobals(); | 611 ConfigureQuicGlobals(); |
654 net::HttpNetworkSession::Params params; | 612 net::HttpNetworkSession::Params params; |
655 InitializeNetworkSessionParams(¶ms); | 613 InitializeNetworkSessionParams(¶ms); |
656 EXPECT_EQ(2u, params.quic_host_whitelist.size()); | 614 EXPECT_EQ(2u, params.quic_host_whitelist.size()); |
657 EXPECT_TRUE(ContainsKey(params.quic_host_whitelist, "www.example.org")); | 615 EXPECT_TRUE(ContainsKey(params.quic_host_whitelist, "www.example.org")); |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
861 &IOThreadTestWithIOThreadObject::CheckAuthAndroidNegoitateAccountType, | 819 &IOThreadTestWithIOThreadObject::CheckAuthAndroidNegoitateAccountType, |
862 base::Unretained(this), "acc1")); | 820 base::Unretained(this), "acc1")); |
863 pref_service()->SetString(prefs::kAuthAndroidNegotiateAccountType, "acc2"); | 821 pref_service()->SetString(prefs::kAuthAndroidNegotiateAccountType, "acc2"); |
864 RunOnIOThreadBlocking(base::Bind( | 822 RunOnIOThreadBlocking(base::Bind( |
865 &IOThreadTestWithIOThreadObject::CheckAuthAndroidNegoitateAccountType, | 823 &IOThreadTestWithIOThreadObject::CheckAuthAndroidNegoitateAccountType, |
866 base::Unretained(this), "acc2")); | 824 base::Unretained(this), "acc2")); |
867 } | 825 } |
868 #endif | 826 #endif |
869 | 827 |
870 } // namespace test | 828 } // namespace test |
OLD | NEW |