| 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 "base/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/metrics/field_trial.h" | 6 #include "base/metrics/field_trial.h" |
| 7 #include "base/test/mock_entropy_provider.h" | 7 #include "base/test/mock_entropy_provider.h" |
| 8 #include "chrome/browser/io_thread.h" | 8 #include "chrome/browser/io_thread.h" |
| 9 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param
s.h" | 9 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param
s.h" |
| 10 #include "net/http/http_network_session.h" | 10 #include "net/http/http_network_session.h" |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 TEST_F(IOThreadTest, EnableQuicFromFieldTrialGroup) { | 186 TEST_F(IOThreadTest, EnableQuicFromFieldTrialGroup) { |
| 187 field_trial_group_ = "Enabled"; | 187 field_trial_group_ = "Enabled"; |
| 188 | 188 |
| 189 ConfigureQuicGlobals(); | 189 ConfigureQuicGlobals(); |
| 190 net::HttpNetworkSession::Params default_params; | 190 net::HttpNetworkSession::Params default_params; |
| 191 net::HttpNetworkSession::Params params; | 191 net::HttpNetworkSession::Params params; |
| 192 InitializeNetworkSessionParams(¶ms); | 192 InitializeNetworkSessionParams(¶ms); |
| 193 EXPECT_TRUE(params.enable_quic); | 193 EXPECT_TRUE(params.enable_quic); |
| 194 EXPECT_TRUE(params.enable_quic_for_proxies); | 194 EXPECT_TRUE(params.enable_quic_for_proxies); |
| 195 EXPECT_EQ(1350u, params.quic_max_packet_length); | 195 EXPECT_EQ(1350u, params.quic_max_packet_length); |
| 196 EXPECT_EQ(1.0, params.alternate_protocol_probability_threshold); | 196 EXPECT_EQ(1.0, params.alternative_service_probability_threshold); |
| 197 EXPECT_EQ(default_params.quic_supported_versions, | 197 EXPECT_EQ(default_params.quic_supported_versions, |
| 198 params.quic_supported_versions); | 198 params.quic_supported_versions); |
| 199 EXPECT_EQ(net::QuicTagVector(), params.quic_connection_options); | 199 EXPECT_EQ(net::QuicTagVector(), params.quic_connection_options); |
| 200 EXPECT_FALSE(params.quic_always_require_handshake_confirmation); | 200 EXPECT_FALSE(params.quic_always_require_handshake_confirmation); |
| 201 EXPECT_FALSE(params.quic_disable_connection_pooling); | 201 EXPECT_FALSE(params.quic_disable_connection_pooling); |
| 202 EXPECT_EQ(0.25f, params.quic_load_server_info_timeout_srtt_multiplier); | 202 EXPECT_EQ(0.25f, params.quic_load_server_info_timeout_srtt_multiplier); |
| 203 EXPECT_FALSE(params.quic_enable_connection_racing); | 203 EXPECT_FALSE(params.quic_enable_connection_racing); |
| 204 EXPECT_FALSE(params.quic_enable_non_blocking_io); | 204 EXPECT_FALSE(params.quic_enable_non_blocking_io); |
| 205 EXPECT_FALSE(params.quic_disable_disk_cache); | 205 EXPECT_FALSE(params.quic_disable_disk_cache); |
| 206 EXPECT_EQ(0, params.quic_max_number_of_lossy_connections); | 206 EXPECT_EQ(0, params.quic_max_number_of_lossy_connections); |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 414 | 414 |
| 415 TEST_F(IOThreadTest, QuicReceiveBufferSize) { | 415 TEST_F(IOThreadTest, QuicReceiveBufferSize) { |
| 416 field_trial_group_ = "Enabled"; | 416 field_trial_group_ = "Enabled"; |
| 417 field_trial_params_["receive_buffer_size"] = "1048576"; | 417 field_trial_params_["receive_buffer_size"] = "1048576"; |
| 418 ConfigureQuicGlobals(); | 418 ConfigureQuicGlobals(); |
| 419 net::HttpNetworkSession::Params params; | 419 net::HttpNetworkSession::Params params; |
| 420 InitializeNetworkSessionParams(¶ms); | 420 InitializeNetworkSessionParams(¶ms); |
| 421 EXPECT_EQ(1048576, params.quic_socket_receive_buffer_size); | 421 EXPECT_EQ(1048576, params.quic_socket_receive_buffer_size); |
| 422 } | 422 } |
| 423 | 423 |
| 424 TEST_F(IOThreadTest, | 424 TEST_F(IOThreadTest, AlternativeServiceProbabilityThresholdFromFlag) { |
| 425 AlternateProtocolProbabilityThresholdFromFlag) { | |
| 426 command_line_.AppendSwitchASCII("alternate-protocol-probability-threshold", | 425 command_line_.AppendSwitchASCII("alternate-protocol-probability-threshold", |
| 427 ".5"); | 426 ".5"); |
| 428 | 427 |
| 429 ConfigureQuicGlobals(); | 428 ConfigureQuicGlobals(); |
| 430 net::HttpNetworkSession::Params params; | 429 net::HttpNetworkSession::Params params; |
| 431 InitializeNetworkSessionParams(¶ms); | 430 InitializeNetworkSessionParams(¶ms); |
| 432 EXPECT_EQ(.5, params.alternate_protocol_probability_threshold); | 431 EXPECT_EQ(.5, params.alternative_service_probability_threshold); |
| 433 } | 432 } |
| 434 | 433 |
| 435 TEST_F(IOThreadTest, | 434 TEST_F(IOThreadTest, AlternativeServiceProbabilityThresholdFromEnableQuicFlag) { |
| 436 AlternateProtocolProbabilityThresholdFromEnableQuicFlag) { | |
| 437 command_line_.AppendSwitch("enable-quic"); | 435 command_line_.AppendSwitch("enable-quic"); |
| 438 | 436 |
| 439 ConfigureQuicGlobals(); | 437 ConfigureQuicGlobals(); |
| 440 net::HttpNetworkSession::Params params; | 438 net::HttpNetworkSession::Params params; |
| 441 InitializeNetworkSessionParams(¶ms); | 439 InitializeNetworkSessionParams(¶ms); |
| 442 EXPECT_EQ(0, params.alternate_protocol_probability_threshold); | 440 EXPECT_EQ(0, params.alternative_service_probability_threshold); |
| 443 } | 441 } |
| 444 | 442 |
| 445 TEST_F(IOThreadTest, | 443 TEST_F(IOThreadTest, AlternativeServiceProbabilityThresholdFromParams) { |
| 446 AlternateProtocolProbabilityThresholdFromParams) { | |
| 447 field_trial_group_ = "Enabled"; | 444 field_trial_group_ = "Enabled"; |
| 448 field_trial_params_["alternate_protocol_probability_threshold"] = ".5"; | 445 field_trial_params_["alternative_service_probability_threshold"] = ".5"; |
| 449 | 446 |
| 450 ConfigureQuicGlobals(); | 447 ConfigureQuicGlobals(); |
| 451 net::HttpNetworkSession::Params params; | 448 net::HttpNetworkSession::Params params; |
| 452 InitializeNetworkSessionParams(¶ms); | 449 InitializeNetworkSessionParams(¶ms); |
| 453 EXPECT_EQ(.5, params.alternate_protocol_probability_threshold); | 450 EXPECT_EQ(.5, params.alternative_service_probability_threshold); |
| 454 } | 451 } |
| 455 | 452 |
| 456 } // namespace test | 453 } // namespace test |
| OLD | NEW |