| 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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 } | 120 } |
| 121 | 121 |
| 122 TEST_F(IOThreadTest, EnableQuicFromFieldTrialGroup) { | 122 TEST_F(IOThreadTest, EnableQuicFromFieldTrialGroup) { |
| 123 field_trial_group_ = "Enabled"; | 123 field_trial_group_ = "Enabled"; |
| 124 | 124 |
| 125 ConfigureQuicGlobals(); | 125 ConfigureQuicGlobals(); |
| 126 net::HttpNetworkSession::Params default_params; | 126 net::HttpNetworkSession::Params default_params; |
| 127 net::HttpNetworkSession::Params params; | 127 net::HttpNetworkSession::Params params; |
| 128 InitializeNetworkSessionParams(¶ms); | 128 InitializeNetworkSessionParams(¶ms); |
| 129 EXPECT_TRUE(params.enable_quic); | 129 EXPECT_TRUE(params.enable_quic); |
| 130 EXPECT_FALSE(params.enable_quic_time_based_loss_detection); | |
| 131 EXPECT_EQ(1350u, params.quic_max_packet_length); | 130 EXPECT_EQ(1350u, params.quic_max_packet_length); |
| 132 EXPECT_EQ(1.0, params.alternate_protocol_probability_threshold); | 131 EXPECT_EQ(1.0, params.alternate_protocol_probability_threshold); |
| 133 EXPECT_EQ(default_params.quic_supported_versions, | 132 EXPECT_EQ(default_params.quic_supported_versions, |
| 134 params.quic_supported_versions); | 133 params.quic_supported_versions); |
| 135 EXPECT_EQ(net::QuicTagVector(), params.quic_connection_options); | 134 EXPECT_EQ(net::QuicTagVector(), params.quic_connection_options); |
| 136 EXPECT_FALSE(params.quic_always_require_handshake_confirmation); | 135 EXPECT_FALSE(params.quic_always_require_handshake_confirmation); |
| 137 EXPECT_FALSE(params.quic_disable_connection_pooling); | 136 EXPECT_FALSE(params.quic_disable_connection_pooling); |
| 138 } | 137 } |
| 139 | 138 |
| 140 TEST_F(IOThreadTest, EnableQuicFromCommandLine) { | 139 TEST_F(IOThreadTest, EnableQuicFromCommandLine) { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 field_trial_params_["enable_pacing"] = "true"; | 173 field_trial_params_["enable_pacing"] = "true"; |
| 175 | 174 |
| 176 ConfigureQuicGlobals(); | 175 ConfigureQuicGlobals(); |
| 177 net::HttpNetworkSession::Params params; | 176 net::HttpNetworkSession::Params params; |
| 178 InitializeNetworkSessionParams(¶ms); | 177 InitializeNetworkSessionParams(¶ms); |
| 179 net::QuicTagVector options; | 178 net::QuicTagVector options; |
| 180 options.push_back(net::kPACE); | 179 options.push_back(net::kPACE); |
| 181 EXPECT_EQ(options, params.quic_connection_options); | 180 EXPECT_EQ(options, params.quic_connection_options); |
| 182 } | 181 } |
| 183 | 182 |
| 184 TEST_F(IOThreadTest, EnableTimeBasedLossDetectionFromCommandLine) { | |
| 185 command_line_.AppendSwitch("enable-quic"); | |
| 186 command_line_.AppendSwitch("enable-quic-time-based-loss-detection"); | |
| 187 | |
| 188 ConfigureQuicGlobals(); | |
| 189 net::HttpNetworkSession::Params params; | |
| 190 InitializeNetworkSessionParams(¶ms); | |
| 191 EXPECT_TRUE(params.enable_quic_time_based_loss_detection); | |
| 192 } | |
| 193 | |
| 194 TEST_F(IOThreadTest, EnableTimeBasedLossDetectionFromFieldTrialGroup) { | |
| 195 field_trial_group_ = "EnabledWithTimeBasedLossDetection"; | |
| 196 | |
| 197 ConfigureQuicGlobals(); | |
| 198 net::HttpNetworkSession::Params params; | |
| 199 InitializeNetworkSessionParams(¶ms); | |
| 200 EXPECT_TRUE(params.enable_quic_time_based_loss_detection); | |
| 201 } | |
| 202 | |
| 203 TEST_F(IOThreadTest, EnableTimeBasedLossDetectionFromFieldTrialParams) { | |
| 204 field_trial_group_ = "Enabled"; | |
| 205 field_trial_params_["enable_time_based_loss_detection"] = "true"; | |
| 206 | |
| 207 ConfigureQuicGlobals(); | |
| 208 net::HttpNetworkSession::Params params; | |
| 209 InitializeNetworkSessionParams(¶ms); | |
| 210 EXPECT_TRUE(params.enable_quic_time_based_loss_detection); | |
| 211 } | |
| 212 | |
| 213 TEST_F(IOThreadTest, PacketLengthFromCommandLine) { | 183 TEST_F(IOThreadTest, PacketLengthFromCommandLine) { |
| 214 command_line_.AppendSwitch("enable-quic"); | 184 command_line_.AppendSwitch("enable-quic"); |
| 215 command_line_.AppendSwitchASCII("quic-max-packet-length", "1350"); | 185 command_line_.AppendSwitchASCII("quic-max-packet-length", "1350"); |
| 216 | 186 |
| 217 ConfigureQuicGlobals(); | 187 ConfigureQuicGlobals(); |
| 218 net::HttpNetworkSession::Params params; | 188 net::HttpNetworkSession::Params params; |
| 219 InitializeNetworkSessionParams(¶ms); | 189 InitializeNetworkSessionParams(¶ms); |
| 220 EXPECT_EQ(1350u, params.quic_max_packet_length); | 190 EXPECT_EQ(1350u, params.quic_max_packet_length); |
| 221 } | 191 } |
| 222 | 192 |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 field_trial_group_ = "Enabled"; | 333 field_trial_group_ = "Enabled"; |
| 364 field_trial_params_["alternate_protocol_probability_threshold"] = ".5"; | 334 field_trial_params_["alternate_protocol_probability_threshold"] = ".5"; |
| 365 | 335 |
| 366 ConfigureQuicGlobals(); | 336 ConfigureQuicGlobals(); |
| 367 net::HttpNetworkSession::Params params; | 337 net::HttpNetworkSession::Params params; |
| 368 InitializeNetworkSessionParams(¶ms); | 338 InitializeNetworkSessionParams(¶ms); |
| 369 EXPECT_EQ(.5, params.alternate_protocol_probability_threshold); | 339 EXPECT_EQ(.5, params.alternate_protocol_probability_threshold); |
| 370 } | 340 } |
| 371 | 341 |
| 372 } // namespace test | 342 } // namespace test |
| OLD | NEW |