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/metrics/field_trial.h" | 10 #include "base/metrics/field_trial.h" |
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
375 TEST_F(ConfigureParamsFromFieldTrialsAndCommandLineTest, | 375 TEST_F(ConfigureParamsFromFieldTrialsAndCommandLineTest, |
376 QuicOriginsToForceQuicOn) { | 376 QuicOriginsToForceQuicOn) { |
377 command_line_.AppendSwitch("enable-quic"); | 377 command_line_.AppendSwitch("enable-quic"); |
378 command_line_.AppendSwitchASCII("origin-to-force-quic-on", | 378 command_line_.AppendSwitchASCII("origin-to-force-quic-on", |
379 "www.example.com:443, www.example.org:443"); | 379 "www.example.com:443, www.example.org:443"); |
380 | 380 |
381 ConfigureParamsFromFieldTrialsAndCommandLine(); | 381 ConfigureParamsFromFieldTrialsAndCommandLine(); |
382 | 382 |
383 EXPECT_EQ(2u, params_.origins_to_force_quic_on.size()); | 383 EXPECT_EQ(2u, params_.origins_to_force_quic_on.size()); |
384 EXPECT_TRUE( | 384 EXPECT_TRUE( |
385 ContainsKey(params_.origins_to_force_quic_on, | 385 base::ContainsKey(params_.origins_to_force_quic_on, |
386 net::HostPortPair::FromString("www.example.com:443"))); | 386 net::HostPortPair::FromString("www.example.com:443"))); |
387 EXPECT_TRUE( | 387 EXPECT_TRUE( |
388 ContainsKey(params_.origins_to_force_quic_on, | 388 base::ContainsKey(params_.origins_to_force_quic_on, |
389 net::HostPortPair::FromString("www.example.org:443"))); | 389 net::HostPortPair::FromString("www.example.org:443"))); |
390 } | 390 } |
391 | 391 |
392 TEST_F(ConfigureParamsFromFieldTrialsAndCommandLineTest, | 392 TEST_F(ConfigureParamsFromFieldTrialsAndCommandLineTest, |
393 QuicOriginsToForceQuicOnAll) { | 393 QuicOriginsToForceQuicOnAll) { |
394 command_line_.AppendSwitch("enable-quic"); | 394 command_line_.AppendSwitch("enable-quic"); |
395 command_line_.AppendSwitchASCII("origin-to-force-quic-on", "*"); | 395 command_line_.AppendSwitchASCII("origin-to-force-quic-on", "*"); |
396 | 396 |
397 ConfigureParamsFromFieldTrialsAndCommandLine(); | 397 ConfigureParamsFromFieldTrialsAndCommandLine(); |
398 | 398 |
399 EXPECT_EQ(1u, params_.origins_to_force_quic_on.size()); | 399 EXPECT_EQ(1u, params_.origins_to_force_quic_on.size()); |
400 EXPECT_TRUE( | 400 EXPECT_TRUE( |
401 ContainsKey(params_.origins_to_force_quic_on, net::HostPortPair())); | 401 base::ContainsKey(params_.origins_to_force_quic_on, net::HostPortPair())); |
402 } | 402 } |
403 | 403 |
404 TEST_F(ConfigureParamsFromFieldTrialsAndCommandLineTest, | 404 TEST_F(ConfigureParamsFromFieldTrialsAndCommandLineTest, |
405 QuicWhitelistFromCommandLinet) { | 405 QuicWhitelistFromCommandLinet) { |
406 command_line_.AppendSwitch("enable-quic"); | 406 command_line_.AppendSwitch("enable-quic"); |
407 command_line_.AppendSwitchASCII("quic-host-whitelist", | 407 command_line_.AppendSwitchASCII("quic-host-whitelist", |
408 "www.example.org, www.example.com"); | 408 "www.example.org, www.example.com"); |
409 | 409 |
410 ConfigureParamsFromFieldTrialsAndCommandLine(); | 410 ConfigureParamsFromFieldTrialsAndCommandLine(); |
411 | 411 |
412 EXPECT_EQ(2u, params_.quic_host_whitelist.size()); | 412 EXPECT_EQ(2u, params_.quic_host_whitelist.size()); |
413 EXPECT_TRUE(ContainsKey(params_.quic_host_whitelist, "www.example.org")); | 413 EXPECT_TRUE( |
414 EXPECT_TRUE(ContainsKey(params_.quic_host_whitelist, "www.example.com")); | 414 base::ContainsKey(params_.quic_host_whitelist, "www.example.org")); |
| 415 EXPECT_TRUE( |
| 416 base::ContainsKey(params_.quic_host_whitelist, "www.example.com")); |
415 } | 417 } |
416 | 418 |
417 TEST_F(ConfigureParamsFromFieldTrialsAndCommandLineTest, | 419 TEST_F(ConfigureParamsFromFieldTrialsAndCommandLineTest, |
418 QuicDisallowedByPolicy) { | 420 QuicDisallowedByPolicy) { |
419 command_line_.AppendSwitch("enable-quic"); | 421 command_line_.AppendSwitch("enable-quic"); |
420 is_quic_allowed_by_policy_ = false; | 422 is_quic_allowed_by_policy_ = false; |
421 | 423 |
422 ConfigureParamsFromFieldTrialsAndCommandLine(); | 424 ConfigureParamsFromFieldTrialsAndCommandLine(); |
423 | 425 |
424 EXPECT_FALSE(params_.enable_quic); | 426 EXPECT_FALSE(params_.enable_quic); |
(...skipping 30 matching lines...) Expand all Loading... |
455 command_line_.AppendSwitchASCII("testing-fixed-http-port", "42"); | 457 command_line_.AppendSwitchASCII("testing-fixed-http-port", "42"); |
456 command_line_.AppendSwitchASCII("testing-fixed-https-port", "137"); | 458 command_line_.AppendSwitchASCII("testing-fixed-https-port", "137"); |
457 | 459 |
458 ConfigureParamsFromFieldTrialsAndCommandLine(); | 460 ConfigureParamsFromFieldTrialsAndCommandLine(); |
459 | 461 |
460 EXPECT_EQ(42u, params_.testing_fixed_http_port); | 462 EXPECT_EQ(42u, params_.testing_fixed_http_port); |
461 EXPECT_EQ(137u, params_.testing_fixed_https_port); | 463 EXPECT_EQ(137u, params_.testing_fixed_https_port); |
462 } | 464 } |
463 | 465 |
464 } // namespace test | 466 } // namespace test |
OLD | NEW |