OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef COMPONENTS_VARIATIONS_VARIATIONS_SEED_SIMULATOR_H_ | |
6 #define COMPONENTS_VARIATIONS_VARIATIONS_SEED_SIMULATOR_H_ | |
7 | |
8 #include <string> | |
9 #include <vector> | |
10 | |
11 #include "base/compiler_specific.h" | |
12 #include "base/gtest_prod_util.h" | |
13 #include "base/metrics/field_trial.h" | |
14 | |
15 namespace chrome_variations { | |
16 | |
17 class ProcessedStudy; | |
18 | |
19 // VariationsSeedSimulator simulates the result of creating a set of studies | |
20 // and detecting which studies would result in group changes. | |
21 class VariationsSeedSimulator { | |
22 public: | |
23 // Creates the simulator with the given entropy |provider|. | |
24 explicit VariationsSeedSimulator( | |
25 const base::FieldTrial::EntropyProvider& provider); | |
26 virtual ~VariationsSeedSimulator(); | |
27 | |
28 // Computes differences between the current process' field trial state and | |
29 // the result of evaluating the |processed_studies| list. It is expected that | |
30 // |processed_studies| have already been filtered and only contain studies | |
31 // that apply to the configuration being simulated. Returns the number of | |
32 // studies that are expected to change groups. | |
jwd
2014/01/07 18:31:37
small nit: Wording seems a bit imprecise. It's act
Alexei Svitkine (slow)
2014/01/08 15:17:35
Done.
| |
33 int ComputeDifferences( | |
34 const std::vector<ProcessedStudy>& processed_studies); | |
35 | |
36 private: | |
37 // For the given |processed_study| with PERMANENT consistency, simulates group | |
38 // assignment and returns true if the result differs from that study's group | |
39 // in the current process. | |
40 bool PermanentStudyGroupChanged(const ProcessedStudy& processed_study, | |
41 const std::string& selected_group); | |
42 | |
43 // For the given |processed_study| with SESSION consistency, determines if | |
44 // there are enough changes in the study config that restarting will result | |
45 // in a guaranteed different group assignment (or different params). | |
46 bool SessionStudyGroupChanged(const ProcessedStudy& filtered_study, | |
47 const std::string& selected_group); | |
48 | |
49 const base::FieldTrial::EntropyProvider& entropy_provider_; | |
50 | |
51 DISALLOW_COPY_AND_ASSIGN(VariationsSeedSimulator); | |
52 }; | |
53 | |
54 } // namespace chrome_variations | |
55 | |
56 #endif // COMPONENTS_VARIATIONS_VARIATIONS_SEED_SIMULATOR_H_ | |
OLD | NEW |