OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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_PROCESSOR_H_ | 5 #ifndef COMPONENTS_VARIATIONS_VARIATIONS_SEED_PROCESSOR_H_ |
6 #define COMPONENTS_VARIATIONS_VARIATIONS_SEED_PROCESSOR_H_ | 6 #define COMPONENTS_VARIATIONS_VARIATIONS_SEED_PROCESSOR_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 18 matching lines...) Expand all Loading... |
29 // Creates field trials from the specified variations |seed|, based on the | 29 // Creates field trials from the specified variations |seed|, based on the |
30 // specified configuration (locale, current date, version and channel). | 30 // specified configuration (locale, current date, version and channel). |
31 void CreateTrialsFromSeed(const VariationsSeed& seed, | 31 void CreateTrialsFromSeed(const VariationsSeed& seed, |
32 const std::string& locale, | 32 const std::string& locale, |
33 const base::Time& reference_date, | 33 const base::Time& reference_date, |
34 const base::Version& version, | 34 const base::Version& version, |
35 Study_Channel channel, | 35 Study_Channel channel, |
36 Study_FormFactor form_factor); | 36 Study_FormFactor form_factor); |
37 | 37 |
38 private: | 38 private: |
| 39 FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest, |
| 40 AllowForceGroupAndVariationId); |
| 41 FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest, |
| 42 AllowVariationIdWithForcingFlag); |
39 FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest, CheckStudyChannel); | 43 FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest, CheckStudyChannel); |
40 FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest, CheckStudyFormFactor); | 44 FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest, CheckStudyFormFactor); |
41 FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest, CheckStudyLocale); | 45 FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest, CheckStudyLocale); |
42 FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest, CheckStudyPlatform); | 46 FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest, CheckStudyPlatform); |
43 FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest, CheckStudyStartDate); | 47 FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest, CheckStudyStartDate); |
44 FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest, CheckStudyVersion); | 48 FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest, CheckStudyVersion); |
45 FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest, | 49 FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest, |
46 FilterAndValidateStudies); | 50 FilterAndValidateStudies); |
| 51 FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest, |
| 52 ForbidForceGroupWithVariationId); |
47 FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest, ForceGroupWithFlag1); | 53 FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest, ForceGroupWithFlag1); |
48 FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest, ForceGroupWithFlag2); | 54 FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest, ForceGroupWithFlag2); |
49 FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest, | 55 FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest, |
50 ForceGroup_ChooseFirstGroupWithFlag); | 56 ForceGroup_ChooseFirstGroupWithFlag); |
51 FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest, | 57 FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest, |
52 ForceGroup_DontChooseGroupWithFlag); | 58 ForceGroup_DontChooseGroupWithFlag); |
53 FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest, IsStudyExpired); | 59 FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest, IsStudyExpired); |
54 FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest, ValidateStudy); | 60 FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest, ValidateStudy); |
55 FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest, VariationParams); | 61 FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest, VariationParams); |
56 FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest, | 62 FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest, |
57 VariationParamsWithForcingFlag); | 63 VariationParamsWithForcingFlag); |
58 | 64 |
| 65 // Check if the |study| is only associated with platform Android/iOS and |
| 66 // channel dev/canary. If so, forcing flag and variation id can both be set. |
| 67 // (Otherwise, forcing_flag and variation_id are mutually exclusive.) |
| 68 bool AllowVariationIdWithForcingFlag(const Study& study); |
| 69 |
59 // Filters the list of studies in |seed| and validates and pre-processes them, | 70 // Filters the list of studies in |seed| and validates and pre-processes them, |
60 // adding any kept studies to |filtered_studies| list. Ensures that the | 71 // adding any kept studies to |filtered_studies| list. Ensures that the |
61 // resulting list will not have more than one study with the same name. | 72 // resulting list will not have more than one study with the same name. |
62 void FilterAndValidateStudies(const VariationsSeed& seed, | 73 void FilterAndValidateStudies(const VariationsSeed& seed, |
63 const std::string& locale, | 74 const std::string& locale, |
64 const base::Time& reference_date, | 75 const base::Time& reference_date, |
65 const base::Version& version, | 76 const base::Version& version, |
66 Study_Channel channel, | 77 Study_Channel channel, |
67 Study_FormFactor form_factor, | 78 Study_FormFactor form_factor, |
68 std::vector<ProcessedStudy>* filtered_studies); | 79 std::vector<ProcessedStudy>* filtered_studies); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 bool ValidateStudyAndComputeTotalProbability( | 128 bool ValidateStudyAndComputeTotalProbability( |
118 const Study& study, | 129 const Study& study, |
119 base::FieldTrial::Probability* total_probability); | 130 base::FieldTrial::Probability* total_probability); |
120 | 131 |
121 DISALLOW_COPY_AND_ASSIGN(VariationsSeedProcessor); | 132 DISALLOW_COPY_AND_ASSIGN(VariationsSeedProcessor); |
122 }; | 133 }; |
123 | 134 |
124 } // namespace chrome_variations | 135 } // namespace chrome_variations |
125 | 136 |
126 #endif // COMPONENTS_VARIATIONS_VARIATIONS_SEED_PROCESSOR_H_ | 137 #endif // COMPONENTS_VARIATIONS_VARIATIONS_SEED_PROCESSOR_H_ |
OLD | NEW |