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 "chrome/browser/io_thread.h" | 6 #include "chrome/browser/io_thread.h" |
7 #include "net/http/http_network_session.h" | 7 #include "net/http/http_network_session.h" |
8 #include "net/http/http_server_properties_impl.h" | 8 #include "net/http/http_server_properties_impl.h" |
9 #include "net/quic/quic_protocol.h" | 9 #include "net/quic/quic_protocol.h" |
10 #include "testing/gmock/include/gmock/gmock.h" | 10 #include "testing/gmock/include/gmock/gmock.h" |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 InitializeNetworkSessionParams(¶ms); | 126 InitializeNetworkSessionParams(¶ms); |
127 EXPECT_TRUE(params.enable_quic); | 127 EXPECT_TRUE(params.enable_quic); |
128 EXPECT_EQ(1350u, params.quic_max_packet_length); | 128 EXPECT_EQ(1350u, params.quic_max_packet_length); |
129 EXPECT_EQ(1.0, params.alternate_protocol_probability_threshold); | 129 EXPECT_EQ(1.0, params.alternate_protocol_probability_threshold); |
130 EXPECT_EQ(default_params.quic_supported_versions, | 130 EXPECT_EQ(default_params.quic_supported_versions, |
131 params.quic_supported_versions); | 131 params.quic_supported_versions); |
132 EXPECT_EQ(net::QuicTagVector(), params.quic_connection_options); | 132 EXPECT_EQ(net::QuicTagVector(), params.quic_connection_options); |
133 EXPECT_FALSE(params.quic_always_require_handshake_confirmation); | 133 EXPECT_FALSE(params.quic_always_require_handshake_confirmation); |
134 EXPECT_FALSE(params.quic_disable_connection_pooling); | 134 EXPECT_FALSE(params.quic_disable_connection_pooling); |
135 EXPECT_EQ(0, params.quic_load_server_info_timeout_ms); | 135 EXPECT_EQ(0, params.quic_load_server_info_timeout_ms); |
| 136 EXPECT_FALSE(params.quic_load_server_info_if_already_spoke_quic); |
136 } | 137 } |
137 | 138 |
138 TEST_F(IOThreadTest, EnableQuicFromCommandLine) { | 139 TEST_F(IOThreadTest, EnableQuicFromCommandLine) { |
139 command_line_.AppendSwitch("enable-quic"); | 140 command_line_.AppendSwitch("enable-quic"); |
140 | 141 |
141 ConfigureQuicGlobals(); | 142 ConfigureQuicGlobals(); |
142 net::HttpNetworkSession::Params params; | 143 net::HttpNetworkSession::Params params; |
143 InitializeNetworkSessionParams(¶ms); | 144 InitializeNetworkSessionParams(¶ms); |
144 EXPECT_TRUE(params.enable_quic); | 145 EXPECT_TRUE(params.enable_quic); |
145 } | 146 } |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 | 289 |
289 TEST_F(IOThreadTest, QuicLoadServerInfoTimeoutFromFieldTrialParams) { | 290 TEST_F(IOThreadTest, QuicLoadServerInfoTimeoutFromFieldTrialParams) { |
290 field_trial_group_ = "Enabled"; | 291 field_trial_group_ = "Enabled"; |
291 field_trial_params_["load_server_info_timeout"] = "50"; | 292 field_trial_params_["load_server_info_timeout"] = "50"; |
292 ConfigureQuicGlobals(); | 293 ConfigureQuicGlobals(); |
293 net::HttpNetworkSession::Params params; | 294 net::HttpNetworkSession::Params params; |
294 InitializeNetworkSessionParams(¶ms); | 295 InitializeNetworkSessionParams(¶ms); |
295 EXPECT_EQ(50, params.quic_load_server_info_timeout_ms); | 296 EXPECT_EQ(50, params.quic_load_server_info_timeout_ms); |
296 } | 297 } |
297 | 298 |
| 299 TEST_F(IOThreadTest, QuicLoadServerInfoIfAlreadySpokeQuic) { |
| 300 field_trial_group_ = "Enabled"; |
| 301 field_trial_params_["load_server_info_if_already_spoke_quic"] = "true"; |
| 302 ConfigureQuicGlobals(); |
| 303 net::HttpNetworkSession::Params params; |
| 304 InitializeNetworkSessionParams(¶ms); |
| 305 EXPECT_TRUE(params.quic_load_server_info_if_already_spoke_quic); |
| 306 } |
| 307 |
298 TEST_F(IOThreadTest, | 308 TEST_F(IOThreadTest, |
299 AlternateProtocolProbabilityThresholdFromFlag) { | 309 AlternateProtocolProbabilityThresholdFromFlag) { |
300 command_line_.AppendSwitchASCII("alternate-protocol-probability-threshold", | 310 command_line_.AppendSwitchASCII("alternate-protocol-probability-threshold", |
301 ".5"); | 311 ".5"); |
302 | 312 |
303 ConfigureQuicGlobals(); | 313 ConfigureQuicGlobals(); |
304 net::HttpNetworkSession::Params params; | 314 net::HttpNetworkSession::Params params; |
305 InitializeNetworkSessionParams(¶ms); | 315 InitializeNetworkSessionParams(¶ms); |
306 EXPECT_EQ(.5, params.alternate_protocol_probability_threshold); | 316 EXPECT_EQ(.5, params.alternate_protocol_probability_threshold); |
307 } | 317 } |
(...skipping 13 matching lines...) Expand all Loading... |
321 field_trial_group_ = "Enabled"; | 331 field_trial_group_ = "Enabled"; |
322 field_trial_params_["alternate_protocol_probability_threshold"] = ".5"; | 332 field_trial_params_["alternate_protocol_probability_threshold"] = ".5"; |
323 | 333 |
324 ConfigureQuicGlobals(); | 334 ConfigureQuicGlobals(); |
325 net::HttpNetworkSession::Params params; | 335 net::HttpNetworkSession::Params params; |
326 InitializeNetworkSessionParams(¶ms); | 336 InitializeNetworkSessionParams(¶ms); |
327 EXPECT_EQ(.5, params.alternate_protocol_probability_threshold); | 337 EXPECT_EQ(.5, params.alternate_protocol_probability_threshold); |
328 } | 338 } |
329 | 339 |
330 } // namespace test | 340 } // namespace test |
OLD | NEW |