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 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 EXPECT_EQ(0.25f, params.quic_load_server_info_timeout_srtt_multiplier); | 190 EXPECT_EQ(0.25f, params.quic_load_server_info_timeout_srtt_multiplier); |
191 EXPECT_FALSE(params.quic_enable_connection_racing); | 191 EXPECT_FALSE(params.quic_enable_connection_racing); |
192 EXPECT_FALSE(params.quic_enable_non_blocking_io); | 192 EXPECT_FALSE(params.quic_enable_non_blocking_io); |
193 EXPECT_FALSE(params.quic_disable_disk_cache); | 193 EXPECT_FALSE(params.quic_disable_disk_cache); |
194 EXPECT_FALSE(params.quic_prefer_aes); | 194 EXPECT_FALSE(params.quic_prefer_aes); |
195 EXPECT_FALSE(params.use_alternative_services); | 195 EXPECT_FALSE(params.use_alternative_services); |
196 EXPECT_EQ(0, params.quic_max_number_of_lossy_connections); | 196 EXPECT_EQ(0, params.quic_max_number_of_lossy_connections); |
197 EXPECT_EQ(1.0f, params.quic_packet_loss_threshold); | 197 EXPECT_EQ(1.0f, params.quic_packet_loss_threshold); |
198 EXPECT_FALSE(params.quic_delay_tcp_race); | 198 EXPECT_FALSE(params.quic_delay_tcp_race); |
199 EXPECT_FALSE(params.quic_close_sessions_on_ip_change); | 199 EXPECT_FALSE(params.quic_close_sessions_on_ip_change); |
| 200 EXPECT_FALSE(params.quic_migrate_sessions_on_net_change); |
200 EXPECT_FALSE(IOThread::ShouldEnableQuicForDataReductionProxy()); | 201 EXPECT_FALSE(IOThread::ShouldEnableQuicForDataReductionProxy()); |
201 } | 202 } |
202 | 203 |
203 TEST_F(IOThreadTest, EnableQuicFromQuicProxyFieldTrialGroup) { | 204 TEST_F(IOThreadTest, EnableQuicFromQuicProxyFieldTrialGroup) { |
204 const struct { | 205 const struct { |
205 std::string field_trial_group_name; | 206 std::string field_trial_group_name; |
206 bool expect_enable_quic; | 207 bool expect_enable_quic; |
207 } tests[] = { | 208 } tests[] = { |
208 { | 209 { |
209 std::string(), false, | 210 std::string(), false, |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 | 287 |
287 TEST_F(IOThreadTest, QuicCloseSessionsOnIpChangeFromFieldTrialParams) { | 288 TEST_F(IOThreadTest, QuicCloseSessionsOnIpChangeFromFieldTrialParams) { |
288 field_trial_group_ = "Enabled"; | 289 field_trial_group_ = "Enabled"; |
289 field_trial_params_["close_sessions_on_ip_change"] = "true"; | 290 field_trial_params_["close_sessions_on_ip_change"] = "true"; |
290 ConfigureQuicGlobals(); | 291 ConfigureQuicGlobals(); |
291 net::HttpNetworkSession::Params params; | 292 net::HttpNetworkSession::Params params; |
292 InitializeNetworkSessionParams(¶ms); | 293 InitializeNetworkSessionParams(¶ms); |
293 EXPECT_TRUE(params.quic_close_sessions_on_ip_change); | 294 EXPECT_TRUE(params.quic_close_sessions_on_ip_change); |
294 } | 295 } |
295 | 296 |
| 297 TEST_F(IOThreadTest, QuicCloseSessionsOnIpChangeFromFieldTrialParams) { |
| 298 field_trial_group_ = "Enabled"; |
| 299 field_trial_params_["close_sessions_on_ip_change"] = "true"; |
| 300 ConfigureQuicGlobals(); |
| 301 net::HttpNetworkSession::Params params; |
| 302 InitializeNetworkSessionParams(¶ms); |
| 303 EXPECT_TRUE(params.quic_close_sessions_on_ip_change); |
| 304 } |
| 305 |
| 306 TEST_F(IOThreadTest, QuicMigrateSessionsOnNetworkChangeFromFieldTrialParams) { |
| 307 field_trial_group_ = "Enabled"; |
| 308 field_trial_params_["migrate_sessions_on_network_change"] = "true"; |
| 309 ConfigureQuicGlobals(); |
| 310 net::HttpNetworkSession::Params params; |
| 311 InitializeNetworkSessionParams(¶ms); |
| 312 EXPECT_TRUE(params.quic_migrate_sessions_on_network_change); |
| 313 } |
| 314 |
296 TEST_F(IOThreadTest, PacketLengthFromFieldTrialParams) { | 315 TEST_F(IOThreadTest, PacketLengthFromFieldTrialParams) { |
297 field_trial_group_ = "Enabled"; | 316 field_trial_group_ = "Enabled"; |
298 field_trial_params_["max_packet_length"] = "1450"; | 317 field_trial_params_["max_packet_length"] = "1450"; |
299 | 318 |
300 ConfigureQuicGlobals(); | 319 ConfigureQuicGlobals(); |
301 net::HttpNetworkSession::Params params; | 320 net::HttpNetworkSession::Params params; |
302 InitializeNetworkSessionParams(¶ms); | 321 InitializeNetworkSessionParams(¶ms); |
303 EXPECT_EQ(1450u, params.quic_max_packet_length); | 322 EXPECT_EQ(1450u, params.quic_max_packet_length); |
304 } | 323 } |
305 | 324 |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
517 command_line_.AppendSwitch(switches::kEnableQuic); | 536 command_line_.AppendSwitch(switches::kEnableQuic); |
518 is_quic_allowed_by_policy_ = false; | 537 is_quic_allowed_by_policy_ = false; |
519 ConfigureQuicGlobals(); | 538 ConfigureQuicGlobals(); |
520 | 539 |
521 net::HttpNetworkSession::Params params; | 540 net::HttpNetworkSession::Params params; |
522 InitializeNetworkSessionParams(¶ms); | 541 InitializeNetworkSessionParams(¶ms); |
523 EXPECT_FALSE(params.enable_quic); | 542 EXPECT_FALSE(params.enable_quic); |
524 } | 543 } |
525 | 544 |
526 } // namespace test | 545 } // namespace test |
OLD | NEW |