Commit 9de69c4c authored by jeremyim's avatar jeremyim Committed by Commit bot

Add field trial to only use the secure Data Reduction Proxy on a successful secure proxy check.

This permits determining the impact on HTTP vs HTTPS Data Reduction Proxy
use by changing the secure proxy check behavior (per the changelist
https://codereview.chromium.org/1132083004/).

BUG=466753

Review URL: https://codereview.chromium.org/1137583004

Cr-Commit-Position: refs/heads/master@{#330187}
parent b2af9e74
......@@ -148,6 +148,10 @@ bool DataReductionProxyParams::ShouldUseSecureProxyByDefault() {
kDataReductionProxyStartSecureDisabled))
return false;
if (FieldTrialList::FindFullName("DataReductionProxySecureProxyAfterCheck") ==
kEnabled)
return false;
return true;
}
......
......@@ -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 |
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment