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

Unified Diff: base/metrics/field_trial_unittest.cc

Issue 6213001: disable field trials if the build is 30 days or older (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Created 9 years, 11 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
« base/metrics/field_trial.cc ('K') | « base/metrics/field_trial.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/metrics/field_trial_unittest.cc
===================================================================
--- base/metrics/field_trial_unittest.cc (revision 70854)
+++ base/metrics/field_trial_unittest.cc (working copy)
@@ -160,6 +160,22 @@
EXPECT_EQ(trial->group_name(), winner_name);
}
+TEST_F(FieldTrialTest, DisableProbability) {
+ // First create a test that hasn't had a winner yet.
+ const std::string winner = "Winner";
+ const std::string loser = "Loser";
+ scoped_refptr<FieldTrial> trial;
+ std::string name = StringPrintf("trial");
+ trial = new FieldTrial(name, 100000);
+ trial->SetDurationAfterWhichDisableFieldTrials(base::TimeDelta::FromDays(-1));
+ trial->AppendGroup(loser, 99999); // 99.999% chance of being chosen.
jar (doing other things) 2011/01/09 07:00:04 This seems pretty good.... we may as well make it
rtenneti 2011/01/09 23:16:42 Done.
+ // Now add a winner with all remaining probability.
+ trial->AppendGroup(winner, FieldTrial::kAllRemainingProbability);
+
+ // And that winner should ALWAYS win.
+ EXPECT_EQ(winner, trial->group_name());
+}
+
TEST_F(FieldTrialTest, Save) {
std::string save_string;
« base/metrics/field_trial.cc ('K') | « base/metrics/field_trial.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698