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

Unified Diff: components/variations/variations_seed_processor_unittest.cc

Issue 947493002: Optimize variation field trial evaluation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add comment. Created 5 years, 10 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 | « components/variations/variations_seed_processor.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/variations/variations_seed_processor_unittest.cc
diff --git a/components/variations/variations_seed_processor_unittest.cc b/components/variations/variations_seed_processor_unittest.cc
index d1f76ccb00cb973628bd17f619644cfadc5cc725..147bf6021c1422390003663f02ea298b9c1981ec 100644
--- a/components/variations/variations_seed_processor_unittest.cc
+++ b/components/variations/variations_seed_processor_unittest.cc
@@ -325,6 +325,7 @@ TEST_F(VariationsSeedProcessorTest, ValidateStudy) {
ProcessedStudy processed_study;
EXPECT_TRUE(processed_study.Init(&study, false));
EXPECT_EQ(300, processed_study.total_probability());
+ EXPECT_FALSE(processed_study.all_assignments_to_one_group());
// Min version checks.
study.mutable_filter()->set_min_version("1.2.3.*");
@@ -360,6 +361,36 @@ TEST_F(VariationsSeedProcessorTest, ValidateStudy) {
EXPECT_FALSE(processed_study.Init(&study, false));
}
+TEST_F(VariationsSeedProcessorTest, ProcessedStudyAllAssignmentsToOneGroup) {
+ Study study;
+ study.set_default_experiment_name("def");
+ AddExperiment("def", 100, &study);
+
+ ProcessedStudy processed_study;
+ EXPECT_TRUE(processed_study.Init(&study, false));
+ EXPECT_TRUE(processed_study.all_assignments_to_one_group());
+
+ AddExperiment("abc", 0, &study);
+ AddExperiment("flag", 0, &study)->set_forcing_flag(kForcingFlag1);
+ EXPECT_TRUE(processed_study.Init(&study, false));
+ EXPECT_TRUE(processed_study.all_assignments_to_one_group());
+
+ AddExperiment("xyz", 1, &study);
+ EXPECT_TRUE(processed_study.Init(&study, false));
+ EXPECT_FALSE(processed_study.all_assignments_to_one_group());
+
+ // Try with default group and first group being at 0.
+ Study study2;
+ study2.set_default_experiment_name("def");
+ AddExperiment("def", 0, &study2);
+ AddExperiment("xyz", 34, &study2);
+ EXPECT_TRUE(processed_study.Init(&study2, false));
+ EXPECT_TRUE(processed_study.all_assignments_to_one_group());
+ AddExperiment("abc", 12, &study2);
+ EXPECT_TRUE(processed_study.Init(&study2, false));
+ EXPECT_FALSE(processed_study.all_assignments_to_one_group());
+}
+
TEST_F(VariationsSeedProcessorTest, VariationParams) {
base::FieldTrialList field_trial_list(NULL);
« no previous file with comments | « components/variations/variations_seed_processor.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698