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

Unified Diff: base/field_trial_unittest.cc

Issue 150141: Implement shortcut for finalizing a trial with all remaining probability... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 6 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
« no previous file with comments | « base/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/field_trial_unittest.cc
===================================================================
--- base/field_trial_unittest.cc (revision 19682)
+++ base/field_trial_unittest.cc (working copy)
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2006-2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -69,6 +69,25 @@
}
}
+TEST_F(FieldTrialTest, RemainingProbability) {
+ // 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;
+ int counter = 0;
+ do {
+ std::string name = StringPrintf("trial%d", ++counter);
+ trial = new FieldTrial(name, 10);
+ trial->AppendGroup(loser, 5); // 50% chance of not being chosen.
+ } while (trial->group() != FieldTrial::kNotParticipating);
+
+ // 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, MiddleProbabilities) {
char name[] = " same name";
bool false_event_seen = false;
« no previous file with comments | « base/field_trial.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698