| 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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 EXPECT_EQ(0, params_.quic_max_number_of_lossy_connections); | 182 EXPECT_EQ(0, params_.quic_max_number_of_lossy_connections); |
| 183 EXPECT_EQ(1.0f, params_.quic_packet_loss_threshold); | 183 EXPECT_EQ(1.0f, params_.quic_packet_loss_threshold); |
| 184 EXPECT_TRUE(params_.quic_delay_tcp_race); | 184 EXPECT_TRUE(params_.quic_delay_tcp_race); |
| 185 EXPECT_FALSE(params_.quic_close_sessions_on_ip_change); | 185 EXPECT_FALSE(params_.quic_close_sessions_on_ip_change); |
| 186 EXPECT_EQ(net::kIdleConnectionTimeoutSeconds, | 186 EXPECT_EQ(net::kIdleConnectionTimeoutSeconds, |
| 187 params_.quic_idle_connection_timeout_seconds); | 187 params_.quic_idle_connection_timeout_seconds); |
| 188 EXPECT_FALSE(params_.quic_disable_preconnect_if_0rtt); | 188 EXPECT_FALSE(params_.quic_disable_preconnect_if_0rtt); |
| 189 EXPECT_FALSE(params_.quic_migrate_sessions_on_network_change); | 189 EXPECT_FALSE(params_.quic_migrate_sessions_on_network_change); |
| 190 EXPECT_FALSE(params_.quic_migrate_sessions_early); | 190 EXPECT_FALSE(params_.quic_migrate_sessions_early); |
| 191 EXPECT_TRUE(params_.quic_host_whitelist.empty()); | 191 EXPECT_TRUE(params_.quic_host_whitelist.empty()); |
| 192 EXPECT_FALSE(params_.quic_race_cert_verification); |
| 192 | 193 |
| 193 net::HttpNetworkSession::Params default_params; | 194 net::HttpNetworkSession::Params default_params; |
| 194 EXPECT_EQ(default_params.quic_supported_versions, | 195 EXPECT_EQ(default_params.quic_supported_versions, |
| 195 params_.quic_supported_versions); | 196 params_.quic_supported_versions); |
| 196 } | 197 } |
| 197 | 198 |
| 198 TEST_F(NetworkSessionConfiguratorTest, DisableQuicFromCommandLine) { | 199 TEST_F(NetworkSessionConfiguratorTest, DisableQuicFromCommandLine) { |
| 199 base::FieldTrialList::CreateFieldTrial("QUIC", "Enabled"); | 200 base::FieldTrialList::CreateFieldTrial("QUIC", "Enabled"); |
| 200 base::CommandLine::ForCurrentProcess()->AppendSwitch("disable-quic"); | 201 base::CommandLine::ForCurrentProcess()->AppendSwitch("disable-quic"); |
| 201 | 202 |
| (...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 581 variations::AssociateVariationParams("QUIC", "Enabled", field_trial_params); | 582 variations::AssociateVariationParams("QUIC", "Enabled", field_trial_params); |
| 582 base::FieldTrialList::CreateFieldTrial("QUIC", "Enabled"); | 583 base::FieldTrialList::CreateFieldTrial("QUIC", "Enabled"); |
| 583 | 584 |
| 584 ParseFieldTrials(); | 585 ParseFieldTrials(); |
| 585 | 586 |
| 586 EXPECT_EQ(2u, params_.quic_host_whitelist.size()); | 587 EXPECT_EQ(2u, params_.quic_host_whitelist.size()); |
| 587 EXPECT_TRUE(ContainsKey(params_.quic_host_whitelist, "www.example.org")); | 588 EXPECT_TRUE(ContainsKey(params_.quic_host_whitelist, "www.example.org")); |
| 588 EXPECT_TRUE(ContainsKey(params_.quic_host_whitelist, "www.example.com")); | 589 EXPECT_TRUE(ContainsKey(params_.quic_host_whitelist, "www.example.com")); |
| 589 } | 590 } |
| 590 | 591 |
| 592 TEST_F(NetworkSessionConfiguratorTest, QuicRaceCertVerification) { |
| 593 std::map<std::string, std::string> field_trial_params; |
| 594 field_trial_params["race_cert_verification"] = "true"; |
| 595 variations::AssociateVariationParams("QUIC", "Enabled", field_trial_params); |
| 596 base::FieldTrialList::CreateFieldTrial("QUIC", "Enabled"); |
| 597 |
| 598 ParseFieldTrials(); |
| 599 |
| 600 EXPECT_TRUE(params_.quic_race_cert_verification); |
| 601 } |
| 602 |
| 591 TEST_F(NetworkSessionConfiguratorTest, QuicDisallowedByPolicy) { | 603 TEST_F(NetworkSessionConfiguratorTest, QuicDisallowedByPolicy) { |
| 592 base::CommandLine::ForCurrentProcess()->AppendSwitch("enable-quic"); | 604 base::CommandLine::ForCurrentProcess()->AppendSwitch("enable-quic"); |
| 593 is_quic_allowed_by_policy_ = false; | 605 is_quic_allowed_by_policy_ = false; |
| 594 | 606 |
| 595 ParseFieldTrialsAndCommandLine(); | 607 ParseFieldTrialsAndCommandLine(); |
| 596 | 608 |
| 597 EXPECT_FALSE(params_.enable_quic); | 609 EXPECT_FALSE(params_.enable_quic); |
| 598 } | 610 } |
| 599 | 611 |
| 600 TEST_F(NetworkSessionConfiguratorTest, TCPFastOpenHttpsEnabled) { | 612 TEST_F(NetworkSessionConfiguratorTest, TCPFastOpenHttpsEnabled) { |
| 601 base::FieldTrialList::CreateFieldTrial("TCPFastOpen", "HttpsEnabled"); | 613 base::FieldTrialList::CreateFieldTrial("TCPFastOpen", "HttpsEnabled"); |
| 602 | 614 |
| 603 ParseFieldTrials(); | 615 ParseFieldTrials(); |
| 604 | 616 |
| 605 EXPECT_TRUE(params_.enable_tcp_fast_open_for_ssl); | 617 EXPECT_TRUE(params_.enable_tcp_fast_open_for_ssl); |
| 606 } | 618 } |
| 607 | 619 |
| 608 } // namespace test | 620 } // namespace test |
| OLD | NEW |