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

Unified Diff: components/variations/variations_seed_processor.cc

Issue 1809633003: Allow trials to associate without overriding a feature. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add a comment. Created 4 years, 9 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/variations/variations_seed_processor.cc
diff --git a/components/variations/variations_seed_processor.cc b/components/variations/variations_seed_processor.cc
index 9f19c3fc9052865cbf1ad0d3774c9164c9cdc081..f22848afa57a4b1e055f64437a557291dd0ffa53 100644
--- a/components/variations/variations_seed_processor.cc
+++ b/components/variations/variations_seed_processor.cc
@@ -107,8 +107,8 @@ void RegisterFeatureOverrides(const ProcessedStudy& processed_study,
// must be in the |study|.
DCHECK_NE(-1, experiment_index);
- const Study_Experiment& experiment =
- processed_study.study()->experiment(experiment_index);
+ const Study& study = *processed_study.study();
+ const Study_Experiment& experiment = study.experiment(experiment_index);
// Process all the features to enable.
int feature_count = experiment.feature_association().enable_feature_size();
@@ -125,6 +125,23 @@ void RegisterFeatureOverrides(const ProcessedStudy& processed_study,
experiment.feature_association().disable_feature(i),
base::FeatureList::OVERRIDE_DISABLE_FEATURE, trial);
}
+
+ // Check if this study enables/disables a single feature and uses explicit
+ // activation (i.e. the trial should be activated when queried). If so, ensure
+ // that groups that don't explicitly enable/disable that feature are still
+ // associated with it (i.e. so "Default" group gets reported).
+ //
+ // Note: This checks for ACTIVATION_EXPLICIT, since there is no reason to
+ // have this association with ACTIVATION_AUTO (where the trial starts active),
+ // as well as allowing flexibility to disable this behavior in the future from
+ // the server by introducing a new activation type.
+ if (!processed_study.single_feature_name().empty() &&
+ study.activation_type() == Study_ActivationType_ACTIVATION_EXPLICIT &&
+ !experiment.has_feature_association()) {
+ feature_list->RegisterFieldTrialOverride(
+ processed_study.single_feature_name(),
+ base::FeatureList::OVERRIDE_USE_DEFAULT, trial);
+ }
}
// Checks if |experiment| is associated with a forcing flag or feature and if it
« no previous file with comments | « components/variations/processed_study.cc ('k') | components/variations/variations_seed_processor_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698