| Index: components/flags_ui/flags_state_unittest.cc
|
| diff --git a/components/flags_ui/flags_state_unittest.cc b/components/flags_ui/flags_state_unittest.cc
|
| index b95373a5f4ba8775df577b6b104c9dd971de43c7..4d0ce88d26c8407ed408bb9424d78477a2bd5415 100644
|
| --- a/components/flags_ui/flags_state_unittest.cc
|
| +++ b/components/flags_ui/flags_state_unittest.cc
|
| @@ -62,22 +62,17 @@ const char kDisableFeatures[] = "dummy-disable-features";
|
|
|
| const char kTestTrial[] = "TestTrial";
|
| const char kTestParam[] = "param";
|
| -const char kTestParamValue1[] = "value1";
|
| -const char kTestParamValue2[] = "value2";
|
| +const char kTestParamValue[] = "value";
|
|
|
| const base::Feature kTestFeature1{"FeatureName1",
|
| base::FEATURE_ENABLED_BY_DEFAULT};
|
| const base::Feature kTestFeature2{"FeatureName2",
|
| base::FEATURE_ENABLED_BY_DEFAULT};
|
|
|
| -const FeatureEntry::FeatureParam kTestVariationDefault[] = {
|
| - {kTestParam, kTestParamValue1}};
|
| -
|
| const FeatureEntry::FeatureParam kTestVariationOther[] = {
|
| - {kTestParam, kTestParamValue2}};
|
| + {kTestParam, kTestParamValue}};
|
|
|
| const FeatureEntry::FeatureVariation kTestVariations[] = {
|
| - {"", kTestVariationDefault, 1},
|
| {"dummy description", kTestVariationOther, 1}};
|
|
|
| // Those have to be valid ids for the translation system but the value are
|
| @@ -268,7 +263,7 @@ TEST_F(FlagsStateTest, ConvertFlagsToSwitches) {
|
|
|
| TEST_F(FlagsStateTest, RegisterAllFeatureVariationParameters) {
|
| const FeatureEntry& entry = kEntries[7];
|
| - // Select the "Disabled" variation.
|
| + // Select the "Default" variation.
|
| flags_state_->SetFeatureEntryEnabled(&flags_storage_, entry.NameForOption(0),
|
| true);
|
| flags_state_->RegisterAllFeatureVariationParameters(&flags_storage_);
|
| @@ -278,13 +273,13 @@ TEST_F(FlagsStateTest, RegisterAllFeatureVariationParameters) {
|
| base::FieldTrial* trial = base::FieldTrialList::Find(kTestTrial);
|
| EXPECT_EQ(nullptr, trial);
|
|
|
| - // Select the first "Enabled" variation.
|
| + // Select the default "Enabled" variation.
|
| flags_state_->SetFeatureEntryEnabled(&flags_storage_, entry.NameForOption(1),
|
| true);
|
|
|
| flags_state_->RegisterAllFeatureVariationParameters(&flags_storage_);
|
| - // The value should be associated.
|
| - EXPECT_EQ(kTestParamValue1,
|
| + // No value should be associated as this is the default option.
|
| + EXPECT_EQ("",
|
| variations::GetVariationParamValue(kTestTrial, kTestParam));
|
|
|
| // The trial should be created.
|
| @@ -293,12 +288,23 @@ TEST_F(FlagsStateTest, RegisterAllFeatureVariationParameters) {
|
| // The about:flags group should be selected for the trial.
|
| EXPECT_EQ(internal::kTrialGroupAboutFlags, trial->group_name());
|
|
|
| - // Select the second "Enabled" variation.
|
| + // Select the only one variation.
|
| flags_state_->SetFeatureEntryEnabled(&flags_storage_, entry.NameForOption(2),
|
| true);
|
| flags_state_->RegisterAllFeatureVariationParameters(&flags_storage_);
|
| // Associating for the second time should not change the value.
|
| - EXPECT_EQ(kTestParamValue1,
|
| + EXPECT_EQ("",
|
| + variations::GetVariationParamValue(kTestTrial, kTestParam));
|
| +}
|
| +
|
| +TEST_F(FlagsStateTest, RegisterAllFeatureVariationParametersNonDefault) {
|
| + const FeatureEntry& entry = kEntries[7];
|
| + // Select the only one variation.
|
| + flags_state_->SetFeatureEntryEnabled(&flags_storage_, entry.NameForOption(2),
|
| + true);
|
| + flags_state_->RegisterAllFeatureVariationParameters(&flags_storage_);
|
| + // The param should have the value predefined in this variation.
|
| + EXPECT_EQ(kTestParamValue,
|
| variations::GetVariationParamValue(kTestTrial, kTestParam));
|
| }
|
|
|
|
|