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

Side by Side Diff: components/variations/variations_seed_simulator_unittest.cc

Issue 1984003002: Use low entropy for studies that send experiment IDs to Google properties. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 unified diff | Download patch
« no previous file with comments | « components/variations/variations_seed_simulator.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/variations/variations_seed_simulator.h" 5 #include "components/variations/variations_seed_simulator.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <map> 9 #include <map>
10 10
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/strings/stringprintf.h" 12 #include "base/strings/stringprintf.h"
13 #include "base/test/mock_entropy_provider.h"
13 #include "components/variations/processed_study.h" 14 #include "components/variations/processed_study.h"
14 #include "components/variations/proto/study.pb.h" 15 #include "components/variations/proto/study.pb.h"
15 #include "components/variations/variations_associated_data.h" 16 #include "components/variations/variations_associated_data.h"
16 #include "testing/gtest/include/gtest/gtest.h" 17 #include "testing/gtest/include/gtest/gtest.h"
17 18
18 namespace variations { 19 namespace variations {
19 20
20 namespace { 21 namespace {
21
22 // An implementation of EntropyProvider that always returns a specific entropy
23 // value, regardless of field trial.
24 class TestEntropyProvider : public base::FieldTrial::EntropyProvider {
25 public:
26 explicit TestEntropyProvider(double entropy_value)
27 : entropy_value_(entropy_value) {}
28 ~TestEntropyProvider() override {}
29
30 // base::FieldTrial::EntropyProvider implementation:
31 double GetEntropyForTrial(const std::string& trial_name,
32 uint32_t randomization_seed) const override {
33 return entropy_value_;
34 }
35
36 private:
37 const double entropy_value_;
38
39 DISALLOW_COPY_AND_ASSIGN(TestEntropyProvider);
40 };
41
42 // Creates and activates a single-group field trial with name |trial_name| and 22 // Creates and activates a single-group field trial with name |trial_name| and
43 // group |group_name| and variations |params| (if not NULL). 23 // group |group_name| and variations |params| (if not null).
44 void CreateTrial(const std::string& trial_name, 24 void CreateTrial(const std::string& trial_name,
45 const std::string& group_name, 25 const std::string& group_name,
46 const std::map<std::string, std::string>* params) { 26 const std::map<std::string, std::string>* params) {
47 base::FieldTrialList::CreateFieldTrial(trial_name, group_name); 27 base::FieldTrialList::CreateFieldTrial(trial_name, group_name);
48 if (params != NULL) 28 if (params != nullptr)
49 AssociateVariationParams(trial_name, group_name, *params); 29 AssociateVariationParams(trial_name, group_name, *params);
50 base::FieldTrialList::FindFullName(trial_name); 30 base::FieldTrialList::FindFullName(trial_name);
51 } 31 }
52 32
53 // Creates a study with the given |study_name| and |consistency|. 33 // Creates a study with the given |study_name| and |consistency|.
54 Study CreateStudy(const std::string& study_name, 34 Study CreateStudy(const std::string& study_name,
55 Study_Consistency consistency) { 35 Study_Consistency consistency) {
56 Study study; 36 Study study;
57 study.set_name(study_name); 37 study.set_name(study_name);
58 study.set_consistency(consistency); 38 study.set_consistency(consistency);
(...skipping 19 matching lines...) Expand all
78 Study_Experiment_Param* param = experiment->add_param(); 58 Study_Experiment_Param* param = experiment->add_param();
79 param->set_name(param_name); 59 param->set_name(param_name);
80 param->set_value(param_value); 60 param->set_value(param_value);
81 return param; 61 return param;
82 } 62 }
83 63
84 } // namespace 64 } // namespace
85 65
86 class VariationsSeedSimulatorTest : public ::testing::Test { 66 class VariationsSeedSimulatorTest : public ::testing::Test {
87 public: 67 public:
88 VariationsSeedSimulatorTest() : field_trial_list_(NULL) { 68 VariationsSeedSimulatorTest() : field_trial_list_(nullptr) {}
89 }
90 69
91 ~VariationsSeedSimulatorTest() override { 70 ~VariationsSeedSimulatorTest() override {
92 // Ensure that the maps are cleared between tests, since they are stored as 71 // Ensure that the maps are cleared between tests, since they are stored as
93 // process singletons. 72 // process singletons.
94 testing::ClearAllVariationIDs(); 73 testing::ClearAllVariationIDs();
95 testing::ClearAllVariationParams(); 74 testing::ClearAllVariationParams();
96 } 75 }
97 76
98 // Uses a VariationsSeedSimulator to simulate the differences between 77 // Uses a VariationsSeedSimulator to simulate the differences between
99 // |studies| and the current field trial state. 78 // |studies| and the current field trial state.
100 VariationsSeedSimulator::Result SimulateDifferences( 79 VariationsSeedSimulator::Result SimulateDifferences(
101 const std::vector<ProcessedStudy>& studies) { 80 const std::vector<ProcessedStudy>& studies) {
102 TestEntropyProvider provider(0.5); 81 // Should pick the first group that has non-zero probability weight.
103 VariationsSeedSimulator seed_simulator(provider); 82 base::MockEntropyProvider default_provider(0);
83 // Should pick default groups, if they have non-zero probability weight.
84 base::MockEntropyProvider low_provider(1.0 - 1e-8);
85 VariationsSeedSimulator seed_simulator(default_provider, low_provider);
104 return seed_simulator.ComputeDifferences(studies); 86 return seed_simulator.ComputeDifferences(studies);
105 } 87 }
106 88
107 // Simulates the differences between |study| and the current field trial 89 // Simulates the differences between |study| and the current field trial
108 // state, returning a string like "1 2 3", where 1 is the number of regular 90 // state, returning a string like "1 2 3", where 1 is the number of regular
109 // group changes, 2 is the number of "kill best effort" group changes and 3 91 // group changes, 2 is the number of "kill best effort" group changes and 3
110 // is the number of "kill critical" group changes. 92 // is the number of "kill critical" group changes.
111 std::string SimulateStudyDifferences(const Study* study) { 93 std::string SimulateStudyDifferences(const Study* study) {
112 std::vector<ProcessedStudy> studies; 94 std::vector<ProcessedStudy> studies;
113 if (!ProcessedStudy::ValidateAndAppendStudy(study, false, &studies)) 95 if (!ProcessedStudy::ValidateAndAppendStudy(study, false, &studies))
(...skipping 25 matching lines...) Expand all
139 result.kill_critical_group_change_count); 121 result.kill_critical_group_change_count);
140 } 122 }
141 123
142 private: 124 private:
143 base::FieldTrialList field_trial_list_; 125 base::FieldTrialList field_trial_list_;
144 126
145 DISALLOW_COPY_AND_ASSIGN(VariationsSeedSimulatorTest); 127 DISALLOW_COPY_AND_ASSIGN(VariationsSeedSimulatorTest);
146 }; 128 };
147 129
148 TEST_F(VariationsSeedSimulatorTest, PermanentNoChanges) { 130 TEST_F(VariationsSeedSimulatorTest, PermanentNoChanges) {
149 CreateTrial("A", "B", NULL); 131 CreateTrial("A", "B", nullptr);
150 132
151 std::vector<ProcessedStudy> processed_studies; 133 std::vector<ProcessedStudy> processed_studies;
152 Study study = CreateStudy("A", Study_Consistency_PERMANENT); 134 Study study = CreateStudy("A", Study_Consistency_PERMANENT);
153 Study_Experiment* experiment = AddExperiment("B", 100, &study); 135 Study_Experiment* experiment = AddExperiment("B", 100, &study);
154 136
155 EXPECT_EQ("0 0 0", SimulateStudyDifferences(&study)); 137 EXPECT_EQ("0 0 0", SimulateStudyDifferences(&study));
156 138
157 experiment->set_type(Study_Experiment_Type_NORMAL); 139 experiment->set_type(Study_Experiment_Type_NORMAL);
158 EXPECT_EQ("0 0 0", SimulateStudyDifferences(&study)); 140 EXPECT_EQ("0 0 0", SimulateStudyDifferences(&study));
159 experiment->set_type(Study_Experiment_Type_IGNORE_CHANGE); 141 experiment->set_type(Study_Experiment_Type_IGNORE_CHANGE);
160 EXPECT_EQ("0 0 0", SimulateStudyDifferences(&study)); 142 EXPECT_EQ("0 0 0", SimulateStudyDifferences(&study));
161 experiment->set_type(Study_Experiment_Type_KILL_BEST_EFFORT); 143 experiment->set_type(Study_Experiment_Type_KILL_BEST_EFFORT);
162 EXPECT_EQ("0 0 0", SimulateStudyDifferences(&study)); 144 EXPECT_EQ("0 0 0", SimulateStudyDifferences(&study));
163 experiment->set_type(Study_Experiment_Type_KILL_CRITICAL); 145 experiment->set_type(Study_Experiment_Type_KILL_CRITICAL);
164 EXPECT_EQ("0 0 0", SimulateStudyDifferences(&study)); 146 EXPECT_EQ("0 0 0", SimulateStudyDifferences(&study));
165 } 147 }
166 148
167 TEST_F(VariationsSeedSimulatorTest, PermanentGroupChange) { 149 TEST_F(VariationsSeedSimulatorTest, PermanentGroupChange) {
168 CreateTrial("A", "B", NULL); 150 CreateTrial("A", "B", nullptr);
169 151
170 Study study = CreateStudy("A", Study_Consistency_PERMANENT); 152 Study study = CreateStudy("A", Study_Consistency_PERMANENT);
171 Study_Experiment* experiment = AddExperiment("C", 100, &study); 153 Study_Experiment* experiment = AddExperiment("C", 100, &study);
172 154
173 EXPECT_EQ("1 0 0", SimulateStudyDifferences(&study)); 155 EXPECT_EQ("1 0 0", SimulateStudyDifferences(&study));
174 156
175 // Changing "C" group type should not affect the type of change. (Since the 157 // Changing "C" group type should not affect the type of change. (Since the
176 // type is evaluated for the "old" group.) 158 // type is evaluated for the "old" group.)
177 experiment->set_type(Study_Experiment_Type_NORMAL); 159 experiment->set_type(Study_Experiment_Type_NORMAL);
178 EXPECT_EQ("1 0 0", SimulateStudyDifferences(&study)); 160 EXPECT_EQ("1 0 0", SimulateStudyDifferences(&study));
179 experiment->set_type(Study_Experiment_Type_IGNORE_CHANGE); 161 experiment->set_type(Study_Experiment_Type_IGNORE_CHANGE);
180 EXPECT_EQ("1 0 0", SimulateStudyDifferences(&study)); 162 EXPECT_EQ("1 0 0", SimulateStudyDifferences(&study));
181 experiment->set_type(Study_Experiment_Type_KILL_BEST_EFFORT); 163 experiment->set_type(Study_Experiment_Type_KILL_BEST_EFFORT);
182 EXPECT_EQ("1 0 0", SimulateStudyDifferences(&study)); 164 EXPECT_EQ("1 0 0", SimulateStudyDifferences(&study));
183 experiment->set_type(Study_Experiment_Type_KILL_CRITICAL); 165 experiment->set_type(Study_Experiment_Type_KILL_CRITICAL);
184 EXPECT_EQ("1 0 0", SimulateStudyDifferences(&study)); 166 EXPECT_EQ("1 0 0", SimulateStudyDifferences(&study));
185 } 167 }
186 168
169 TEST_F(VariationsSeedSimulatorTest, PermanentGroupChangeDueToExperimentID) {
170 CreateTrial("A", "B", nullptr);
171 CreateTrial("X", "Y", nullptr);
172
173 Study study = CreateStudy("A", Study_Consistency_PERMANENT);
174 Study_Experiment* experiment_b = AddExperiment("B", 50, &study);
175 AddExperiment("Default", 50, &study);
176
177 EXPECT_EQ("0 0 0", SimulateStudyDifferences(&study));
178
179 // Adding a google_web_experiment_id will cause the low entropy provider to be
180 // used, causing a group change.
181 experiment_b->set_google_web_experiment_id(1234);
182 EXPECT_EQ("1 0 0", SimulateStudyDifferences(&study));
183 }
184
187 TEST_F(VariationsSeedSimulatorTest, PermanentExpired) { 185 TEST_F(VariationsSeedSimulatorTest, PermanentExpired) {
188 CreateTrial("A", "B", NULL); 186 CreateTrial("A", "B", nullptr);
189 187
190 Study study = CreateStudy("A", Study_Consistency_PERMANENT); 188 Study study = CreateStudy("A", Study_Consistency_PERMANENT);
191 Study_Experiment* experiment = AddExperiment("B", 1, &study); 189 Study_Experiment* experiment = AddExperiment("B", 1, &study);
192 AddExperiment("C", 0, &study); 190 AddExperiment("C", 0, &study);
193 191
194 // There should be a difference because the study is expired, which should 192 // There should be a difference because the study is expired, which should
195 // result in the default group "C" being chosen. 193 // result in the default group "C" being chosen.
196 EXPECT_EQ("1 0 0", SimulateStudyDifferencesExpired(&study)); 194 EXPECT_EQ("1 0 0", SimulateStudyDifferencesExpired(&study));
197 195
198 experiment->set_type(Study_Experiment_Type_NORMAL); 196 experiment->set_type(Study_Experiment_Type_NORMAL);
199 EXPECT_EQ("1 0 0", SimulateStudyDifferencesExpired(&study)); 197 EXPECT_EQ("1 0 0", SimulateStudyDifferencesExpired(&study));
200 experiment->set_type(Study_Experiment_Type_IGNORE_CHANGE); 198 experiment->set_type(Study_Experiment_Type_IGNORE_CHANGE);
201 EXPECT_EQ("0 0 0", SimulateStudyDifferencesExpired(&study)); 199 EXPECT_EQ("0 0 0", SimulateStudyDifferencesExpired(&study));
202 experiment->set_type(Study_Experiment_Type_KILL_BEST_EFFORT); 200 experiment->set_type(Study_Experiment_Type_KILL_BEST_EFFORT);
203 EXPECT_EQ("0 1 0", SimulateStudyDifferencesExpired(&study)); 201 EXPECT_EQ("0 1 0", SimulateStudyDifferencesExpired(&study));
204 experiment->set_type(Study_Experiment_Type_KILL_CRITICAL); 202 experiment->set_type(Study_Experiment_Type_KILL_CRITICAL);
205 EXPECT_EQ("0 0 1", SimulateStudyDifferencesExpired(&study)); 203 EXPECT_EQ("0 0 1", SimulateStudyDifferencesExpired(&study));
206 } 204 }
207 205
208 TEST_F(VariationsSeedSimulatorTest, SessionRandomized) { 206 TEST_F(VariationsSeedSimulatorTest, SessionRandomized) {
209 CreateTrial("A", "B", NULL); 207 CreateTrial("A", "B", nullptr);
210 208
211 Study study = CreateStudy("A", Study_Consistency_SESSION); 209 Study study = CreateStudy("A", Study_Consistency_SESSION);
212 Study_Experiment* experiment = AddExperiment("B", 1, &study); 210 Study_Experiment* experiment = AddExperiment("B", 1, &study);
213 AddExperiment("C", 1, &study); 211 AddExperiment("C", 1, &study);
214 AddExperiment("D", 1, &study); 212 AddExperiment("D", 1, &study);
215 213
216 // There should be no differences, since a session randomized study can result 214 // There should be no differences, since a session randomized study can result
217 // in any of the groups being chosen on startup. 215 // in any of the groups being chosen on startup.
218 EXPECT_EQ("0 0 0", SimulateStudyDifferences(&study)); 216 EXPECT_EQ("0 0 0", SimulateStudyDifferences(&study));
219 217
220 experiment->set_type(Study_Experiment_Type_NORMAL); 218 experiment->set_type(Study_Experiment_Type_NORMAL);
221 EXPECT_EQ("0 0 0", SimulateStudyDifferences(&study)); 219 EXPECT_EQ("0 0 0", SimulateStudyDifferences(&study));
222 experiment->set_type(Study_Experiment_Type_IGNORE_CHANGE); 220 experiment->set_type(Study_Experiment_Type_IGNORE_CHANGE);
223 EXPECT_EQ("0 0 0", SimulateStudyDifferences(&study)); 221 EXPECT_EQ("0 0 0", SimulateStudyDifferences(&study));
224 experiment->set_type(Study_Experiment_Type_KILL_BEST_EFFORT); 222 experiment->set_type(Study_Experiment_Type_KILL_BEST_EFFORT);
225 EXPECT_EQ("0 0 0", SimulateStudyDifferences(&study)); 223 EXPECT_EQ("0 0 0", SimulateStudyDifferences(&study));
226 experiment->set_type(Study_Experiment_Type_KILL_CRITICAL); 224 experiment->set_type(Study_Experiment_Type_KILL_CRITICAL);
227 EXPECT_EQ("0 0 0", SimulateStudyDifferences(&study)); 225 EXPECT_EQ("0 0 0", SimulateStudyDifferences(&study));
228 } 226 }
229 227
230 TEST_F(VariationsSeedSimulatorTest, SessionRandomizedGroupRemoved) { 228 TEST_F(VariationsSeedSimulatorTest, SessionRandomizedGroupRemoved) {
231 CreateTrial("A", "B", NULL); 229 CreateTrial("A", "B", nullptr);
232 230
233 Study study = CreateStudy("A", Study_Consistency_SESSION); 231 Study study = CreateStudy("A", Study_Consistency_SESSION);
234 AddExperiment("C", 1, &study); 232 AddExperiment("C", 1, &study);
235 AddExperiment("D", 1, &study); 233 AddExperiment("D", 1, &study);
236 234
237 // There should be a difference since there is no group "B" in the new config. 235 // There should be a difference since there is no group "B" in the new config.
238 EXPECT_EQ("1 0 0", SimulateStudyDifferences(&study)); 236 EXPECT_EQ("1 0 0", SimulateStudyDifferences(&study));
239 } 237 }
240 238
241 TEST_F(VariationsSeedSimulatorTest, SessionRandomizedGroupProbabilityZero) { 239 TEST_F(VariationsSeedSimulatorTest, SessionRandomizedGroupProbabilityZero) {
242 CreateTrial("A", "B", NULL); 240 CreateTrial("A", "B", nullptr);
243 241
244 Study study = CreateStudy("A", Study_Consistency_SESSION); 242 Study study = CreateStudy("A", Study_Consistency_SESSION);
245 Study_Experiment* experiment = AddExperiment("B", 0, &study); 243 Study_Experiment* experiment = AddExperiment("B", 0, &study);
246 AddExperiment("C", 1, &study); 244 AddExperiment("C", 1, &study);
247 AddExperiment("D", 1, &study); 245 AddExperiment("D", 1, &study);
248 246
249 // There should be a difference since group "B" has probability 0. 247 // There should be a difference since group "B" has probability 0.
250 EXPECT_EQ("1 0 0", SimulateStudyDifferences(&study)); 248 EXPECT_EQ("1 0 0", SimulateStudyDifferences(&study));
251 249
252 experiment->set_type(Study_Experiment_Type_NORMAL); 250 experiment->set_type(Study_Experiment_Type_NORMAL);
253 EXPECT_EQ("1 0 0", SimulateStudyDifferences(&study)); 251 EXPECT_EQ("1 0 0", SimulateStudyDifferences(&study));
254 experiment->set_type(Study_Experiment_Type_IGNORE_CHANGE); 252 experiment->set_type(Study_Experiment_Type_IGNORE_CHANGE);
255 EXPECT_EQ("0 0 0", SimulateStudyDifferences(&study)); 253 EXPECT_EQ("0 0 0", SimulateStudyDifferences(&study));
256 experiment->set_type(Study_Experiment_Type_KILL_BEST_EFFORT); 254 experiment->set_type(Study_Experiment_Type_KILL_BEST_EFFORT);
257 EXPECT_EQ("0 1 0", SimulateStudyDifferences(&study)); 255 EXPECT_EQ("0 1 0", SimulateStudyDifferences(&study));
258 experiment->set_type(Study_Experiment_Type_KILL_CRITICAL); 256 experiment->set_type(Study_Experiment_Type_KILL_CRITICAL);
259 EXPECT_EQ("0 0 1", SimulateStudyDifferences(&study)); 257 EXPECT_EQ("0 0 1", SimulateStudyDifferences(&study));
260 } 258 }
261 259
262 TEST_F(VariationsSeedSimulatorTest, SessionRandomizedExpired) { 260 TEST_F(VariationsSeedSimulatorTest, SessionRandomizedExpired) {
263 CreateTrial("A", "B", NULL); 261 CreateTrial("A", "B", nullptr);
264 262
265 Study study = CreateStudy("A", Study_Consistency_SESSION); 263 Study study = CreateStudy("A", Study_Consistency_SESSION);
266 Study_Experiment* experiment = AddExperiment("B", 1, &study); 264 Study_Experiment* experiment = AddExperiment("B", 1, &study);
267 AddExperiment("C", 1, &study); 265 AddExperiment("C", 1, &study);
268 AddExperiment("D", 1, &study); 266 AddExperiment("D", 1, &study);
269 267
270 // There should be a difference because the study is expired, which should 268 // There should be a difference because the study is expired, which should
271 // result in the default group "D" being chosen. 269 // result in the default group "D" being chosen.
272 EXPECT_EQ("1 0 0", SimulateStudyDifferencesExpired(&study)); 270 EXPECT_EQ("1 0 0", SimulateStudyDifferencesExpired(&study));
273 271
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 EXPECT_EQ("1 0 0", SimulateStudyDifferences(&study)); 350 EXPECT_EQ("1 0 0", SimulateStudyDifferences(&study));
353 experiment->set_type(Study_Experiment_Type_IGNORE_CHANGE); 351 experiment->set_type(Study_Experiment_Type_IGNORE_CHANGE);
354 EXPECT_EQ("0 0 0", SimulateStudyDifferences(&study)); 352 EXPECT_EQ("0 0 0", SimulateStudyDifferences(&study));
355 experiment->set_type(Study_Experiment_Type_KILL_BEST_EFFORT); 353 experiment->set_type(Study_Experiment_Type_KILL_BEST_EFFORT);
356 EXPECT_EQ("0 1 0", SimulateStudyDifferences(&study)); 354 EXPECT_EQ("0 1 0", SimulateStudyDifferences(&study));
357 experiment->set_type(Study_Experiment_Type_KILL_CRITICAL); 355 experiment->set_type(Study_Experiment_Type_KILL_CRITICAL);
358 EXPECT_EQ("0 0 1", SimulateStudyDifferences(&study)); 356 EXPECT_EQ("0 0 1", SimulateStudyDifferences(&study));
359 } 357 }
360 358
361 TEST_F(VariationsSeedSimulatorTest, ParamsAdded) { 359 TEST_F(VariationsSeedSimulatorTest, ParamsAdded) {
362 CreateTrial("A", "B", NULL); 360 CreateTrial("A", "B", nullptr);
363 361
364 std::vector<ProcessedStudy> processed_studies; 362 std::vector<ProcessedStudy> processed_studies;
365 Study study = CreateStudy("A", Study_Consistency_PERMANENT); 363 Study study = CreateStudy("A", Study_Consistency_PERMANENT);
366 Study_Experiment* experiment = AddExperiment("B", 100, &study); 364 Study_Experiment* experiment = AddExperiment("B", 100, &study);
367 AddExperimentParam("p2", "y", experiment); 365 AddExperimentParam("p2", "y", experiment);
368 AddExperimentParam("p1", "x", experiment); 366 AddExperimentParam("p1", "x", experiment);
369 AddExperimentParam("p3", "z", experiment); 367 AddExperimentParam("p3", "z", experiment);
370 368
371 // The current group has no params, but the config has added some. 369 // The current group has no params, but the config has added some.
372 EXPECT_EQ("1 0 0", SimulateStudyDifferences(&study)); 370 EXPECT_EQ("1 0 0", SimulateStudyDifferences(&study));
373 371
374 experiment->set_type(Study_Experiment_Type_NORMAL); 372 experiment->set_type(Study_Experiment_Type_NORMAL);
375 EXPECT_EQ("1 0 0", SimulateStudyDifferences(&study)); 373 EXPECT_EQ("1 0 0", SimulateStudyDifferences(&study));
376 experiment->set_type(Study_Experiment_Type_IGNORE_CHANGE); 374 experiment->set_type(Study_Experiment_Type_IGNORE_CHANGE);
377 EXPECT_EQ("0 0 0", SimulateStudyDifferences(&study)); 375 EXPECT_EQ("0 0 0", SimulateStudyDifferences(&study));
378 experiment->set_type(Study_Experiment_Type_KILL_BEST_EFFORT); 376 experiment->set_type(Study_Experiment_Type_KILL_BEST_EFFORT);
379 EXPECT_EQ("0 1 0", SimulateStudyDifferences(&study)); 377 EXPECT_EQ("0 1 0", SimulateStudyDifferences(&study));
380 experiment->set_type(Study_Experiment_Type_KILL_CRITICAL); 378 experiment->set_type(Study_Experiment_Type_KILL_CRITICAL);
381 EXPECT_EQ("0 0 1", SimulateStudyDifferences(&study)); 379 EXPECT_EQ("0 0 1", SimulateStudyDifferences(&study));
382 } 380 }
383 381
384 } // namespace variations 382 } // namespace variations
OLDNEW
« no previous file with comments | « components/variations/variations_seed_simulator.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698