| Index: components/variations/variations_seed_processor_unittest.cc
|
| diff --git a/components/variations/variations_seed_processor_unittest.cc b/components/variations/variations_seed_processor_unittest.cc
|
| index d2a2959529aa06fc3f96d641140e0cb7564b29b7..693ccf9867b4d3b51f208f66c5b2a26c862e091b 100644
|
| --- a/components/variations/variations_seed_processor_unittest.cc
|
| +++ b/components/variations/variations_seed_processor_unittest.cc
|
| @@ -359,6 +359,49 @@ TEST_F(VariationsSeedProcessorTest, ValidateStudy) {
|
| EXPECT_FALSE(processed_study.Init(&study, false));
|
| }
|
|
|
| +TEST_F(VariationsSeedProcessorTest, ValidateStudySingleFeature) {
|
| + Study study;
|
| + study.set_default_experiment_name("def");
|
| + Study_Experiment* exp1 = AddExperiment("exp1", 100, &study);
|
| + Study_Experiment* exp2 = AddExperiment("exp2", 100, &study);
|
| + Study_Experiment* exp3 = AddExperiment("exp3", 100, &study);
|
| + AddExperiment("def", 100, &study);
|
| +
|
| + ProcessedStudy processed_study;
|
| + EXPECT_TRUE(processed_study.Init(&study, false));
|
| + EXPECT_EQ(400, processed_study.total_probability());
|
| +
|
| + EXPECT_EQ(std::string(), processed_study.single_feature_name());
|
| +
|
| + const char kFeature1Name[] = "Feature1";
|
| + const char kFeature2Name[] = "Feature2";
|
| +
|
| + exp1->mutable_feature_association()->add_enable_feature(kFeature1Name);
|
| + EXPECT_TRUE(processed_study.Init(&study, false));
|
| + EXPECT_EQ(kFeature1Name, processed_study.single_feature_name());
|
| +
|
| + exp1->clear_feature_association();
|
| + exp1->mutable_feature_association()->add_enable_feature(kFeature1Name);
|
| + exp1->mutable_feature_association()->add_enable_feature(kFeature2Name);
|
| + EXPECT_TRUE(processed_study.Init(&study, false));
|
| + // Since there's multiple different features, |single_feature_name| should be
|
| + // unset.
|
| + EXPECT_EQ(std::string(), processed_study.single_feature_name());
|
| +
|
| + exp1->clear_feature_association();
|
| + exp1->mutable_feature_association()->add_enable_feature(kFeature1Name);
|
| + exp2->mutable_feature_association()->add_enable_feature(kFeature1Name);
|
| + exp3->mutable_feature_association()->add_disable_feature(kFeature1Name);
|
| + EXPECT_TRUE(processed_study.Init(&study, false));
|
| + EXPECT_EQ(kFeature1Name, processed_study.single_feature_name());
|
| +
|
| + // Setting a different feature name on exp2 should cause |single_feature_name|
|
| + // to be not set.
|
| + exp2->mutable_feature_association()->set_enable_feature(0, kFeature2Name);
|
| + EXPECT_TRUE(processed_study.Init(&study, false));
|
| + EXPECT_EQ(std::string(), processed_study.single_feature_name());
|
| +}
|
| +
|
| TEST_F(VariationsSeedProcessorTest, ProcessedStudyAllAssignmentsToOneGroup) {
|
| Study study;
|
| study.set_default_experiment_name("def");
|
| @@ -613,14 +656,13 @@ TEST_F(VariationsSeedProcessorTest, FeatureAssociationAndForcing) {
|
| // Check what happens without and command-line forcing flags - that the
|
| // |one_hundred_percent_group| gets correctly selected and does the right
|
| // thing w.r.t. to affecting the feature / activating the trial.
|
| - {kFeatureOffByDefault, "", "", DEFAULT_GROUP, kDefaultGroup, false,
|
| - false},
|
| + {kFeatureOffByDefault, "", "", DEFAULT_GROUP, kDefaultGroup, false, true},
|
| {kFeatureOffByDefault, "", "", ENABLE_GROUP, kEnabledGroup, true, true},
|
| {kFeatureOffByDefault, "", "", DISABLE_GROUP, kDisabledGroup, false,
|
| true},
|
|
|
| // Do the same as above, but for kFeatureOnByDefault feature.
|
| - {kFeatureOnByDefault, "", "", DEFAULT_GROUP, kDefaultGroup, true, false},
|
| + {kFeatureOnByDefault, "", "", DEFAULT_GROUP, kDefaultGroup, true, true},
|
| {kFeatureOnByDefault, "", "", ENABLE_GROUP, kEnabledGroup, true, true},
|
| {kFeatureOnByDefault, "", "", DISABLE_GROUP, kDisabledGroup, false, true},
|
|
|
|
|