Use QUIC for DataReductionProxy if user belongs to field
trial group that starts with "Enabled". Currently, QUIC is used if the field trial group is exactly "Enabled". This change allows us to have multiple Enabled groups (e.g., "Enabled", "Enabled2" etc.). BUG=533703 Review URL: https://codereview.chromium.org/1354283002 Cr-Commit-Position: refs/heads/master@{#350061}
This commit is contained in:
chrome/browser
components/data_reduction_proxy/core
@@ -177,17 +177,45 @@ TEST_F(IOThreadTest, EnableQuicFromFieldTrialGroup) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(IOThreadTest, EnableQuicFromQuicProxyFieldTrialGroup) {
|
TEST_F(IOThreadTest, EnableQuicFromQuicProxyFieldTrialGroup) {
|
||||||
base::FieldTrialList field_trial_list(new base::MockEntropyProvider());
|
const struct {
|
||||||
base::FieldTrialList::CreateFieldTrial(
|
std::string field_trial_group_name;
|
||||||
data_reduction_proxy::params::GetQuicFieldTrialName(), "Enabled");
|
bool expect_enable_quic;
|
||||||
|
} tests[] = {
|
||||||
|
{
|
||||||
|
std::string(), false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"NotEnabled", false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Control", false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Disabled", false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"EnabledControl", true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Enabled", true,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
ConfigureQuicGlobals();
|
for (size_t i = 0; i < arraysize(tests); ++i) {
|
||||||
net::HttpNetworkSession::Params params;
|
base::FieldTrialList field_trial_list(new base::MockEntropyProvider());
|
||||||
InitializeNetworkSessionParams(¶ms);
|
base::FieldTrialList::CreateFieldTrial(
|
||||||
EXPECT_FALSE(params.enable_quic);
|
data_reduction_proxy::params::GetQuicFieldTrialName(),
|
||||||
EXPECT_TRUE(params.enable_quic_for_proxies);
|
tests[i].field_trial_group_name);
|
||||||
EXPECT_TRUE(IOThread::ShouldEnableQuicForDataReductionProxy());
|
|
||||||
EXPECT_EQ(1024 * 1024, params.quic_socket_receive_buffer_size);
|
ConfigureQuicGlobals();
|
||||||
|
net::HttpNetworkSession::Params params;
|
||||||
|
InitializeNetworkSessionParams(¶ms);
|
||||||
|
EXPECT_FALSE(params.enable_quic) << i;
|
||||||
|
EXPECT_EQ(tests[i].expect_enable_quic, params.enable_quic_for_proxies) << i;
|
||||||
|
EXPECT_EQ(tests[i].expect_enable_quic,
|
||||||
|
IOThread::ShouldEnableQuicForDataReductionProxy())
|
||||||
|
<< i;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(IOThreadTest, EnableQuicFromCommandLine) {
|
TEST_F(IOThreadTest, EnableQuicFromCommandLine) {
|
||||||
|
@@ -665,8 +665,31 @@ TEST_F(DataReductionProxySettingsTest, CheckInitMetricsWhenNotAllowed) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(DataReductionProxySettingsTest, CheckQUICFieldTrials) {
|
TEST_F(DataReductionProxySettingsTest, CheckQUICFieldTrials) {
|
||||||
for (int i = 0; i < 2; ++i) {
|
const struct {
|
||||||
bool enable_quic = i == 0;
|
bool enable_quic;
|
||||||
|
std::string field_trial_group_name;
|
||||||
|
} tests[] = {
|
||||||
|
{
|
||||||
|
false, std::string(),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
false, "NotEnabled",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
false, "Control",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
false, "Disabled",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
true, "EnabledControl",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
true, "Enabled",
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
for (size_t i = 0; i < arraysize(tests); ++i) {
|
||||||
// No call to |AddProxyToCommandLine()| was made, so the proxy feature
|
// No call to |AddProxyToCommandLine()| was made, so the proxy feature
|
||||||
// should be unavailable.
|
// should be unavailable.
|
||||||
// Clear the command line. Setting flags can force the proxy to be allowed.
|
// Clear the command line. Setting flags can force the proxy to be allowed.
|
||||||
@@ -682,23 +705,22 @@ TEST_F(DataReductionProxySettingsTest, CheckQUICFieldTrials) {
|
|||||||
test_context_->CreateDataReductionProxyService(settings_.get()));
|
test_context_->CreateDataReductionProxyService(settings_.get()));
|
||||||
|
|
||||||
base::FieldTrialList field_trial_list(new base::MockEntropyProvider());
|
base::FieldTrialList field_trial_list(new base::MockEntropyProvider());
|
||||||
if (enable_quic) {
|
|
||||||
base::FieldTrialList::CreateFieldTrial(params::GetQuicFieldTrialName(),
|
base::FieldTrialList::CreateFieldTrial(params::GetQuicFieldTrialName(),
|
||||||
"Enabled");
|
tests[i].field_trial_group_name);
|
||||||
} else {
|
EXPECT_EQ(
|
||||||
base::FieldTrialList::CreateFieldTrial(params::GetQuicFieldTrialName(),
|
tests[i].field_trial_group_name,
|
||||||
"Disabled");
|
base::FieldTrialList::FindFullName(params::GetQuicFieldTrialName()));
|
||||||
}
|
test_context_->config()->EnableQuic(tests[i].enable_quic);
|
||||||
test_context_->config()->EnableQuic(enable_quic);
|
|
||||||
|
|
||||||
settings_->SetCallbackToRegisterSyntheticFieldTrial(
|
settings_->SetCallbackToRegisterSyntheticFieldTrial(
|
||||||
base::Bind(&DataReductionProxySettingsTestBase::
|
base::Bind(&DataReductionProxySettingsTestBase::
|
||||||
SyntheticFieldTrialRegistrationCallback,
|
SyntheticFieldTrialRegistrationCallback,
|
||||||
base::Unretained(this)));
|
base::Unretained(this)));
|
||||||
|
|
||||||
net::ProxyServer origin =
|
net::ProxyServer origin =
|
||||||
test_context_->config()->test_params()->proxies_for_http().front();
|
test_context_->config()->test_params()->proxies_for_http().front();
|
||||||
EXPECT_EQ(enable_quic, origin.is_quic()) << i;
|
EXPECT_EQ(tests[i].enable_quic, origin.is_quic()) << i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -121,7 +121,7 @@ bool WarnIfNoDataReductionProxy() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool IsIncludedInQuicFieldTrial() {
|
bool IsIncludedInQuicFieldTrial() {
|
||||||
return FieldTrialList::FindFullName(kQuicFieldTrial) == kEnabled;
|
return FieldTrialList::FindFullName(kQuicFieldTrial).find(kEnabled) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string GetQuicFieldTrialName() {
|
std::string GetQuicFieldTrialName() {
|
||||||
|
Reference in New Issue
Block a user