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 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 EXPECT_FALSE(params_.quic_disable_connection_pooling); | 244 EXPECT_FALSE(params_.quic_disable_connection_pooling); |
245 EXPECT_EQ(0.25f, params_.quic_load_server_info_timeout_srtt_multiplier); | 245 EXPECT_EQ(0.25f, params_.quic_load_server_info_timeout_srtt_multiplier); |
246 EXPECT_FALSE(params_.quic_enable_connection_racing); | 246 EXPECT_FALSE(params_.quic_enable_connection_racing); |
247 EXPECT_FALSE(params_.quic_enable_non_blocking_io); | 247 EXPECT_FALSE(params_.quic_enable_non_blocking_io); |
248 EXPECT_FALSE(params_.quic_disable_disk_cache); | 248 EXPECT_FALSE(params_.quic_disable_disk_cache); |
249 EXPECT_FALSE(params_.quic_prefer_aes); | 249 EXPECT_FALSE(params_.quic_prefer_aes); |
250 EXPECT_TRUE(params_.parse_alternative_services); | 250 EXPECT_TRUE(params_.parse_alternative_services); |
251 EXPECT_FALSE(params_.enable_alternative_service_with_different_host); | 251 EXPECT_FALSE(params_.enable_alternative_service_with_different_host); |
252 EXPECT_EQ(0, params_.quic_max_number_of_lossy_connections); | 252 EXPECT_EQ(0, params_.quic_max_number_of_lossy_connections); |
253 EXPECT_EQ(1.0f, params_.quic_packet_loss_threshold); | 253 EXPECT_EQ(1.0f, params_.quic_packet_loss_threshold); |
254 EXPECT_FALSE(params_.quic_delay_tcp_race); | 254 EXPECT_TRUE(params_.quic_delay_tcp_race); |
255 EXPECT_FALSE(params_.quic_close_sessions_on_ip_change); | 255 EXPECT_FALSE(params_.quic_close_sessions_on_ip_change); |
256 EXPECT_EQ(net::kIdleConnectionTimeoutSeconds, | 256 EXPECT_EQ(net::kIdleConnectionTimeoutSeconds, |
257 params_.quic_idle_connection_timeout_seconds); | 257 params_.quic_idle_connection_timeout_seconds); |
258 EXPECT_FALSE(params_.quic_disable_preconnect_if_0rtt); | 258 EXPECT_FALSE(params_.quic_disable_preconnect_if_0rtt); |
259 EXPECT_FALSE(params_.quic_migrate_sessions_on_network_change); | 259 EXPECT_FALSE(params_.quic_migrate_sessions_on_network_change); |
260 EXPECT_FALSE(params_.quic_migrate_sessions_early); | 260 EXPECT_FALSE(params_.quic_migrate_sessions_early); |
261 EXPECT_TRUE(params_.quic_host_whitelist.empty()); | 261 EXPECT_TRUE(params_.quic_host_whitelist.empty()); |
262 | 262 |
263 net::HttpNetworkSession::Params default_params; | 263 net::HttpNetworkSession::Params default_params; |
264 EXPECT_EQ(default_params.quic_supported_versions, | 264 EXPECT_EQ(default_params.quic_supported_versions, |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
570 std::map<std::string, std::string> field_trial_params; | 570 std::map<std::string, std::string> field_trial_params; |
571 field_trial_params["receive_buffer_size"] = "2097152"; | 571 field_trial_params["receive_buffer_size"] = "2097152"; |
572 variations::AssociateVariationParams("QUIC", "Enabled", field_trial_params); | 572 variations::AssociateVariationParams("QUIC", "Enabled", field_trial_params); |
573 base::FieldTrialList::CreateFieldTrial("QUIC", "Enabled"); | 573 base::FieldTrialList::CreateFieldTrial("QUIC", "Enabled"); |
574 | 574 |
575 ParseFieldTrials(); | 575 ParseFieldTrials(); |
576 | 576 |
577 EXPECT_EQ(2097152, params_.quic_socket_receive_buffer_size); | 577 EXPECT_EQ(2097152, params_.quic_socket_receive_buffer_size); |
578 } | 578 } |
579 | 579 |
580 TEST_F(NetworkSessionConfiguratorTest, QuicDelayTcpConnection) { | 580 TEST_F(NetworkSessionConfiguratorTest, QuicDelayTcpRace) { |
581 std::map<std::string, std::string> field_trial_params; | 581 std::map<std::string, std::string> field_trial_params; |
582 field_trial_params["delay_tcp_race"] = "true"; | 582 field_trial_params["delay_tcp_race"] = "true"; |
583 variations::AssociateVariationParams("QUIC", "Enabled", field_trial_params); | 583 variations::AssociateVariationParams("QUIC", "Enabled", field_trial_params); |
584 base::FieldTrialList::CreateFieldTrial("QUIC", "Enabled"); | 584 base::FieldTrialList::CreateFieldTrial("QUIC", "Enabled"); |
585 | 585 |
586 ParseFieldTrials(); | 586 ParseFieldTrials(); |
587 | 587 |
588 EXPECT_TRUE(params_.quic_delay_tcp_race); | 588 EXPECT_TRUE(params_.quic_delay_tcp_race); |
589 } | 589 } |
590 | 590 |
| 591 TEST_F(NetworkSessionConfiguratorTest, QuicWithNoDelayTcpRaceParam) { |
| 592 std::map<std::string, std::string> field_trial_params; |
| 593 variations::AssociateVariationParams("QUIC", "Enabled", field_trial_params); |
| 594 base::FieldTrialList::CreateFieldTrial("QUIC", "Enabled"); |
| 595 |
| 596 ParseFieldTrials(); |
| 597 |
| 598 // If there is no delay_tcp_race field trial param, then it should default to |
| 599 // true. |
| 600 EXPECT_TRUE(params_.quic_delay_tcp_race); |
| 601 } |
| 602 |
591 TEST_F(NetworkSessionConfiguratorTest, QuicOriginsToForceQuicOn) { | 603 TEST_F(NetworkSessionConfiguratorTest, QuicOriginsToForceQuicOn) { |
592 base::CommandLine::ForCurrentProcess()->AppendSwitch("enable-quic"); | 604 base::CommandLine::ForCurrentProcess()->AppendSwitch("enable-quic"); |
593 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( | 605 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( |
594 "origin-to-force-quic-on", "www.example.com:443, www.example.org:443"); | 606 "origin-to-force-quic-on", "www.example.com:443, www.example.org:443"); |
595 | 607 |
596 ParseFieldTrialsAndCommandLine(); | 608 ParseFieldTrialsAndCommandLine(); |
597 | 609 |
598 EXPECT_EQ(2u, params_.origins_to_force_quic_on.size()); | 610 EXPECT_EQ(2u, params_.origins_to_force_quic_on.size()); |
599 EXPECT_TRUE( | 611 EXPECT_TRUE( |
600 ContainsKey(params_.origins_to_force_quic_on, | 612 ContainsKey(params_.origins_to_force_quic_on, |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
826 &IOThreadTestWithIOThreadObject::CheckAuthAndroidNegoitateAccountType, | 838 &IOThreadTestWithIOThreadObject::CheckAuthAndroidNegoitateAccountType, |
827 base::Unretained(this), "acc1")); | 839 base::Unretained(this), "acc1")); |
828 pref_service()->SetString(prefs::kAuthAndroidNegotiateAccountType, "acc2"); | 840 pref_service()->SetString(prefs::kAuthAndroidNegotiateAccountType, "acc2"); |
829 RunOnIOThreadBlocking(base::Bind( | 841 RunOnIOThreadBlocking(base::Bind( |
830 &IOThreadTestWithIOThreadObject::CheckAuthAndroidNegoitateAccountType, | 842 &IOThreadTestWithIOThreadObject::CheckAuthAndroidNegoitateAccountType, |
831 base::Unretained(this), "acc2")); | 843 base::Unretained(this), "acc2")); |
832 } | 844 } |
833 #endif | 845 #endif |
834 | 846 |
835 } // namespace test | 847 } // namespace test |
OLD | NEW |