summaryrefslogtreecommitdiffstats
path: root/base/feature_list_unittest.cc
diff options
context:
space:
mode:
authorasvitkine <asvitkine@chromium.org>2015-11-30 20:10:28 -0800
committerCommit bot <commit-bot@chromium.org>2015-12-01 04:11:05 +0000
commitb2e44d8215dd9d4ed6316c6696b576cf77cb363c (patch)
treee66aea9418de75f808e11ee9aaf1d990a777bcef /base/feature_list_unittest.cc
parent16fb3889dce2d25344162c53e1244441800e0a94 (diff)
downloadchromium_src-b2e44d8215dd9d4ed6316c6696b576cf77cb363c.zip
chromium_src-b2e44d8215dd9d4ed6316c6696b576cf77cb363c.tar.gz
chromium_src-b2e44d8215dd9d4ed6316c6696b576cf77cb363c.tar.bz2
Plumb base::Feature field trial association to renderers.
This CL makes the FeatureList command-line initialization code support an optional FieldTrial name for each feature that will be associated with the feature override when specified. Also changes the code that generates this command-line to also include this name. With this change, renderers will be launched with this association specified on the command-line, so that querying a Feature in the renderer only that's associated with a field trial will result in that trial being activated (and sync'd with the browser process by the existing mechanism). Depends on: https://codereview.chromium.org/1471693007 BUG=561077 Review URL: https://codereview.chromium.org/1484483002 Cr-Commit-Position: refs/heads/master@{#362343}
Diffstat (limited to 'base/feature_list_unittest.cc')
-rw-r--r--base/feature_list_unittest.cc15
1 files changed, 14 insertions, 1 deletions
diff --git a/base/feature_list_unittest.cc b/base/feature_list_unittest.cc
index 414c74a..29c1f16 100644
--- a/base/feature_list_unittest.cc
+++ b/base/feature_list_unittest.cc
@@ -335,8 +335,21 @@ TEST_F(FeatureListTest, GetFeatureOverrides) {
std::string disable_features;
FeatureList::GetInstance()->GetFeatureOverrides(&enable_features,
&disable_features);
- EXPECT_EQ("A,OffByDefault,X", SortFeatureListString(enable_features));
+ EXPECT_EQ("A,OffByDefault<Trial,X", SortFeatureListString(enable_features));
EXPECT_EQ("D", SortFeatureListString(disable_features));
}
+TEST_F(FeatureListTest, InitializeFromCommandLine_WithFieldTrials) {
+ ClearFeatureListInstance();
+ FieldTrialList field_trial_list(nullptr);
+ FieldTrialList::CreateFieldTrial("Trial", "Group");
+ scoped_ptr<FeatureList> feature_list(new FeatureList);
+ feature_list->InitializeFromCommandLine("A,OffByDefault<Trial,X", "D");
+ RegisterFeatureListInstance(feature_list.Pass());
+
+ EXPECT_FALSE(FieldTrialList::IsTrialActive("Trial"));
+ EXPECT_TRUE(FeatureList::IsEnabled(kFeatureOffByDefault));
+ EXPECT_TRUE(FieldTrialList::IsTrialActive("Trial"));
+}
+
} // namespace base