| 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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 command_line_.AppendSwitch("enable-quic-pacing"); | 149 command_line_.AppendSwitch("enable-quic-pacing"); |
| 150 | 150 |
| 151 ConfigureQuicGlobals(); | 151 ConfigureQuicGlobals(); |
| 152 net::HttpNetworkSession::Params params; | 152 net::HttpNetworkSession::Params params; |
| 153 InitializeNetworkSessionParams(¶ms); | 153 InitializeNetworkSessionParams(¶ms); |
| 154 net::QuicTagVector options; | 154 net::QuicTagVector options; |
| 155 options.push_back(net::kPACE); | 155 options.push_back(net::kPACE); |
| 156 EXPECT_EQ(options, params.quic_connection_options); | 156 EXPECT_EQ(options, params.quic_connection_options); |
| 157 } | 157 } |
| 158 | 158 |
| 159 TEST_F(IOThreadTest, EnablePacingFromFieldTrialGroup) { | |
| 160 field_trial_group_ = "EnabledWithPacing"; | |
| 161 | |
| 162 ConfigureQuicGlobals(); | |
| 163 net::HttpNetworkSession::Params params; | |
| 164 InitializeNetworkSessionParams(¶ms); | |
| 165 net::QuicTagVector options; | |
| 166 options.push_back(net::kPACE); | |
| 167 EXPECT_EQ(options, params.quic_connection_options); | |
| 168 } | |
| 169 | |
| 170 TEST_F(IOThreadTest, EnablePacingFromFieldTrialParams) { | 159 TEST_F(IOThreadTest, EnablePacingFromFieldTrialParams) { |
| 171 field_trial_group_ = "Enabled"; | 160 field_trial_group_ = "Enabled"; |
| 172 field_trial_params_["enable_pacing"] = "true"; | 161 field_trial_params_["enable_pacing"] = "true"; |
| 173 | 162 |
| 174 ConfigureQuicGlobals(); | 163 ConfigureQuicGlobals(); |
| 175 net::HttpNetworkSession::Params params; | 164 net::HttpNetworkSession::Params params; |
| 176 InitializeNetworkSessionParams(¶ms); | 165 InitializeNetworkSessionParams(¶ms); |
| 177 net::QuicTagVector options; | 166 net::QuicTagVector options; |
| 178 options.push_back(net::kPACE); | 167 options.push_back(net::kPACE); |
| 179 EXPECT_EQ(options, params.quic_connection_options); | 168 EXPECT_EQ(options, params.quic_connection_options); |
| 180 } | 169 } |
| 181 | 170 |
| 182 TEST_F(IOThreadTest, PacketLengthFromCommandLine) { | 171 TEST_F(IOThreadTest, PacketLengthFromCommandLine) { |
| 183 command_line_.AppendSwitch("enable-quic"); | 172 command_line_.AppendSwitch("enable-quic"); |
| 184 command_line_.AppendSwitchASCII("quic-max-packet-length", "1350"); | 173 command_line_.AppendSwitchASCII("quic-max-packet-length", "1450"); |
| 185 | 174 |
| 186 ConfigureQuicGlobals(); | 175 ConfigureQuicGlobals(); |
| 187 net::HttpNetworkSession::Params params; | 176 net::HttpNetworkSession::Params params; |
| 188 InitializeNetworkSessionParams(¶ms); | 177 InitializeNetworkSessionParams(¶ms); |
| 189 EXPECT_EQ(1350u, params.quic_max_packet_length); | 178 EXPECT_EQ(1450u, params.quic_max_packet_length); |
| 190 } | 179 } |
| 191 | 180 |
| 192 TEST_F(IOThreadTest, PacketLengthFromFieldTrialGroup) { | 181 TEST_F(IOThreadTest, PacketLengthFromFieldTrialParams) { |
| 193 field_trial_group_ = "Enabled1350BytePackets"; | 182 field_trial_group_ = "Enabled"; |
| 183 field_trial_params_["max_packet_length"] = "1450"; |
| 194 | 184 |
| 195 ConfigureQuicGlobals(); | 185 ConfigureQuicGlobals(); |
| 196 net::HttpNetworkSession::Params params; | 186 net::HttpNetworkSession::Params params; |
| 197 InitializeNetworkSessionParams(¶ms); | 187 InitializeNetworkSessionParams(¶ms); |
| 198 EXPECT_EQ(1350u, params.quic_max_packet_length); | 188 EXPECT_EQ(1450u, params.quic_max_packet_length); |
| 199 } | |
| 200 | |
| 201 TEST_F(IOThreadTest, PacketLengthFromFieldTrialParams) { | |
| 202 field_trial_group_ = "Enabled"; | |
| 203 field_trial_params_["max_packet_length"] = "1350"; | |
| 204 | |
| 205 ConfigureQuicGlobals(); | |
| 206 net::HttpNetworkSession::Params params; | |
| 207 InitializeNetworkSessionParams(¶ms); | |
| 208 EXPECT_EQ(1350u, params.quic_max_packet_length); | |
| 209 } | 189 } |
| 210 | 190 |
| 211 TEST_F(IOThreadTest, QuicVersionFromCommandLine) { | 191 TEST_F(IOThreadTest, QuicVersionFromCommandLine) { |
| 212 command_line_.AppendSwitch("enable-quic"); | 192 command_line_.AppendSwitch("enable-quic"); |
| 213 std::string version = | 193 std::string version = |
| 214 net::QuicVersionToString(net::QuicSupportedVersions().back()); | 194 net::QuicVersionToString(net::QuicSupportedVersions().back()); |
| 215 command_line_.AppendSwitchASCII("quic-version", version); | 195 command_line_.AppendSwitchASCII("quic-version", version); |
| 216 | 196 |
| 217 ConfigureQuicGlobals(); | 197 ConfigureQuicGlobals(); |
| 218 net::HttpNetworkSession::Params params; | 198 net::HttpNetworkSession::Params params; |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 field_trial_group_ = "Enabled"; | 321 field_trial_group_ = "Enabled"; |
| 342 field_trial_params_["alternate_protocol_probability_threshold"] = ".5"; | 322 field_trial_params_["alternate_protocol_probability_threshold"] = ".5"; |
| 343 | 323 |
| 344 ConfigureQuicGlobals(); | 324 ConfigureQuicGlobals(); |
| 345 net::HttpNetworkSession::Params params; | 325 net::HttpNetworkSession::Params params; |
| 346 InitializeNetworkSessionParams(¶ms); | 326 InitializeNetworkSessionParams(¶ms); |
| 347 EXPECT_EQ(.5, params.alternate_protocol_probability_threshold); | 327 EXPECT_EQ(.5, params.alternate_protocol_probability_threshold); |
| 348 } | 328 } |
| 349 | 329 |
| 350 } // namespace test | 330 } // namespace test |
| OLD | NEW |