| OLD | NEW |
| 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2016 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 "components/network_session_configurator/network_session_configurator.h
" | 5 #include "components/network_session_configurator/network_session_configurator.h
" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/metrics/field_trial.h" | 10 #include "base/metrics/field_trial.h" |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 EXPECT_FALSE(params_.quic_disable_connection_pooling); | 211 EXPECT_FALSE(params_.quic_disable_connection_pooling); |
| 212 EXPECT_EQ(0.25f, params_.quic_load_server_info_timeout_srtt_multiplier); | 212 EXPECT_EQ(0.25f, params_.quic_load_server_info_timeout_srtt_multiplier); |
| 213 EXPECT_FALSE(params_.quic_enable_connection_racing); | 213 EXPECT_FALSE(params_.quic_enable_connection_racing); |
| 214 EXPECT_FALSE(params_.quic_enable_non_blocking_io); | 214 EXPECT_FALSE(params_.quic_enable_non_blocking_io); |
| 215 EXPECT_FALSE(params_.quic_disable_disk_cache); | 215 EXPECT_FALSE(params_.quic_disable_disk_cache); |
| 216 EXPECT_FALSE(params_.quic_prefer_aes); | 216 EXPECT_FALSE(params_.quic_prefer_aes); |
| 217 EXPECT_TRUE(params_.parse_alternative_services); | 217 EXPECT_TRUE(params_.parse_alternative_services); |
| 218 EXPECT_FALSE(params_.enable_alternative_service_with_different_host); | 218 EXPECT_FALSE(params_.enable_alternative_service_with_different_host); |
| 219 EXPECT_EQ(0, params_.quic_max_number_of_lossy_connections); | 219 EXPECT_EQ(0, params_.quic_max_number_of_lossy_connections); |
| 220 EXPECT_EQ(1.0f, params_.quic_packet_loss_threshold); | 220 EXPECT_EQ(1.0f, params_.quic_packet_loss_threshold); |
| 221 EXPECT_TRUE(params_.quic_delay_tcp_race); |
| 221 EXPECT_FALSE(params_.quic_close_sessions_on_ip_change); | 222 EXPECT_FALSE(params_.quic_close_sessions_on_ip_change); |
| 222 EXPECT_EQ(net::kIdleConnectionTimeoutSeconds, | 223 EXPECT_EQ(net::kIdleConnectionTimeoutSeconds, |
| 223 params_.quic_idle_connection_timeout_seconds); | 224 params_.quic_idle_connection_timeout_seconds); |
| 224 EXPECT_FALSE(params_.quic_disable_preconnect_if_0rtt); | 225 EXPECT_FALSE(params_.quic_disable_preconnect_if_0rtt); |
| 225 EXPECT_FALSE(params_.quic_migrate_sessions_on_network_change); | 226 EXPECT_FALSE(params_.quic_migrate_sessions_on_network_change); |
| 226 EXPECT_FALSE(params_.quic_migrate_sessions_early); | 227 EXPECT_FALSE(params_.quic_migrate_sessions_early); |
| 227 EXPECT_TRUE(params_.quic_host_whitelist.empty()); | 228 EXPECT_TRUE(params_.quic_host_whitelist.empty()); |
| 228 | 229 |
| 229 net::HttpNetworkSession::Params default_params; | 230 net::HttpNetworkSession::Params default_params; |
| 230 EXPECT_EQ(default_params.quic_supported_versions, | 231 EXPECT_EQ(default_params.quic_supported_versions, |
| (...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 555 std::map<std::string, std::string> field_trial_params; | 556 std::map<std::string, std::string> field_trial_params; |
| 556 field_trial_params["receive_buffer_size"] = "2097152"; | 557 field_trial_params["receive_buffer_size"] = "2097152"; |
| 557 variations::AssociateVariationParams("QUIC", "Enabled", field_trial_params); | 558 variations::AssociateVariationParams("QUIC", "Enabled", field_trial_params); |
| 558 base::FieldTrialList::CreateFieldTrial("QUIC", "Enabled"); | 559 base::FieldTrialList::CreateFieldTrial("QUIC", "Enabled"); |
| 559 | 560 |
| 560 ParseFieldTrials(); | 561 ParseFieldTrials(); |
| 561 | 562 |
| 562 EXPECT_EQ(2097152, params_.quic_socket_receive_buffer_size); | 563 EXPECT_EQ(2097152, params_.quic_socket_receive_buffer_size); |
| 563 } | 564 } |
| 564 | 565 |
| 566 TEST_F(NetworkSessionConfiguratorTest, QuicDisableDelayTcpRace) { |
| 567 std::map<std::string, std::string> field_trial_params; |
| 568 field_trial_params["disable_delay_tcp_race"] = "true"; |
| 569 variations::AssociateVariationParams("QUIC", "Enabled", field_trial_params); |
| 570 base::FieldTrialList::CreateFieldTrial("QUIC", "Enabled"); |
| 571 |
| 572 ParseFieldTrials(); |
| 573 |
| 574 EXPECT_FALSE(params_.quic_delay_tcp_race); |
| 575 } |
| 576 |
| 565 TEST_F(NetworkSessionConfiguratorTest, QuicOriginsToForceQuicOn) { | 577 TEST_F(NetworkSessionConfiguratorTest, QuicOriginsToForceQuicOn) { |
| 566 base::CommandLine::ForCurrentProcess()->AppendSwitch("enable-quic"); | 578 base::CommandLine::ForCurrentProcess()->AppendSwitch("enable-quic"); |
| 567 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( | 579 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( |
| 568 "origin-to-force-quic-on", "www.example.com:443, www.example.org:443"); | 580 "origin-to-force-quic-on", "www.example.com:443, www.example.org:443"); |
| 569 | 581 |
| 570 ParseFieldTrialsAndCommandLine(); | 582 ParseFieldTrialsAndCommandLine(); |
| 571 | 583 |
| 572 EXPECT_EQ(2u, params_.origins_to_force_quic_on.size()); | 584 EXPECT_EQ(2u, params_.origins_to_force_quic_on.size()); |
| 573 EXPECT_TRUE( | 585 EXPECT_TRUE( |
| 574 ContainsKey(params_.origins_to_force_quic_on, | 586 ContainsKey(params_.origins_to_force_quic_on, |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 615 | 627 |
| 616 TEST_F(NetworkSessionConfiguratorTest, TCPFastOpenHttpsEnabled) { | 628 TEST_F(NetworkSessionConfiguratorTest, TCPFastOpenHttpsEnabled) { |
| 617 base::FieldTrialList::CreateFieldTrial("TCPFastOpen", "HttpsEnabled"); | 629 base::FieldTrialList::CreateFieldTrial("TCPFastOpen", "HttpsEnabled"); |
| 618 | 630 |
| 619 ParseFieldTrials(); | 631 ParseFieldTrials(); |
| 620 | 632 |
| 621 EXPECT_TRUE(params_.enable_tcp_fast_open_for_ssl); | 633 EXPECT_TRUE(params_.enable_tcp_fast_open_for_ssl); |
| 622 } | 634 } |
| 623 | 635 |
| 624 } // namespace test | 636 } // namespace test |
| OLD | NEW |