| OLD | NEW |
| 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 <map> | 7 #include <map> |
| 8 | 8 |
| 9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
| 10 #include "components/variations/processed_study.h" | 10 #include "components/variations/processed_study.h" |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 return param; | 78 return param; |
| 79 } | 79 } |
| 80 | 80 |
| 81 } // namespace | 81 } // namespace |
| 82 | 82 |
| 83 class VariationsSeedSimulatorTest : public ::testing::Test { | 83 class VariationsSeedSimulatorTest : public ::testing::Test { |
| 84 public: | 84 public: |
| 85 VariationsSeedSimulatorTest() : field_trial_list_(NULL) { | 85 VariationsSeedSimulatorTest() : field_trial_list_(NULL) { |
| 86 } | 86 } |
| 87 | 87 |
| 88 virtual ~VariationsSeedSimulatorTest() { | 88 ~VariationsSeedSimulatorTest() override { |
| 89 // Ensure that the maps are cleared between tests, since they are stored as | 89 // Ensure that the maps are cleared between tests, since they are stored as |
| 90 // process singletons. | 90 // process singletons. |
| 91 testing::ClearAllVariationIDs(); | 91 testing::ClearAllVariationIDs(); |
| 92 testing::ClearAllVariationParams(); | 92 testing::ClearAllVariationParams(); |
| 93 } | 93 } |
| 94 | 94 |
| 95 // Uses a VariationsSeedSimulator to simulate the differences between | 95 // Uses a VariationsSeedSimulator to simulate the differences between |
| 96 // |studies| and the current field trial state. | 96 // |studies| and the current field trial state. |
| 97 VariationsSeedSimulator::Result SimulateDifferences( | 97 VariationsSeedSimulator::Result SimulateDifferences( |
| 98 const std::vector<ProcessedStudy>& studies) { | 98 const std::vector<ProcessedStudy>& studies) { |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 372 EXPECT_EQ("1 0 0", SimulateStudyDifferences(&study)); | 372 EXPECT_EQ("1 0 0", SimulateStudyDifferences(&study)); |
| 373 experiment->set_type(Study_Experiment_Type_IGNORE_CHANGE); | 373 experiment->set_type(Study_Experiment_Type_IGNORE_CHANGE); |
| 374 EXPECT_EQ("0 0 0", SimulateStudyDifferences(&study)); | 374 EXPECT_EQ("0 0 0", SimulateStudyDifferences(&study)); |
| 375 experiment->set_type(Study_Experiment_Type_KILL_BEST_EFFORT); | 375 experiment->set_type(Study_Experiment_Type_KILL_BEST_EFFORT); |
| 376 EXPECT_EQ("0 1 0", SimulateStudyDifferences(&study)); | 376 EXPECT_EQ("0 1 0", SimulateStudyDifferences(&study)); |
| 377 experiment->set_type(Study_Experiment_Type_KILL_CRITICAL); | 377 experiment->set_type(Study_Experiment_Type_KILL_CRITICAL); |
| 378 EXPECT_EQ("0 0 1", SimulateStudyDifferences(&study)); | 378 EXPECT_EQ("0 0 1", SimulateStudyDifferences(&study)); |
| 379 } | 379 } |
| 380 | 380 |
| 381 } // namespace variations | 381 } // namespace variations |
| OLD | NEW |