Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(434)

Unified Diff: components/data_reduction_proxy/core/browser/data_reduction_proxy_settings_unittest.cc

Issue 1354283002: Use QUIC for DRP if field trial group starts with Enabled (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/data_reduction_proxy/core/browser/data_reduction_proxy_settings_unittest.cc
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_settings_unittest.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_settings_unittest.cc
index a9c9322baeb9a6f184c7c2c2e807b91c148eb595..ca106d2821d9c7553537f58afdbbfa473e18f998 100644
--- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_settings_unittest.cc
+++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_settings_unittest.cc
@@ -665,8 +665,26 @@ TEST_F(DataReductionProxySettingsTest, CheckInitMetricsWhenNotAllowed) {
}
TEST_F(DataReductionProxySettingsTest, CheckQUICFieldTrials) {
- for (int i = 0; i < 2; ++i) {
- bool enable_quic = i == 0;
+ const struct {
+ bool enable_quic;
+ std::string field_trial_group_name;
+ bool expect_enable_quic;
+ } tests[] = {
+ {
+ false, std::string(), false,
+ },
+ {
+ true, "Enabled", true,
+ },
+ {
+ true, "EnabledControl", true,
+ },
+ {
+ false, "NotEnabled", false,
+ },
+ };
+
+ for (size_t i = 0; i < arraysize(tests); ++i) {
// No call to |AddProxyToCommandLine()| was made, so the proxy feature
// should be unavailable.
// Clear the command line. Setting flags can force the proxy to be allowed.
@@ -682,14 +700,10 @@ TEST_F(DataReductionProxySettingsTest, CheckQUICFieldTrials) {
test_context_->CreateDataReductionProxyService(settings_.get()));
base::FieldTrialList field_trial_list(new base::MockEntropyProvider());
- if (enable_quic) {
- base::FieldTrialList::CreateFieldTrial(params::GetQuicFieldTrialName(),
- "Enabled");
- } else {
- base::FieldTrialList::CreateFieldTrial(params::GetQuicFieldTrialName(),
- "Disabled");
- }
- test_context_->config()->EnableQuic(enable_quic);
+
+ base::FieldTrialList::CreateFieldTrial(params::GetQuicFieldTrialName(),
+ tests[i].field_trial_group_name);
+ test_context_->config()->EnableQuic(tests[i].enable_quic);
settings_->SetCallbackToRegisterSyntheticFieldTrial(
base::Bind(&DataReductionProxySettingsTestBase::
@@ -698,7 +712,7 @@ TEST_F(DataReductionProxySettingsTest, CheckQUICFieldTrials) {
net::ProxyServer origin =
test_context_->config()->test_params()->proxies_for_http().front();
- EXPECT_EQ(enable_quic, origin.is_quic()) << i;
+ EXPECT_EQ(tests[i].expect_enable_quic, origin.is_quic()) << i;
}
}

Powered by Google App Engine
This is Rietveld 408576698