| Index: components/data_reduction_proxy/core/common/data_reduction_proxy_params_unittest.cc
|
| diff --git a/components/data_reduction_proxy/core/common/data_reduction_proxy_params_unittest.cc b/components/data_reduction_proxy/core/common/data_reduction_proxy_params_unittest.cc
|
| index aa5074125c123d1d839026bb3012dfde7aa97413..77c9e4eece2e910dd975779017b7c84ea3d2fb21 100644
|
| --- a/components/data_reduction_proxy/core/common/data_reduction_proxy_params_unittest.cc
|
| +++ b/components/data_reduction_proxy/core/common/data_reduction_proxy_params_unittest.cc
|
| @@ -7,6 +7,7 @@
|
| #include <map>
|
|
|
| #include "base/command_line.h"
|
| +#include "base/metrics/field_trial.h"
|
| #include "base/values.h"
|
| #include "components/data_reduction_proxy/core/common/data_reduction_proxy_params_test_utils.h"
|
| #include "components/data_reduction_proxy/core/common/data_reduction_proxy_switches.h"
|
| @@ -767,6 +768,57 @@ TEST_F(DataReductionProxyParamsTest, AndroidOnePromoFieldTrial) {
|
| "google/hammerhead/hammerhead:5.0/LRX210/1570415:user/release-keys"));
|
| }
|
|
|
| +TEST_F(DataReductionProxyParamsTest, SecureProxyCheckDefault) {
|
| + struct {
|
| + bool command_line_set;
|
| + bool experiment_enabled;
|
| + bool in_trial_group;
|
| + bool expected_use_by_default;
|
| + } test_cases[]{
|
| + {
|
| + false, false, false, true,
|
| + },
|
| + {
|
| + true, false, false, false,
|
| + },
|
| + {
|
| + true, true, false, false,
|
| + },
|
| + {
|
| + true, true, true, false,
|
| + },
|
| + {
|
| + false, true, true, false,
|
| + },
|
| + {
|
| + false, true, false, true,
|
| + },
|
| + };
|
| +
|
| + int test_index = 0;
|
| + for (const auto& test_case : test_cases) {
|
| + // Reset all flags.
|
| + base::CommandLine::ForCurrentProcess()->InitFromArgv(0, NULL);
|
| +
|
| + base::FieldTrialList trial_list(nullptr);
|
| + if (test_case.command_line_set) {
|
| + base::CommandLine::ForCurrentProcess()->AppendSwitchASCII(
|
| + switches::kDataReductionProxyStartSecureDisabled, "");
|
| + }
|
| +
|
| + if (test_case.experiment_enabled) {
|
| + base::FieldTrialList::CreateFieldTrial(
|
| + "DataReductionProxySecureProxyAfterCheck",
|
| + test_case.in_trial_group ? "Enabled" : "Disabled");
|
| + }
|
| +
|
| + EXPECT_EQ(test_case.expected_use_by_default,
|
| + DataReductionProxyParams::ShouldUseSecureProxyByDefault())
|
| + << test_index;
|
| + test_index++;
|
| + }
|
| +}
|
| +
|
| TEST_F(DataReductionProxyParamsTest, PopulateConfigResponse) {
|
| DataReductionProxyParams params(
|
| DataReductionProxyParams::kAllowed |
|
|
|