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

Unified Diff: components/variations/variations_seed_processor.cc

Issue 62953004: Support variation params for forcing_flag groups. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 1 month 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
===================================================================
--- components/variations/variations_seed_processor.cc (revision 233378)
+++ components/variations/variations_seed_processor.cc (working copy)
@@ -43,6 +43,18 @@
return base::Time::UnixEpoch() + base::TimeDelta::FromSeconds(date_time);
}
+// Associates the variations params of |experiment|, if present.
+void RegisterExperimentParams(const Study& study,
+ const Study_Experiment& experiment) {
+ std::map<std::string, std::string> params;
+ for (int i = 0; i < experiment.param_size(); ++i) {
+ if (experiment.param(i).has_name() && experiment.param(i).has_value())
+ params[experiment.param(i).name()] = experiment.param(i).value();
+ }
+ if (!params.empty())
+ AssociateVariationParams(study.name(), experiment.name(), params);
+}
+
} // namespace
VariationsSeedProcessor::VariationsSeedProcessor() {
@@ -168,6 +180,7 @@
if (experiment.has_forcing_flag() &&
command_line->HasSwitch(experiment.forcing_flag())) {
base::FieldTrialList::CreateFieldTrial(study.name(), experiment.name());
+ RegisterExperimentParams(study, experiment);
DVLOG(1) << "Trial " << study.name() << " forced by flag: "
<< experiment.forcing_flag();
return;
@@ -195,15 +208,8 @@
for (int i = 0; i < study.experiment_size(); ++i) {
const Study_Experiment& experiment = study.experiment(i);
+ RegisterExperimentParams(study, experiment);
- std::map<std::string, std::string> params;
- for (int j = 0; j < experiment.param_size(); j++) {
- if (experiment.param(j).has_name() && experiment.param(j).has_value())
- params[experiment.param(j).name()] = experiment.param(j).value();
- }
- if (!params.empty())
- AssociateVariationParams(study.name(), experiment.name(), params);
-
// Groups with flags can't be selected randomly, so we don't add them to
// the field trial.
if (experiment.has_forcing_flag())
« no previous file with comments | « components/variations/variations_seed_processor.h ('k') | components/variations/variations_seed_processor_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698