| 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/metrics/field_trial.h" | 11 #include "base/metrics/field_trial.h" |
| 11 #include "base/run_loop.h" | 12 #include "base/run_loop.h" |
| 12 #include "base/test/mock_entropy_provider.h" | 13 #include "base/test/mock_entropy_provider.h" |
| 13 #include "build/build_config.h" | 14 #include "build/build_config.h" |
| 14 #include "chrome/browser/io_thread.h" | 15 #include "chrome/browser/io_thread.h" |
| 15 #include "chrome/common/chrome_switches.h" | 16 #include "chrome/common/chrome_switches.h" |
| 16 #include "chrome/common/pref_names.h" | 17 #include "chrome/common/pref_names.h" |
| 17 #include "components/policy/core/common/mock_policy_service.h" | 18 #include "components/policy/core/common/mock_policy_service.h" |
| 18 #include "components/prefs/pref_registry_simple.h" | 19 #include "components/prefs/pref_registry_simple.h" |
| 19 #include "components/prefs/pref_service.h" | 20 #include "components/prefs/pref_service.h" |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 ConfigureParamsFromFieldTrialsAndCommandLine(); | 287 ConfigureParamsFromFieldTrialsAndCommandLine(); |
| 287 | 288 |
| 288 EXPECT_FALSE(params_.enable_http2); | 289 EXPECT_FALSE(params_.enable_http2); |
| 289 } | 290 } |
| 290 | 291 |
| 291 // Command line flag should not only disable QUIC but should also prevent QUIC | 292 // Command line flag should not only disable QUIC but should also prevent QUIC |
| 292 // related field trials and command line flags from being parsed. | 293 // related field trials and command line flags from being parsed. |
| 293 TEST_F(ConfigureParamsFromFieldTrialsAndCommandLineTest, | 294 TEST_F(ConfigureParamsFromFieldTrialsAndCommandLineTest, |
| 294 DisableQuicFromCommandLineOverridesFieldTrial) { | 295 DisableQuicFromCommandLineOverridesFieldTrial) { |
| 295 auto field_trial_list = | 296 auto field_trial_list = |
| 296 base::MakeUnique<base::FieldTrialList>(new base::MockEntropyProvider()); | 297 base::MakeUnique<base::FieldTrialList>( |
| 298 base::MakeUnique<base::MockEntropyProvider>()); |
| 297 variations::testing::ClearAllVariationParams(); | 299 variations::testing::ClearAllVariationParams(); |
| 298 | 300 |
| 299 std::map<std::string, std::string> field_trial_params; | 301 std::map<std::string, std::string> field_trial_params; |
| 300 field_trial_params["always_require_handshake_confirmation"] = "true"; | 302 field_trial_params["always_require_handshake_confirmation"] = "true"; |
| 301 field_trial_params["disable_delay_tcp_race"] = "true"; | 303 field_trial_params["disable_delay_tcp_race"] = "true"; |
| 302 variations::AssociateVariationParams("QUIC", "Enabled", field_trial_params); | 304 variations::AssociateVariationParams("QUIC", "Enabled", field_trial_params); |
| 303 base::FieldTrialList::CreateFieldTrial("QUIC", "Enabled"); | 305 base::FieldTrialList::CreateFieldTrial("QUIC", "Enabled"); |
| 304 | 306 |
| 305 command_line_.AppendSwitch("disable-quic"); | 307 command_line_.AppendSwitch("disable-quic"); |
| 306 command_line_.AppendSwitchASCII("quic-host-whitelist", | 308 command_line_.AppendSwitchASCII("quic-host-whitelist", |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 457 command_line_.AppendSwitchASCII("testing-fixed-http-port", "42"); | 459 command_line_.AppendSwitchASCII("testing-fixed-http-port", "42"); |
| 458 command_line_.AppendSwitchASCII("testing-fixed-https-port", "137"); | 460 command_line_.AppendSwitchASCII("testing-fixed-https-port", "137"); |
| 459 | 461 |
| 460 ConfigureParamsFromFieldTrialsAndCommandLine(); | 462 ConfigureParamsFromFieldTrialsAndCommandLine(); |
| 461 | 463 |
| 462 EXPECT_EQ(42u, params_.testing_fixed_http_port); | 464 EXPECT_EQ(42u, params_.testing_fixed_http_port); |
| 463 EXPECT_EQ(137u, params_.testing_fixed_https_port); | 465 EXPECT_EQ(137u, params_.testing_fixed_https_port); |
| 464 } | 466 } |
| 465 | 467 |
| 466 } // namespace test | 468 } // namespace test |
| OLD | NEW |