| 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..990e136e023d5f3cfc57979d796a20b57c7ed49a 100644
|
| --- a/components/flags_ui/flags_state_unittest.cc
|
| +++ b/components/flags_ui/flags_state_unittest.cc
|
| @@ -268,10 +268,13 @@ TEST_F(FlagsStateTest, ConvertFlagsToSwitches) {
|
|
|
| TEST_F(FlagsStateTest, RegisterAllFeatureVariationParameters) {
|
| const FeatureEntry& entry = kEntries[7];
|
| + std::unique_ptr<base::FeatureList> feature_list(new base::FeatureList);
|
| +
|
| // Select the "Disabled" variation.
|
| flags_state_->SetFeatureEntryEnabled(&flags_storage_, entry.NameForOption(0),
|
| true);
|
| - flags_state_->RegisterAllFeatureVariationParameters(&flags_storage_);
|
| + flags_state_->RegisterAllFeatureVariationParameters(&flags_storage_,
|
| + feature_list.get());
|
| // No value should be associated.
|
| EXPECT_EQ("", variations::GetVariationParamValue(kTestTrial, kTestParam));
|
| // The trial should not be created.
|
| @@ -282,10 +285,19 @@ TEST_F(FlagsStateTest, RegisterAllFeatureVariationParameters) {
|
| flags_state_->SetFeatureEntryEnabled(&flags_storage_, entry.NameForOption(1),
|
| true);
|
|
|
| - flags_state_->RegisterAllFeatureVariationParameters(&flags_storage_);
|
| + flags_state_->RegisterAllFeatureVariationParameters(&flags_storage_,
|
| + feature_list.get());
|
| + // Set the feature_list as the main instance so that
|
| + // variations::GetVariationParamValueByFeature below works.
|
| + base::FeatureList::ClearInstanceForTesting();
|
| + base::FeatureList::SetInstance(std::move(feature_list));
|
| +
|
| // The value should be associated.
|
| EXPECT_EQ(kTestParamValue1,
|
| variations::GetVariationParamValue(kTestTrial, kTestParam));
|
| + // The value should be associated also via the name of the feature.
|
| + EXPECT_EQ(kTestParamValue1, variations::GetVariationParamValueByFeature(
|
| + kTestFeature2, kTestParam));
|
|
|
| // The trial should be created.
|
| trial = base::FieldTrialList::Find(kTestTrial);
|
| @@ -296,7 +308,8 @@ TEST_F(FlagsStateTest, RegisterAllFeatureVariationParameters) {
|
| // Select the second "Enabled" variation.
|
| flags_state_->SetFeatureEntryEnabled(&flags_storage_, entry.NameForOption(2),
|
| true);
|
| - flags_state_->RegisterAllFeatureVariationParameters(&flags_storage_);
|
| + flags_state_->RegisterAllFeatureVariationParameters(&flags_storage_,
|
| + feature_list.get());
|
| // Associating for the second time should not change the value.
|
| EXPECT_EQ(kTestParamValue1,
|
| variations::GetVariationParamValue(kTestTrial, kTestParam));
|
|
|