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

Side by Side Diff: components/variations/variations_seed_processor.cc

Issue 1986073003: Expired studies should not enable features. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 unified diff | Download patch
« no previous file with comments | « no previous file | components/variations/variations_seed_processor_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/variations/variations_seed_processor.h" 5 #include "components/variations/variations_seed_processor.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <map> 9 #include <map>
10 #include <vector> 10 #include <vector>
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 RegisterVariationIds(experiment, study.name()); 274 RegisterVariationIds(experiment, study.name());
275 275
276 has_overrides = has_overrides || experiment.override_ui_string_size() > 0; 276 has_overrides = has_overrides || experiment.override_ui_string_size() > 0;
277 if (experiment.feature_association().enable_feature_size() != 0 || 277 if (experiment.feature_association().enable_feature_size() != 0 ||
278 experiment.feature_association().disable_feature_size() != 0) { 278 experiment.feature_association().disable_feature_size() != 0) {
279 enables_or_disables_features = true; 279 enables_or_disables_features = true;
280 } 280 }
281 } 281 }
282 282
283 trial->SetForced(); 283 trial->SetForced();
284 if (processed_study.is_expired())
285 trial->Disable();
284 286
285 if (enables_or_disables_features) 287 if (enables_or_disables_features)
286 RegisterFeatureOverrides(processed_study, trial.get(), feature_list); 288 RegisterFeatureOverrides(processed_study, trial.get(), feature_list);
287 289
288 if (processed_study.is_expired()) { 290 if (study.activation_type() == Study_ActivationType_ACTIVATION_AUTO) {
289 trial->Disable();
290 } else if (study.activation_type() == Study_ActivationType_ACTIVATION_AUTO) {
291 const std::string& group_name = trial->group_name(); 291 const std::string& group_name = trial->group_name();
292 292
293 // Don't try to apply overrides if none of the experiments in this study had 293 // Don't try to apply overrides if none of the experiments in this study had
294 // any. 294 // any.
295 if (!has_overrides) 295 if (!has_overrides)
296 return; 296 return;
297 297
298 // UI Strings can only be overridden from ACTIVATION_AUTO experiments. 298 // UI Strings can only be overridden from ACTIVATION_AUTO experiments.
299 int experiment_index = processed_study.GetExperimentIndexByName(group_name); 299 int experiment_index = processed_study.GetExperimentIndexByName(group_name);
300 300
301 // The field trial was defined from |study|, so the active experiment's name 301 // The field trial was defined from |study|, so the active experiment's name
302 // must be in the |study|. 302 // must be in the |study|.
303 DCHECK_NE(-1, experiment_index); 303 DCHECK_NE(-1, experiment_index);
304 304
305 ApplyUIStringOverrides(study.experiment(experiment_index), 305 ApplyUIStringOverrides(study.experiment(experiment_index),
306 override_callback); 306 override_callback);
307 } 307 }
308 } 308 }
309 309
310 } // namespace variations 310 } // namespace variations
OLDNEW
« no previous file with comments | « no previous file | components/variations/variations_seed_processor_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698