| 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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 EXPECT_EQ(0.25f, params.quic_load_server_info_timeout_srtt_multiplier); | 166 EXPECT_EQ(0.25f, params.quic_load_server_info_timeout_srtt_multiplier); |
| 167 EXPECT_FALSE(params.quic_enable_connection_racing); | 167 EXPECT_FALSE(params.quic_enable_connection_racing); |
| 168 EXPECT_FALSE(params.quic_enable_non_blocking_io); | 168 EXPECT_FALSE(params.quic_enable_non_blocking_io); |
| 169 EXPECT_FALSE(params.quic_disable_disk_cache); | 169 EXPECT_FALSE(params.quic_disable_disk_cache); |
| 170 EXPECT_FALSE(params.quic_prefer_aes); | 170 EXPECT_FALSE(params.quic_prefer_aes); |
| 171 EXPECT_FALSE(params.use_alternative_services); | 171 EXPECT_FALSE(params.use_alternative_services); |
| 172 EXPECT_EQ(4, params.quic_max_number_of_lossy_connections); | 172 EXPECT_EQ(4, params.quic_max_number_of_lossy_connections); |
| 173 EXPECT_EQ(0.5f, params.quic_packet_loss_threshold); | 173 EXPECT_EQ(0.5f, params.quic_packet_loss_threshold); |
| 174 EXPECT_FALSE(params.quic_delay_tcp_race); | 174 EXPECT_FALSE(params.quic_delay_tcp_race); |
| 175 EXPECT_FALSE(params.quic_close_sessions_on_ip_change); | 175 EXPECT_FALSE(params.quic_close_sessions_on_ip_change); |
| 176 EXPECT_FALSE(params.quic_migrate_sessions_on_net_change); |
| 176 EXPECT_FALSE(IOThread::ShouldEnableQuicForDataReductionProxy()); | 177 EXPECT_FALSE(IOThread::ShouldEnableQuicForDataReductionProxy()); |
| 177 } | 178 } |
| 178 | 179 |
| 179 TEST_F(IOThreadTest, EnableQuicFromQuicProxyFieldTrialGroup) { | 180 TEST_F(IOThreadTest, EnableQuicFromQuicProxyFieldTrialGroup) { |
| 180 const struct { | 181 const struct { |
| 181 std::string field_trial_group_name; | 182 std::string field_trial_group_name; |
| 182 bool expect_enable_quic; | 183 bool expect_enable_quic; |
| 183 } tests[] = { | 184 } tests[] = { |
| 184 { | 185 { |
| 185 std::string(), false, | 186 std::string(), false, |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 TEST_F(IOThreadTest, | 284 TEST_F(IOThreadTest, |
| 284 QuicCloseSessionsOnIpChangeFromFieldTrialParams) { | 285 QuicCloseSessionsOnIpChangeFromFieldTrialParams) { |
| 285 field_trial_group_ = "Enabled"; | 286 field_trial_group_ = "Enabled"; |
| 286 field_trial_params_["close_sessions_on_ip_change"] = "true"; | 287 field_trial_params_["close_sessions_on_ip_change"] = "true"; |
| 287 ConfigureQuicGlobals(); | 288 ConfigureQuicGlobals(); |
| 288 net::HttpNetworkSession::Params params; | 289 net::HttpNetworkSession::Params params; |
| 289 InitializeNetworkSessionParams(¶ms); | 290 InitializeNetworkSessionParams(¶ms); |
| 290 EXPECT_TRUE(params.quic_close_sessions_on_ip_change); | 291 EXPECT_TRUE(params.quic_close_sessions_on_ip_change); |
| 291 } | 292 } |
| 292 | 293 |
| 294 TEST_F(IOThreadTest, |
| 295 QuicMigrateSessionsOnNetChangeFromFieldTrialParams) { |
| 296 field_trial_group_ = "Enabled"; |
| 297 field_trial_params_["migrate_sessions_on_net_change"] = "true"; |
| 298 ConfigureQuicGlobals(); |
| 299 net::HttpNetworkSession::Params params; |
| 300 InitializeNetworkSessionParams(¶ms); |
| 301 EXPECT_TRUE(params.quic_migrate_sessions_on_net_change); |
| 302 } |
| 303 |
| 293 TEST_F(IOThreadTest, PacketLengthFromFieldTrialParams) { | 304 TEST_F(IOThreadTest, PacketLengthFromFieldTrialParams) { |
| 294 field_trial_group_ = "Enabled"; | 305 field_trial_group_ = "Enabled"; |
| 295 field_trial_params_["max_packet_length"] = "1450"; | 306 field_trial_params_["max_packet_length"] = "1450"; |
| 296 | 307 |
| 297 ConfigureQuicGlobals(); | 308 ConfigureQuicGlobals(); |
| 298 net::HttpNetworkSession::Params params; | 309 net::HttpNetworkSession::Params params; |
| 299 InitializeNetworkSessionParams(¶ms); | 310 InitializeNetworkSessionParams(¶ms); |
| 300 EXPECT_EQ(1450u, params.quic_max_packet_length); | 311 EXPECT_EQ(1450u, params.quic_max_packet_length); |
| 301 } | 312 } |
| 302 | 313 |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 514 command_line_.AppendSwitch(switches::kEnableQuic); | 525 command_line_.AppendSwitch(switches::kEnableQuic); |
| 515 is_quic_allowed_by_policy_ = false; | 526 is_quic_allowed_by_policy_ = false; |
| 516 ConfigureQuicGlobals(); | 527 ConfigureQuicGlobals(); |
| 517 | 528 |
| 518 net::HttpNetworkSession::Params params; | 529 net::HttpNetworkSession::Params params; |
| 519 InitializeNetworkSessionParams(¶ms); | 530 InitializeNetworkSessionParams(¶ms); |
| 520 EXPECT_FALSE(params.enable_quic); | 531 EXPECT_FALSE(params.enable_quic); |
| 521 } | 532 } |
| 522 | 533 |
| 523 } // namespace test | 534 } // namespace test |
| OLD | NEW |