Lines Matching refs:trial
51 virtual void OnFieldTrialGroupFinalized(const std::string& trial,
53 trial_name_ = trial;
142 scoped_refptr<FieldTrial> trial;
146 std::string name = StringPrintf("trial%d", ++counter);
147 trial = CreateFieldTrial(name, 10, winner, &default_group_number);
148 trial->AppendGroup(loser, 5); // 50% chance of not being chosen.
150 } while (trial->group_ != FieldTrial::kNotFinalized);
153 EXPECT_EQ(default_group_number, trial->group());
156 EXPECT_EQ(winner, trial->group_name());
171 scoped_refptr<FieldTrial> trial =
173 trial->AppendGroup("first", 1); // 50% chance of being chosen.
175 if (trial->group_ != FieldTrial::kNotFinalized) {
179 trial->AppendGroup("second", 1); // Always chosen at this point.
180 EXPECT_NE(FieldTrial::kNotFinalized, trial->group());
195 scoped_refptr<FieldTrial> trial =
197 int might_win = trial->AppendGroup("MightWin", 5);
199 if (trial->group() == might_win) {
219 scoped_refptr<FieldTrial> trial =
225 int might_win = trial->AppendGroup(std::string(), 1);
229 if (trial->group_ == might_win) {
233 EXPECT_EQ(winner_name, trial->group_name());
239 EXPECT_NE(trial->group(), default_group_number);
240 EXPECT_EQ(trial->group(), winner_index);
241 EXPECT_EQ(trial->group_name(), winner_name);
247 const std::string name = "Trial";
251 FieldTrial* trial = FieldTrialList::FactoryGetFieldTrial(
255 trial->AppendGroup(loser, 999999999); // 99.9999999% chance of being chosen.
257 // Because trial has expired, we should always be in the default group.
258 EXPECT_EQ(default_group_number, trial->group());
261 EXPECT_EQ(default_group_name, trial->group_name());
266 scoped_refptr<FieldTrial> trial =
271 EXPECT_FALSE(trial->GetActiveGroup(&active_group));
275 trial = CreateFieldTrial(one_winner, 10, "Default", NULL);
277 trial->AppendGroup(winner, 10);
278 EXPECT_FALSE(trial->GetActiveGroup(&active_group));
280 trial->group();
281 EXPECT_TRUE(trial->GetActiveGroup(&active_group));
318 scoped_refptr<FieldTrial> trial =
320 const int secondary_group = trial->AppendGroup(kSecondaryGroupName, 50);
324 EXPECT_FALSE(trial->GetActiveGroup(&active_group));
326 // |GetActiveFieldTrialGroups()| should also not include the trial.
332 const int chosen_group = trial->group();
335 EXPECT_TRUE(trial->GetActiveGroup(&active_group));
351 scoped_refptr<FieldTrial> trial =
353 // There is no winner yet, so no textual group name is associated with trial.
354 // In this case, the trial should not be included.
355 EXPECT_EQ("", trial->group_name_internal());
361 trial->AppendGroup("Winner", 10);
363 trial->group();
368 // Create a second trial and winning group.
380 // Create a third trial with only the default group.
398 FieldTrial* trial = FieldTrialList::Find("Some_name");
399 ASSERT_NE(static_cast<FieldTrial*>(NULL), trial);
400 EXPECT_EQ("Winner", trial->group_name());
401 EXPECT_EQ("Some_name", trial->trial_name());
403 trial = FieldTrialList::Find("xxx");
404 ASSERT_NE(static_cast<FieldTrial*>(NULL), trial);
405 EXPECT_EQ("yyyy", trial->group_name());
406 EXPECT_EQ("xxx", trial->trial_name());
414 FieldTrial* trial = FieldTrialList::Find("tname");
415 ASSERT_NE(static_cast<FieldTrial*>(NULL), trial);
416 EXPECT_EQ("gname", trial->group_name());
417 EXPECT_EQ("tname", trial->trial_name());
433 scoped_refptr<FieldTrial> trial =
435 trial->AppendGroup("Winner", 10);
437 trial->group();
554 FieldTrial* trial = FieldTrialList::Find("Foo");
555 ASSERT_NE(static_cast<FieldTrial*>(NULL), trial);
556 EXPECT_EQ("Foo", trial->trial_name());
557 EXPECT_EQ("Foo_name", trial->group_name());
559 trial = FieldTrialList::Find("Bar");
560 ASSERT_NE(static_cast<FieldTrial*>(NULL), trial);
561 EXPECT_EQ("Bar", trial->trial_name());
562 EXPECT_EQ("Bar_name", trial->group_name());
570 FieldTrial* trial = FieldTrialList::Find("Some_name");
571 ASSERT_NE(static_cast<FieldTrial*>(NULL), trial);
572 EXPECT_EQ("Winner", trial->group_name());
573 EXPECT_EQ("Some_name", trial->trial_name());
588 scoped_refptr<FieldTrial> trial =
590 trial->AppendGroup("Winner", 10);
603 scoped_refptr<FieldTrial> trial =
604 CreateFieldTrial("trial", 100, "default", &default_group_number);
605 trial->Disable();
606 ASSERT_EQ("default", trial->group_name());
607 ASSERT_EQ(default_group_number, trial->group());
611 scoped_refptr<FieldTrial> trial =
612 CreateFieldTrial("trial", 100, "default", NULL);
613 trial->AppendGroup("non_default", 100);
614 trial->Disable();
615 ASSERT_EQ("default", trial->group_name());
645 FieldTrial* forced_trial = FieldTrialList::CreateFieldTrial("Trial Name",
649 CreateFieldTrial("Trial Name", 1000, "Default", &default_group_number);
662 // Start by setting a trial for which we ensure a winner...
698 scoped_refptr<FieldTrial> trial =
700 trial->SetForced();
702 trial = CreateFieldTrial(kTrialName, 100, kDefaultGroupName, NULL);
703 EXPECT_EQ(default_group, trial->group());
704 EXPECT_EQ(kDefaultGroupName, trial->group_name());
712 scoped_refptr<FieldTrial> trial =
714 trial->SetForced();
716 trial = CreateFieldTrial(kTrialName, 100, kDefaultGroupName, NULL);
717 const int extra_group = trial->AppendGroup("Extra", 100);
718 EXPECT_EQ(default_group, trial->group());
719 EXPECT_NE(extra_group, trial->group());
720 EXPECT_EQ(kDefaultGroupName, trial->group_name());
827 scoped_refptr<FieldTrial> trial =
829 const int secondary_group = trial->AppendGroup(kSecondaryGroupName, 50);
830 const int chosen_group = trial->group();
846 scoped_refptr<FieldTrial> trial =
848 trial->AppendGroup("A", 25);
849 trial->AppendGroup("B", 25);
850 trial->AppendGroup("C", 25);
851 trial->Disable();
853 // Observer shouldn't be notified of a disabled trial.
859 EXPECT_EQ(default_group, trial->group());
870 scoped_refptr<FieldTrial> trial =
872 trial->AppendGroup("A", 25);
873 trial->AppendGroup("B", 25);
874 trial->AppendGroup("C", 25);
875 trial->SetForced();
876 trial->Disable();
878 // Observer shouldn't be notified of a disabled trial, even when forced.
884 EXPECT_EQ(default_group, trial->group());
894 scoped_refptr<FieldTrial> trial =
896 trial->AppendGroup("X", 50);
897 trial->Disable();
899 // Ensure the trial is not listed as active.
904 // Ensure the trial is not listed in the |StatesToString()| result.
916 scoped_refptr<FieldTrial> trial =
918 trial->AppendGroup(kGroupName, kProbability);
919 EXPECT_EQ(kGroupName, trial->group_name());
929 scoped_refptr<base::FieldTrial> trial(
932 trial->AppendGroup(base::StringPrintf("%d", j), 1);
934 EXPECT_EQ(base::StringPrintf("%d", i), trial->group_name());
942 scoped_refptr<base::FieldTrial> trial(
944 trial->AppendGroup("1", 1);
945 trial->AppendGroup("2", 1);
947 EXPECT_EQ("2", trial->group_name());
966 scoped_refptr<FieldTrial> trial(
969 trial->AppendGroup("A", 80);
970 trial->AppendGroup("B", 10);
971 EXPECT_EQ(test_cases[i].expected_group, trial->group_name());
973 // Field trial shouldn't have been registered with the list.
981 // The trial shouldn't be in the active set of trials.
986 // The trial shouldn't be listed in the |StatesToString()| result.