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

Unified Diff: components/variations/variations_seed_processor_unittest.cc

Issue 2119713002: Fix crash when variation parameters are set in chrome://flags. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Small fix #2 Created 4 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 | « 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 d6207ff328868fb28d8afb432dbe794e5f32e744..1ab8a497a38411046a4c3090e804444be1d9606b 100644
--- a/components/variations/variations_seed_processor_unittest.cc
+++ b/components/variations/variations_seed_processor_unittest.cc
@@ -40,6 +40,7 @@ const char kFlagStudyName[] = "flag_test_trial";
const char kFlagGroup1Name[] = "flag_group1";
const char kFlagGroup2Name[] = "flag_group2";
const char kNonFlagGroupName[] = "non_flag_group";
+const char kOtherGroupName[] = "other_group";
const char kForcingFlag1[] = "flag_test1";
const char kForcingFlag2[] = "flag_test2";
@@ -227,6 +228,20 @@ TEST_F(VariationsSeedProcessorTest, ForceGroup_DontChooseGroupWithFlag) {
base::FieldTrialList::FindFullName(kFlagStudyName));
}
+TEST_F(VariationsSeedProcessorTest, CreateTrialForRegisteredGroup) {
+ base::FieldTrialList field_trial_list(nullptr);
+
+ base::FieldTrialList::CreateFieldTrial(kFlagStudyName, kOtherGroupName);
+
+ // Create an arbitrary study that does not have group named |kOtherGroupName|.
+ Study study = CreateStudyWithFlagGroups(100, 0, 0);
+ // Creating the trial should not crash.
+ EXPECT_TRUE(CreateTrialFromStudy(study));
+ // And the previous group should still be selected.
+ EXPECT_EQ(kOtherGroupName,
+ base::FieldTrialList::FindFullName(kFlagStudyName));
+}
+
TEST_F(VariationsSeedProcessorTest,
NonExpiredStudyPrioritizedOverExpiredStudy) {
VariationsSeedProcessor seed_processor;
« 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