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

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
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 } 69 }
90 70
91 ~VariationsSeedSimulatorTest() override { 71 ~VariationsSeedSimulatorTest() override {
92 // Ensure that the maps are cleared between tests, since they are stored as 72 // Ensure that the maps are cleared between tests, since they are stored as
93 // process singletons. 73 // process singletons.
94 testing::ClearAllVariationIDs(); 74 testing::ClearAllVariationIDs();
95 testing::ClearAllVariationParams(); 75 testing::ClearAllVariationParams();
96 } 76 }
97 77
98 // Uses a VariationsSeedSimulator to simulate the differences between 78 // Uses a VariationsSeedSimulator to simulate the differences between
99 // |studies| and the current field trial state. 79 // |studies| and the current field trial state.
100 VariationsSeedSimulator::Result SimulateDifferences( 80 VariationsSeedSimulator::Result SimulateDifferences(
101 const std::vector<ProcessedStudy>& studies) { 81 const std::vector<ProcessedStudy>& studies) {
102 TestEntropyProvider provider(0.5); 82 // Should pick the first group that has non-zero probability weight.
103 VariationsSeedSimulator seed_simulator(provider); 83 base::MockEntropyProvider default_provider;
84 default_provider.set_entropy_value(0);
85 // Should pick default groups, if they have non-zero probability weight.
86 base::MockEntropyProvider low_provider;
87 low_provider.set_entropy_value(1.0 - 1e-8);
88 VariationsSeedSimulator seed_simulator(default_provider, low_provider);
104 return seed_simulator.ComputeDifferences(studies); 89 return seed_simulator.ComputeDifferences(studies);
105 } 90 }
106 91
107 // Simulates the differences between |study| and the current field trial 92 // 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 93 // 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 94 // group changes, 2 is the number of "kill best effort" group changes and 3
110 // is the number of "kill critical" group changes. 95 // is the number of "kill critical" group changes.
111 std::string SimulateStudyDifferences(const Study* study) { 96 std::string SimulateStudyDifferences(const Study* study) {
112 std::vector<ProcessedStudy> studies; 97 std::vector<ProcessedStudy> studies;
113 if (!ProcessedStudy::ValidateAndAppendStudy(study, false, &studies)) 98 if (!ProcessedStudy::ValidateAndAppendStudy(study, false, &studies))
(...skipping 25 matching lines...) Expand all
139 result.kill_critical_group_change_count); 124 result.kill_critical_group_change_count);
140 } 125 }
141 126
142 private: 127 private:
143 base::FieldTrialList field_trial_list_; 128 base::FieldTrialList field_trial_list_;
144 129
145 DISALLOW_COPY_AND_ASSIGN(VariationsSeedSimulatorTest); 130 DISALLOW_COPY_AND_ASSIGN(VariationsSeedSimulatorTest);
146 }; 131 };
147 132
148 TEST_F(VariationsSeedSimulatorTest, PermanentNoChanges) { 133 TEST_F(VariationsSeedSimulatorTest, PermanentNoChanges) {
149 CreateTrial("A", "B", NULL); 134 CreateTrial("A", "B", nullptr);
150 135
151 std::vector<ProcessedStudy> processed_studies; 136 std::vector<ProcessedStudy> processed_studies;
152 Study study = CreateStudy("A", Study_Consistency_PERMANENT); 137 Study study = CreateStudy("A", Study_Consistency_PERMANENT);
153 Study_Experiment* experiment = AddExperiment("B", 100, &study); 138 Study_Experiment* experiment = AddExperiment("B", 100, &study);
154 139
155 EXPECT_EQ("0 0 0", SimulateStudyDifferences(&study)); 140 EXPECT_EQ("0 0 0", SimulateStudyDifferences(&study));
156 141
157 experiment->set_type(Study_Experiment_Type_NORMAL); 142 experiment->set_type(Study_Experiment_Type_NORMAL);
158 EXPECT_EQ("0 0 0", SimulateStudyDifferences(&study)); 143 EXPECT_EQ("0 0 0", SimulateStudyDifferences(&study));
159 experiment->set_type(Study_Experiment_Type_IGNORE_CHANGE); 144 experiment->set_type(Study_Experiment_Type_IGNORE_CHANGE);
160 EXPECT_EQ("0 0 0", SimulateStudyDifferences(&study)); 145 EXPECT_EQ("0 0 0", SimulateStudyDifferences(&study));
161 experiment->set_type(Study_Experiment_Type_KILL_BEST_EFFORT); 146 experiment->set_type(Study_Experiment_Type_KILL_BEST_EFFORT);
162 EXPECT_EQ("0 0 0", SimulateStudyDifferences(&study)); 147 EXPECT_EQ("0 0 0", SimulateStudyDifferences(&study));
163 experiment->set_type(Study_Experiment_Type_KILL_CRITICAL); 148 experiment->set_type(Study_Experiment_Type_KILL_CRITICAL);
164 EXPECT_EQ("0 0 0", SimulateStudyDifferences(&study)); 149 EXPECT_EQ("0 0 0", SimulateStudyDifferences(&study));
165 } 150 }
166 151
167 TEST_F(VariationsSeedSimulatorTest, PermanentGroupChange) { 152 TEST_F(VariationsSeedSimulatorTest, PermanentGroupChange) {
168 CreateTrial("A", "B", NULL); 153 CreateTrial("A", "B", nullptr);
169 154
170 Study study = CreateStudy("A", Study_Consistency_PERMANENT); 155 Study study = CreateStudy("A", Study_Consistency_PERMANENT);
171 Study_Experiment* experiment = AddExperiment("C", 100, &study); 156 Study_Experiment* experiment = AddExperiment("C", 100, &study);
172 157
173 EXPECT_EQ("1 0 0", SimulateStudyDifferences(&study)); 158 EXPECT_EQ("1 0 0", SimulateStudyDifferences(&study));
174 159
175 // Changing "C" group type should not affect the type of change. (Since the 160 // Changing "C" group type should not affect the type of change. (Since the
176 // type is evaluated for the "old" group.) 161 // type is evaluated for the "old" group.)
177 experiment->set_type(Study_Experiment_Type_NORMAL); 162 experiment->set_type(Study_Experiment_Type_NORMAL);
178 EXPECT_EQ("1 0 0", SimulateStudyDifferences(&study)); 163 EXPECT_EQ("1 0 0", SimulateStudyDifferences(&study));
179 experiment->set_type(Study_Experiment_Type_IGNORE_CHANGE); 164 experiment->set_type(Study_Experiment_Type_IGNORE_CHANGE);
180 EXPECT_EQ("1 0 0", SimulateStudyDifferences(&study)); 165 EXPECT_EQ("1 0 0", SimulateStudyDifferences(&study));
181 experiment->set_type(Study_Experiment_Type_KILL_BEST_EFFORT); 166 experiment->set_type(Study_Experiment_Type_KILL_BEST_EFFORT);
182 EXPECT_EQ("1 0 0", SimulateStudyDifferences(&study)); 167 EXPECT_EQ("1 0 0", SimulateStudyDifferences(&study));
183 experiment->set_type(Study_Experiment_Type_KILL_CRITICAL); 168 experiment->set_type(Study_Experiment_Type_KILL_CRITICAL);
184 EXPECT_EQ("1 0 0", SimulateStudyDifferences(&study)); 169 EXPECT_EQ("1 0 0", SimulateStudyDifferences(&study));
185 } 170 }
186 171
172 TEST_F(VariationsSeedSimulatorTest, PermanentGroupChangeDueToExperimentID) {
173 CreateTrial("A", "B", nullptr);
174 CreateTrial("X", "Y", nullptr);
175
176 Study study = CreateStudy("A", Study_Consistency_PERMANENT);
177 Study_Experiment* experiment_b = AddExperiment("B", 50, &study);
178 AddExperiment("Default", 50, &study);
179
180 EXPECT_EQ("0 0 0", SimulateStudyDifferences(&study));
181
182 // Adding a google_web_experiment_id will cause the low entropy provider to be
183 // used, causing a group change.
184 experiment_b->set_google_web_experiment_id(1234);
185 EXPECT_EQ("1 0 0", SimulateStudyDifferences(&study));
186 }
187
187 TEST_F(VariationsSeedSimulatorTest, PermanentExpired) { 188 TEST_F(VariationsSeedSimulatorTest, PermanentExpired) {
188 CreateTrial("A", "B", NULL); 189 CreateTrial("A", "B", nullptr);
189 190
190 Study study = CreateStudy("A", Study_Consistency_PERMANENT); 191 Study study = CreateStudy("A", Study_Consistency_PERMANENT);
191 Study_Experiment* experiment = AddExperiment("B", 1, &study); 192 Study_Experiment* experiment = AddExperiment("B", 1, &study);
192 AddExperiment("C", 0, &study); 193 AddExperiment("C", 0, &study);
193 194
194 // There should be a difference because the study is expired, which should 195 // There should be a difference because the study is expired, which should
195 // result in the default group "C" being chosen. 196 // result in the default group "C" being chosen.
196 EXPECT_EQ("1 0 0", SimulateStudyDifferencesExpired(&study)); 197 EXPECT_EQ("1 0 0", SimulateStudyDifferencesExpired(&study));
197 198
198 experiment->set_type(Study_Experiment_Type_NORMAL); 199 experiment->set_type(Study_Experiment_Type_NORMAL);
199 EXPECT_EQ("1 0 0", SimulateStudyDifferencesExpired(&study)); 200 EXPECT_EQ("1 0 0", SimulateStudyDifferencesExpired(&study));
200 experiment->set_type(Study_Experiment_Type_IGNORE_CHANGE); 201 experiment->set_type(Study_Experiment_Type_IGNORE_CHANGE);
201 EXPECT_EQ("0 0 0", SimulateStudyDifferencesExpired(&study)); 202 EXPECT_EQ("0 0 0", SimulateStudyDifferencesExpired(&study));
202 experiment->set_type(Study_Experiment_Type_KILL_BEST_EFFORT); 203 experiment->set_type(Study_Experiment_Type_KILL_BEST_EFFORT);
203 EXPECT_EQ("0 1 0", SimulateStudyDifferencesExpired(&study)); 204 EXPECT_EQ("0 1 0", SimulateStudyDifferencesExpired(&study));
204 experiment->set_type(Study_Experiment_Type_KILL_CRITICAL); 205 experiment->set_type(Study_Experiment_Type_KILL_CRITICAL);
205 EXPECT_EQ("0 0 1", SimulateStudyDifferencesExpired(&study)); 206 EXPECT_EQ("0 0 1", SimulateStudyDifferencesExpired(&study));
206 } 207 }
207 208
208 TEST_F(VariationsSeedSimulatorTest, SessionRandomized) { 209 TEST_F(VariationsSeedSimulatorTest, SessionRandomized) {
209 CreateTrial("A", "B", NULL); 210 CreateTrial("A", "B", nullptr);
210 211
211 Study study = CreateStudy("A", Study_Consistency_SESSION); 212 Study study = CreateStudy("A", Study_Consistency_SESSION);
212 Study_Experiment* experiment = AddExperiment("B", 1, &study); 213 Study_Experiment* experiment = AddExperiment("B", 1, &study);
213 AddExperiment("C", 1, &study); 214 AddExperiment("C", 1, &study);
214 AddExperiment("D", 1, &study); 215 AddExperiment("D", 1, &study);
215 216
216 // There should be no differences, since a session randomized study can result 217 // There should be no differences, since a session randomized study can result
217 // in any of the groups being chosen on startup. 218 // in any of the groups being chosen on startup.
218 EXPECT_EQ("0 0 0", SimulateStudyDifferences(&study)); 219 EXPECT_EQ("0 0 0", SimulateStudyDifferences(&study));
219 220
220 experiment->set_type(Study_Experiment_Type_NORMAL); 221 experiment->set_type(Study_Experiment_Type_NORMAL);
221 EXPECT_EQ("0 0 0", SimulateStudyDifferences(&study)); 222 EXPECT_EQ("0 0 0", SimulateStudyDifferences(&study));
222 experiment->set_type(Study_Experiment_Type_IGNORE_CHANGE); 223 experiment->set_type(Study_Experiment_Type_IGNORE_CHANGE);
223 EXPECT_EQ("0 0 0", SimulateStudyDifferences(&study)); 224 EXPECT_EQ("0 0 0", SimulateStudyDifferences(&study));
224 experiment->set_type(Study_Experiment_Type_KILL_BEST_EFFORT); 225 experiment->set_type(Study_Experiment_Type_KILL_BEST_EFFORT);
225 EXPECT_EQ("0 0 0", SimulateStudyDifferences(&study)); 226 EXPECT_EQ("0 0 0", SimulateStudyDifferences(&study));
226 experiment->set_type(Study_Experiment_Type_KILL_CRITICAL); 227 experiment->set_type(Study_Experiment_Type_KILL_CRITICAL);
227 EXPECT_EQ("0 0 0", SimulateStudyDifferences(&study)); 228 EXPECT_EQ("0 0 0", SimulateStudyDifferences(&study));
228 } 229 }
229 230
230 TEST_F(VariationsSeedSimulatorTest, SessionRandomizedGroupRemoved) { 231 TEST_F(VariationsSeedSimulatorTest, SessionRandomizedGroupRemoved) {
231 CreateTrial("A", "B", NULL); 232 CreateTrial("A", "B", nullptr);
232 233
233 Study study = CreateStudy("A", Study_Consistency_SESSION); 234 Study study = CreateStudy("A", Study_Consistency_SESSION);
234 AddExperiment("C", 1, &study); 235 AddExperiment("C", 1, &study);
235 AddExperiment("D", 1, &study); 236 AddExperiment("D", 1, &study);
236 237
237 // There should be a difference since there is no group "B" in the new config. 238 // There should be a difference since there is no group "B" in the new config.
238 EXPECT_EQ("1 0 0", SimulateStudyDifferences(&study)); 239 EXPECT_EQ("1 0 0", SimulateStudyDifferences(&study));
239 } 240 }
240 241
241 TEST_F(VariationsSeedSimulatorTest, SessionRandomizedGroupProbabilityZero) { 242 TEST_F(VariationsSeedSimulatorTest, SessionRandomizedGroupProbabilityZero) {
242 CreateTrial("A", "B", NULL); 243 CreateTrial("A", "B", nullptr);
243 244
244 Study study = CreateStudy("A", Study_Consistency_SESSION); 245 Study study = CreateStudy("A", Study_Consistency_SESSION);
245 Study_Experiment* experiment = AddExperiment("B", 0, &study); 246 Study_Experiment* experiment = AddExperiment("B", 0, &study);
246 AddExperiment("C", 1, &study); 247 AddExperiment("C", 1, &study);
247 AddExperiment("D", 1, &study); 248 AddExperiment("D", 1, &study);
248 249
249 // There should be a difference since group "B" has probability 0. 250 // There should be a difference since group "B" has probability 0.
250 EXPECT_EQ("1 0 0", SimulateStudyDifferences(&study)); 251 EXPECT_EQ("1 0 0", SimulateStudyDifferences(&study));
251 252
252 experiment->set_type(Study_Experiment_Type_NORMAL); 253 experiment->set_type(Study_Experiment_Type_NORMAL);
253 EXPECT_EQ("1 0 0", SimulateStudyDifferences(&study)); 254 EXPECT_EQ("1 0 0", SimulateStudyDifferences(&study));
254 experiment->set_type(Study_Experiment_Type_IGNORE_CHANGE); 255 experiment->set_type(Study_Experiment_Type_IGNORE_CHANGE);
255 EXPECT_EQ("0 0 0", SimulateStudyDifferences(&study)); 256 EXPECT_EQ("0 0 0", SimulateStudyDifferences(&study));
256 experiment->set_type(Study_Experiment_Type_KILL_BEST_EFFORT); 257 experiment->set_type(Study_Experiment_Type_KILL_BEST_EFFORT);
257 EXPECT_EQ("0 1 0", SimulateStudyDifferences(&study)); 258 EXPECT_EQ("0 1 0", SimulateStudyDifferences(&study));
258 experiment->set_type(Study_Experiment_Type_KILL_CRITICAL); 259 experiment->set_type(Study_Experiment_Type_KILL_CRITICAL);
259 EXPECT_EQ("0 0 1", SimulateStudyDifferences(&study)); 260 EXPECT_EQ("0 0 1", SimulateStudyDifferences(&study));
260 } 261 }
261 262
262 TEST_F(VariationsSeedSimulatorTest, SessionRandomizedExpired) { 263 TEST_F(VariationsSeedSimulatorTest, SessionRandomizedExpired) {
263 CreateTrial("A", "B", NULL); 264 CreateTrial("A", "B", nullptr);
264 265
265 Study study = CreateStudy("A", Study_Consistency_SESSION); 266 Study study = CreateStudy("A", Study_Consistency_SESSION);
266 Study_Experiment* experiment = AddExperiment("B", 1, &study); 267 Study_Experiment* experiment = AddExperiment("B", 1, &study);
267 AddExperiment("C", 1, &study); 268 AddExperiment("C", 1, &study);
268 AddExperiment("D", 1, &study); 269 AddExperiment("D", 1, &study);
269 270
270 // There should be a difference because the study is expired, which should 271 // There should be a difference because the study is expired, which should
271 // result in the default group "D" being chosen. 272 // result in the default group "D" being chosen.
272 EXPECT_EQ("1 0 0", SimulateStudyDifferencesExpired(&study)); 273 EXPECT_EQ("1 0 0", SimulateStudyDifferencesExpired(&study));
273 274
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 EXPECT_EQ("1 0 0", SimulateStudyDifferences(&study)); 353 EXPECT_EQ("1 0 0", SimulateStudyDifferences(&study));
353 experiment->set_type(Study_Experiment_Type_IGNORE_CHANGE); 354 experiment->set_type(Study_Experiment_Type_IGNORE_CHANGE);
354 EXPECT_EQ("0 0 0", SimulateStudyDifferences(&study)); 355 EXPECT_EQ("0 0 0", SimulateStudyDifferences(&study));
355 experiment->set_type(Study_Experiment_Type_KILL_BEST_EFFORT); 356 experiment->set_type(Study_Experiment_Type_KILL_BEST_EFFORT);
356 EXPECT_EQ("0 1 0", SimulateStudyDifferences(&study)); 357 EXPECT_EQ("0 1 0", SimulateStudyDifferences(&study));
357 experiment->set_type(Study_Experiment_Type_KILL_CRITICAL); 358 experiment->set_type(Study_Experiment_Type_KILL_CRITICAL);
358 EXPECT_EQ("0 0 1", SimulateStudyDifferences(&study)); 359 EXPECT_EQ("0 0 1", SimulateStudyDifferences(&study));
359 } 360 }
360 361
361 TEST_F(VariationsSeedSimulatorTest, ParamsAdded) { 362 TEST_F(VariationsSeedSimulatorTest, ParamsAdded) {
362 CreateTrial("A", "B", NULL); 363 CreateTrial("A", "B", nullptr);
363 364
364 std::vector<ProcessedStudy> processed_studies; 365 std::vector<ProcessedStudy> processed_studies;
365 Study study = CreateStudy("A", Study_Consistency_PERMANENT); 366 Study study = CreateStudy("A", Study_Consistency_PERMANENT);
366 Study_Experiment* experiment = AddExperiment("B", 100, &study); 367 Study_Experiment* experiment = AddExperiment("B", 100, &study);
367 AddExperimentParam("p2", "y", experiment); 368 AddExperimentParam("p2", "y", experiment);
368 AddExperimentParam("p1", "x", experiment); 369 AddExperimentParam("p1", "x", experiment);
369 AddExperimentParam("p3", "z", experiment); 370 AddExperimentParam("p3", "z", experiment);
370 371
371 // The current group has no params, but the config has added some. 372 // The current group has no params, but the config has added some.
372 EXPECT_EQ("1 0 0", SimulateStudyDifferences(&study)); 373 EXPECT_EQ("1 0 0", SimulateStudyDifferences(&study));
373 374
374 experiment->set_type(Study_Experiment_Type_NORMAL); 375 experiment->set_type(Study_Experiment_Type_NORMAL);
375 EXPECT_EQ("1 0 0", SimulateStudyDifferences(&study)); 376 EXPECT_EQ("1 0 0", SimulateStudyDifferences(&study));
376 experiment->set_type(Study_Experiment_Type_IGNORE_CHANGE); 377 experiment->set_type(Study_Experiment_Type_IGNORE_CHANGE);
377 EXPECT_EQ("0 0 0", SimulateStudyDifferences(&study)); 378 EXPECT_EQ("0 0 0", SimulateStudyDifferences(&study));
378 experiment->set_type(Study_Experiment_Type_KILL_BEST_EFFORT); 379 experiment->set_type(Study_Experiment_Type_KILL_BEST_EFFORT);
379 EXPECT_EQ("0 1 0", SimulateStudyDifferences(&study)); 380 EXPECT_EQ("0 1 0", SimulateStudyDifferences(&study));
380 experiment->set_type(Study_Experiment_Type_KILL_CRITICAL); 381 experiment->set_type(Study_Experiment_Type_KILL_CRITICAL);
381 EXPECT_EQ("0 0 1", SimulateStudyDifferences(&study)); 382 EXPECT_EQ("0 0 1", SimulateStudyDifferences(&study));
382 } 383 }
383 384
384 } // namespace variations 385 } // namespace variations
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698