| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 | 6 |
| 7 #include "base/at_exit.h" | 7 #include "base/at_exit.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 &IOThreadTestWithIOThreadObject::CheckAuthAndroidNegoitateAccountType, | 246 &IOThreadTestWithIOThreadObject::CheckAuthAndroidNegoitateAccountType, |
| 247 base::Unretained(this), "acc2")); | 247 base::Unretained(this), "acc2")); |
| 248 } | 248 } |
| 249 #endif | 249 #endif |
| 250 | 250 |
| 251 class ConfigureParamsFromFieldTrialsAndCommandLineTest | 251 class ConfigureParamsFromFieldTrialsAndCommandLineTest |
| 252 : public ::testing::Test { | 252 : public ::testing::Test { |
| 253 public: | 253 public: |
| 254 ConfigureParamsFromFieldTrialsAndCommandLineTest() | 254 ConfigureParamsFromFieldTrialsAndCommandLineTest() |
| 255 : command_line_(base::CommandLine::NO_PROGRAM), | 255 : command_line_(base::CommandLine::NO_PROGRAM), |
| 256 is_quic_allowed_by_policy_(true) {} | 256 is_quic_allowed_by_policy_(true) { |
| 257 params_.dynamic_shared_params = &dynamic_shared_params_; |
| 258 } |
| 257 | 259 |
| 258 protected: | 260 protected: |
| 259 void ConfigureParamsFromFieldTrialsAndCommandLine() { | 261 void ConfigureParamsFromFieldTrialsAndCommandLine() { |
| 260 IOThreadPeer::ConfigureParamsFromFieldTrialsAndCommandLine( | 262 IOThreadPeer::ConfigureParamsFromFieldTrialsAndCommandLine( |
| 261 command_line_, is_quic_allowed_by_policy_, ¶ms_); | 263 command_line_, is_quic_allowed_by_policy_, ¶ms_); |
| 262 } | 264 } |
| 263 | 265 |
| 264 base::CommandLine command_line_; | 266 base::CommandLine command_line_; |
| 265 bool is_quic_allowed_by_policy_; | 267 bool is_quic_allowed_by_policy_; |
| 266 net::HttpNetworkSession::Params params_; | 268 net::HttpNetworkSession::Params params_; |
| 269 net::HttpNetworkSession::DynamicSharedParams dynamic_shared_params_; |
| 267 }; | 270 }; |
| 268 | 271 |
| 269 TEST_F(ConfigureParamsFromFieldTrialsAndCommandLineTest, Default) { | 272 TEST_F(ConfigureParamsFromFieldTrialsAndCommandLineTest, Default) { |
| 270 ConfigureParamsFromFieldTrialsAndCommandLine(); | 273 ConfigureParamsFromFieldTrialsAndCommandLine(); |
| 271 | 274 |
| 272 EXPECT_TRUE(params_.enable_http2); | 275 EXPECT_TRUE(params_.enable_http2); |
| 273 EXPECT_FALSE(params_.enable_quic); | 276 EXPECT_FALSE(params_.enable_quic()); |
| 274 EXPECT_TRUE(params_.enable_quic_alternative_service_with_different_host); | 277 EXPECT_TRUE(params_.enable_quic_alternative_service_with_different_host); |
| 275 EXPECT_EQ(1350u, params_.quic_max_packet_length); | 278 EXPECT_EQ(1350u, params_.quic_max_packet_length); |
| 276 EXPECT_EQ(net::QuicTagVector(), params_.quic_connection_options); | 279 EXPECT_EQ(net::QuicTagVector(), params_.quic_connection_options); |
| 277 EXPECT_TRUE(params_.origins_to_force_quic_on.empty()); | 280 EXPECT_TRUE(params_.origins_to_force_quic_on.empty()); |
| 278 EXPECT_TRUE(params_.quic_host_whitelist.empty()); | 281 EXPECT_TRUE(params_.quic_host_whitelist.empty()); |
| 279 EXPECT_FALSE(params_.enable_user_alternate_protocol_ports); | 282 EXPECT_FALSE(params_.enable_user_alternate_protocol_ports); |
| 280 EXPECT_FALSE(params_.ignore_certificate_errors); | 283 EXPECT_FALSE(params_.ignore_certificate_errors); |
| 281 EXPECT_EQ(0, params_.testing_fixed_http_port); | 284 EXPECT_EQ(0, params_.testing_fixed_http_port); |
| 282 EXPECT_EQ(0, params_.testing_fixed_https_port); | 285 EXPECT_EQ(0, params_.testing_fixed_https_port); |
| 283 } | 286 } |
| (...skipping 21 matching lines...) Expand all Loading... |
| 305 field_trial_params["disable_delay_tcp_race"] = "true"; | 308 field_trial_params["disable_delay_tcp_race"] = "true"; |
| 306 variations::AssociateVariationParams("QUIC", "Enabled", field_trial_params); | 309 variations::AssociateVariationParams("QUIC", "Enabled", field_trial_params); |
| 307 base::FieldTrialList::CreateFieldTrial("QUIC", "Enabled"); | 310 base::FieldTrialList::CreateFieldTrial("QUIC", "Enabled"); |
| 308 | 311 |
| 309 command_line_.AppendSwitch("disable-quic"); | 312 command_line_.AppendSwitch("disable-quic"); |
| 310 command_line_.AppendSwitchASCII("quic-host-whitelist", | 313 command_line_.AppendSwitchASCII("quic-host-whitelist", |
| 311 "www.example.org, www.example.com"); | 314 "www.example.org, www.example.com"); |
| 312 | 315 |
| 313 ConfigureParamsFromFieldTrialsAndCommandLine(); | 316 ConfigureParamsFromFieldTrialsAndCommandLine(); |
| 314 | 317 |
| 315 EXPECT_FALSE(params_.enable_quic); | 318 EXPECT_FALSE(params_.enable_quic()); |
| 316 EXPECT_FALSE(params_.quic_always_require_handshake_confirmation); | 319 EXPECT_FALSE(params_.quic_always_require_handshake_confirmation); |
| 317 EXPECT_TRUE(params_.quic_delay_tcp_race); | 320 EXPECT_TRUE(params_.quic_delay_tcp_race); |
| 318 EXPECT_TRUE(params_.quic_host_whitelist.empty()); | 321 EXPECT_TRUE(params_.quic_host_whitelist.empty()); |
| 319 } | 322 } |
| 320 | 323 |
| 321 TEST_F(ConfigureParamsFromFieldTrialsAndCommandLineTest, | 324 TEST_F(ConfigureParamsFromFieldTrialsAndCommandLineTest, |
| 322 EnableQuicFromCommandLine) { | 325 EnableQuicFromCommandLine) { |
| 323 command_line_.AppendSwitch("enable-quic"); | 326 command_line_.AppendSwitch("enable-quic"); |
| 324 | 327 |
| 325 ConfigureParamsFromFieldTrialsAndCommandLine(); | 328 ConfigureParamsFromFieldTrialsAndCommandLine(); |
| 326 | 329 |
| 327 EXPECT_TRUE(params_.enable_quic); | 330 EXPECT_TRUE(params_.enable_quic()); |
| 328 } | 331 } |
| 329 | 332 |
| 330 TEST_F(ConfigureParamsFromFieldTrialsAndCommandLineTest, | 333 TEST_F(ConfigureParamsFromFieldTrialsAndCommandLineTest, |
| 331 EnableAlternativeServicesFromCommandLineWithQuicDisabled) { | 334 EnableAlternativeServicesFromCommandLineWithQuicDisabled) { |
| 332 command_line_.AppendSwitch("enable-alternative-services"); | 335 command_line_.AppendSwitch("enable-alternative-services"); |
| 333 | 336 |
| 334 ConfigureParamsFromFieldTrialsAndCommandLine(); | 337 ConfigureParamsFromFieldTrialsAndCommandLine(); |
| 335 | 338 |
| 336 EXPECT_FALSE(params_.enable_quic); | 339 EXPECT_FALSE(params_.enable_quic()); |
| 337 EXPECT_TRUE(params_.enable_quic_alternative_service_with_different_host); | 340 EXPECT_TRUE(params_.enable_quic_alternative_service_with_different_host); |
| 338 } | 341 } |
| 339 | 342 |
| 340 TEST_F(ConfigureParamsFromFieldTrialsAndCommandLineTest, | 343 TEST_F(ConfigureParamsFromFieldTrialsAndCommandLineTest, |
| 341 EnableAlternativeServicesFromCommandLineWithQuicEnabled) { | 344 EnableAlternativeServicesFromCommandLineWithQuicEnabled) { |
| 342 command_line_.AppendSwitch("enable-quic"); | 345 command_line_.AppendSwitch("enable-quic"); |
| 343 command_line_.AppendSwitch("enable-alternative-services"); | 346 command_line_.AppendSwitch("enable-alternative-services"); |
| 344 | 347 |
| 345 ConfigureParamsFromFieldTrialsAndCommandLine(); | 348 ConfigureParamsFromFieldTrialsAndCommandLine(); |
| 346 | 349 |
| 347 EXPECT_TRUE(params_.enable_quic); | 350 EXPECT_TRUE(params_.enable_quic()); |
| 348 EXPECT_TRUE(params_.enable_quic_alternative_service_with_different_host); | 351 EXPECT_TRUE(params_.enable_quic_alternative_service_with_different_host); |
| 349 } | 352 } |
| 350 | 353 |
| 351 TEST_F(ConfigureParamsFromFieldTrialsAndCommandLineTest, | 354 TEST_F(ConfigureParamsFromFieldTrialsAndCommandLineTest, |
| 352 QuicVersionFromCommandLine) { | 355 QuicVersionFromCommandLine) { |
| 353 command_line_.AppendSwitch("enable-quic"); | 356 command_line_.AppendSwitch("enable-quic"); |
| 354 std::string version = | 357 std::string version = |
| 355 net::QuicVersionToString(net::AllSupportedVersions().back()); | 358 net::QuicVersionToString(net::AllSupportedVersions().back()); |
| 356 command_line_.AppendSwitchASCII("quic-version", version); | 359 command_line_.AppendSwitchASCII("quic-version", version); |
| 357 | 360 |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 base::ContainsKey(params_.quic_host_whitelist, "www.example.com")); | 423 base::ContainsKey(params_.quic_host_whitelist, "www.example.com")); |
| 421 } | 424 } |
| 422 | 425 |
| 423 TEST_F(ConfigureParamsFromFieldTrialsAndCommandLineTest, | 426 TEST_F(ConfigureParamsFromFieldTrialsAndCommandLineTest, |
| 424 QuicDisallowedByPolicy) { | 427 QuicDisallowedByPolicy) { |
| 425 command_line_.AppendSwitch("enable-quic"); | 428 command_line_.AppendSwitch("enable-quic"); |
| 426 is_quic_allowed_by_policy_ = false; | 429 is_quic_allowed_by_policy_ = false; |
| 427 | 430 |
| 428 ConfigureParamsFromFieldTrialsAndCommandLine(); | 431 ConfigureParamsFromFieldTrialsAndCommandLine(); |
| 429 | 432 |
| 430 EXPECT_FALSE(params_.enable_quic); | 433 EXPECT_FALSE(params_.enable_quic()); |
| 431 } | 434 } |
| 432 | 435 |
| 433 TEST_F(ConfigureParamsFromFieldTrialsAndCommandLineTest, QuicMaxPacketLength) { | 436 TEST_F(ConfigureParamsFromFieldTrialsAndCommandLineTest, QuicMaxPacketLength) { |
| 434 command_line_.AppendSwitch("enable-quic"); | 437 command_line_.AppendSwitch("enable-quic"); |
| 435 command_line_.AppendSwitchASCII("quic-max-packet-length", "1450"); | 438 command_line_.AppendSwitchASCII("quic-max-packet-length", "1450"); |
| 436 | 439 |
| 437 ConfigureParamsFromFieldTrialsAndCommandLine(); | 440 ConfigureParamsFromFieldTrialsAndCommandLine(); |
| 438 | 441 |
| 439 EXPECT_EQ(1450u, params_.quic_max_packet_length); | 442 EXPECT_EQ(1450u, params_.quic_max_packet_length); |
| 440 } | 443 } |
| (...skipping 20 matching lines...) Expand all Loading... |
| 461 command_line_.AppendSwitchASCII("testing-fixed-http-port", "42"); | 464 command_line_.AppendSwitchASCII("testing-fixed-http-port", "42"); |
| 462 command_line_.AppendSwitchASCII("testing-fixed-https-port", "137"); | 465 command_line_.AppendSwitchASCII("testing-fixed-https-port", "137"); |
| 463 | 466 |
| 464 ConfigureParamsFromFieldTrialsAndCommandLine(); | 467 ConfigureParamsFromFieldTrialsAndCommandLine(); |
| 465 | 468 |
| 466 EXPECT_EQ(42u, params_.testing_fixed_http_port); | 469 EXPECT_EQ(42u, params_.testing_fixed_http_port); |
| 467 EXPECT_EQ(137u, params_.testing_fixed_https_port); | 470 EXPECT_EQ(137u, params_.testing_fixed_https_port); |
| 468 } | 471 } |
| 469 | 472 |
| 470 } // namespace test | 473 } // namespace test |
| OLD | NEW |