| 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 "chrome/common/chrome_switches.h" | 9 #include "chrome/common/chrome_switches.h" |
| 10 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param
s.h" | 10 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param
s.h" |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 EXPECT_FALSE(params.quic_enable_non_blocking_io); | 193 EXPECT_FALSE(params.quic_enable_non_blocking_io); |
| 194 EXPECT_FALSE(params.quic_disable_disk_cache); | 194 EXPECT_FALSE(params.quic_disable_disk_cache); |
| 195 EXPECT_FALSE(params.quic_prefer_aes); | 195 EXPECT_FALSE(params.quic_prefer_aes); |
| 196 EXPECT_FALSE(params.use_alternative_services); | 196 EXPECT_FALSE(params.use_alternative_services); |
| 197 EXPECT_EQ(0, params.quic_max_number_of_lossy_connections); | 197 EXPECT_EQ(0, params.quic_max_number_of_lossy_connections); |
| 198 EXPECT_EQ(1.0f, params.quic_packet_loss_threshold); | 198 EXPECT_EQ(1.0f, params.quic_packet_loss_threshold); |
| 199 EXPECT_FALSE(params.quic_delay_tcp_race); | 199 EXPECT_FALSE(params.quic_delay_tcp_race); |
| 200 EXPECT_FALSE(params.quic_close_sessions_on_ip_change); | 200 EXPECT_FALSE(params.quic_close_sessions_on_ip_change); |
| 201 EXPECT_EQ(net::kIdleConnectionTimeoutSeconds, | 201 EXPECT_EQ(net::kIdleConnectionTimeoutSeconds, |
| 202 params.quic_idle_connection_timeout_seconds); | 202 params.quic_idle_connection_timeout_seconds); |
| 203 EXPECT_FALSE(params.quic_disable_preconnect_if_0rtt); |
| 203 EXPECT_FALSE(IOThread::ShouldEnableQuicForDataReductionProxy()); | 204 EXPECT_FALSE(IOThread::ShouldEnableQuicForDataReductionProxy()); |
| 204 } | 205 } |
| 205 | 206 |
| 206 TEST_F(IOThreadTest, EnableQuicFromQuicProxyFieldTrialGroup) { | 207 TEST_F(IOThreadTest, EnableQuicFromQuicProxyFieldTrialGroup) { |
| 207 const struct { | 208 const struct { |
| 208 std::string field_trial_group_name; | 209 std::string field_trial_group_name; |
| 209 bool expect_enable_quic; | 210 bool expect_enable_quic; |
| 210 } tests[] = { | 211 } tests[] = { |
| 211 { | 212 { |
| 212 std::string(), false, | 213 std::string(), false, |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 | 299 |
| 299 TEST_F(IOThreadTest, QuicIdleConnectionTimeoutSecondsFieldTrialParams) { | 300 TEST_F(IOThreadTest, QuicIdleConnectionTimeoutSecondsFieldTrialParams) { |
| 300 field_trial_group_ = "Enabled"; | 301 field_trial_group_ = "Enabled"; |
| 301 field_trial_params_["idle_connection_timeout_seconds"] = "300"; | 302 field_trial_params_["idle_connection_timeout_seconds"] = "300"; |
| 302 ConfigureQuicGlobals(); | 303 ConfigureQuicGlobals(); |
| 303 net::HttpNetworkSession::Params params; | 304 net::HttpNetworkSession::Params params; |
| 304 InitializeNetworkSessionParams(¶ms); | 305 InitializeNetworkSessionParams(¶ms); |
| 305 EXPECT_EQ(300, params.quic_idle_connection_timeout_seconds); | 306 EXPECT_EQ(300, params.quic_idle_connection_timeout_seconds); |
| 306 } | 307 } |
| 307 | 308 |
| 309 TEST_F(IOThreadTest, QuicDisablePreConnectIfZeroRtt) { |
| 310 field_trial_group_ = "Enabled"; |
| 311 field_trial_params_["disable_preconnect_if_0rtt"] = "true"; |
| 312 ConfigureQuicGlobals(); |
| 313 net::HttpNetworkSession::Params params; |
| 314 InitializeNetworkSessionParams(¶ms); |
| 315 EXPECT_TRUE(params.quic_disable_preconnect_if_0rtt); |
| 316 } |
| 317 |
| 308 TEST_F(IOThreadTest, PacketLengthFromFieldTrialParams) { | 318 TEST_F(IOThreadTest, PacketLengthFromFieldTrialParams) { |
| 309 field_trial_group_ = "Enabled"; | 319 field_trial_group_ = "Enabled"; |
| 310 field_trial_params_["max_packet_length"] = "1450"; | 320 field_trial_params_["max_packet_length"] = "1450"; |
| 311 | 321 |
| 312 ConfigureQuicGlobals(); | 322 ConfigureQuicGlobals(); |
| 313 net::HttpNetworkSession::Params params; | 323 net::HttpNetworkSession::Params params; |
| 314 InitializeNetworkSessionParams(¶ms); | 324 InitializeNetworkSessionParams(¶ms); |
| 315 EXPECT_EQ(1450u, params.quic_max_packet_length); | 325 EXPECT_EQ(1450u, params.quic_max_packet_length); |
| 316 } | 326 } |
| 317 | 327 |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 529 command_line_.AppendSwitch(switches::kEnableQuic); | 539 command_line_.AppendSwitch(switches::kEnableQuic); |
| 530 is_quic_allowed_by_policy_ = false; | 540 is_quic_allowed_by_policy_ = false; |
| 531 ConfigureQuicGlobals(); | 541 ConfigureQuicGlobals(); |
| 532 | 542 |
| 533 net::HttpNetworkSession::Params params; | 543 net::HttpNetworkSession::Params params; |
| 534 InitializeNetworkSessionParams(¶ms); | 544 InitializeNetworkSessionParams(¶ms); |
| 535 EXPECT_FALSE(params.enable_quic); | 545 EXPECT_FALSE(params.enable_quic); |
| 536 } | 546 } |
| 537 | 547 |
| 538 } // namespace test | 548 } // namespace test |
| OLD | NEW |