| 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 #ifndef COMPONENTS_VARIATIONS_VARIATIONS_SEED_SIMULATOR_H_ | 5 #ifndef COMPONENTS_VARIATIONS_VARIATIONS_SEED_SIMULATOR_H_ |
| 6 #define COMPONENTS_VARIATIONS_VARIATIONS_SEED_SIMULATOR_H_ | 6 #define COMPONENTS_VARIATIONS_VARIATIONS_SEED_SIMULATOR_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/metrics/field_trial.h" | 13 #include "base/metrics/field_trial.h" |
| 14 #include "base/version.h" | 14 #include "base/version.h" |
| 15 #include "components/variations/proto/study.pb.h" | 15 #include "components/variations/proto/study.pb.h" |
| 16 #include "components/variations/proto/variations_seed.pb.h" | 16 #include "components/variations/proto/variations_seed.pb.h" |
| 17 | 17 |
| 18 namespace variations { | 18 namespace variations { |
| 19 | 19 |
| 20 class ProcessedStudy; | 20 class ProcessedStudy; |
| 21 struct ClientFilterableState; |
| 21 class VariationsSeed; | 22 class VariationsSeed; |
| 22 | 23 |
| 23 // VariationsSeedSimulator simulates the result of creating a set of studies | 24 // VariationsSeedSimulator simulates the result of creating a set of studies |
| 24 // and detecting which studies would result in group changes. | 25 // and detecting which studies would result in group changes. |
| 25 class VariationsSeedSimulator { | 26 class VariationsSeedSimulator { |
| 26 public: | 27 public: |
| 27 // The result of variations seed simulation, counting the number of experiment | 28 // The result of variations seed simulation, counting the number of experiment |
| 28 // group changes of each type that are expected to occur on a restart with the | 29 // group changes of each type that are expected to occur on a restart with the |
| 29 // seed. | 30 // seed. |
| 30 struct Result { | 31 struct Result { |
| (...skipping 21 matching lines...) Expand all Loading... |
| 52 VariationsSeedSimulator( | 53 VariationsSeedSimulator( |
| 53 const base::FieldTrial::EntropyProvider& default_entropy_provider, | 54 const base::FieldTrial::EntropyProvider& default_entropy_provider, |
| 54 const base::FieldTrial::EntropyProvider& low_entropy_provider); | 55 const base::FieldTrial::EntropyProvider& low_entropy_provider); |
| 55 virtual ~VariationsSeedSimulator(); | 56 virtual ~VariationsSeedSimulator(); |
| 56 | 57 |
| 57 // Computes differences between the current process' field trial state and | 58 // Computes differences between the current process' field trial state and |
| 58 // the result of evaluating |seed| with the given parameters. Returns the | 59 // the result of evaluating |seed| with the given parameters. Returns the |
| 59 // results of the simulation as a set of expected group change counts of each | 60 // results of the simulation as a set of expected group change counts of each |
| 60 // type. | 61 // type. |
| 61 Result SimulateSeedStudies(const VariationsSeed& seed, | 62 Result SimulateSeedStudies(const VariationsSeed& seed, |
| 62 const std::string& locale, | 63 const ClientFilterableState& client_state); |
| 63 const base::Time& reference_date, | |
| 64 const base::Version& version, | |
| 65 Study_Channel channel, | |
| 66 Study_FormFactor form_factor, | |
| 67 const std::string& hardware_class, | |
| 68 const std::string& session_consistency_country, | |
| 69 const std::string& permanent_consistency_country); | |
| 70 | 64 |
| 71 private: | 65 private: |
| 72 friend class VariationsSeedSimulatorTest; | 66 friend class VariationsSeedSimulatorTest; |
| 73 | 67 |
| 74 enum ChangeType { | 68 enum ChangeType { |
| 75 NO_CHANGE, | 69 NO_CHANGE, |
| 76 CHANGED, | 70 CHANGED, |
| 77 CHANGED_KILL_BEST_EFFORT, | 71 CHANGED_KILL_BEST_EFFORT, |
| 78 CHANGED_KILL_CRITICAL, | 72 CHANGED_KILL_CRITICAL, |
| 79 }; | 73 }; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 104 | 98 |
| 105 const base::FieldTrial::EntropyProvider& default_entropy_provider_; | 99 const base::FieldTrial::EntropyProvider& default_entropy_provider_; |
| 106 const base::FieldTrial::EntropyProvider& low_entropy_provider_; | 100 const base::FieldTrial::EntropyProvider& low_entropy_provider_; |
| 107 | 101 |
| 108 DISALLOW_COPY_AND_ASSIGN(VariationsSeedSimulator); | 102 DISALLOW_COPY_AND_ASSIGN(VariationsSeedSimulator); |
| 109 }; | 103 }; |
| 110 | 104 |
| 111 } // namespace variations | 105 } // namespace variations |
| 112 | 106 |
| 113 #endif // COMPONENTS_VARIATIONS_VARIATIONS_SEED_SIMULATOR_H_ | 107 #endif // COMPONENTS_VARIATIONS_VARIATIONS_SEED_SIMULATOR_H_ |
| OLD | NEW |