| 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 AllowForceGroupAndVariationIdWithoutCommandLine); |
| 41 FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest, |
| 42 AllowForceGroupAndVariationIdWithCommandLine); |
| 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 ForbidForceGroupWithVariationIdWithoutCommandLine); |
| 53 FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest, |
| 54 ForbidForceGroupWithVariationIdWithCommandLine); |
| 47 FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest, ForceGroupWithFlag1); | 55 FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest, ForceGroupWithFlag1); |
| 48 FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest, ForceGroupWithFlag2); | 56 FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest, ForceGroupWithFlag2); |
| 49 FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest, | 57 FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest, |
| 50 ForceGroup_ChooseFirstGroupWithFlag); | 58 ForceGroup_ChooseFirstGroupWithFlag); |
| 51 FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest, | 59 FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest, |
| 52 ForceGroup_DontChooseGroupWithFlag); | 60 ForceGroup_DontChooseGroupWithFlag); |
| 53 FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest, IsStudyExpired); | 61 FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest, IsStudyExpired); |
| 62 FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest, |
| 63 TestAllowVariationIdWithForcingFlag); |
| 54 FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest, ValidateStudy); | 64 FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest, ValidateStudy); |
| 55 FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest, VariationParams); | 65 FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest, VariationParams); |
| 56 FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest, | 66 FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest, |
| 57 VariationParamsWithForcingFlag); | 67 VariationParamsWithForcingFlag); |
| 58 | 68 |
| 69 // Check if the |study| is only associated with platform Android/iOS and |
| 70 // channel dev/canary. If so, forcing flag and variation id can both be set. |
| 71 // (Otherwise, forcing_flag and variation_id are mutually exclusive.) |
| 72 bool AllowVariationIdWithForcingFlag(const Study& study); |
| 73 |
| 59 // Filters the list of studies in |seed| and validates and pre-processes them, | 74 // 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 | 75 // 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. | 76 // resulting list will not have more than one study with the same name. |
| 62 void FilterAndValidateStudies(const VariationsSeed& seed, | 77 void FilterAndValidateStudies(const VariationsSeed& seed, |
| 63 const std::string& locale, | 78 const std::string& locale, |
| 64 const base::Time& reference_date, | 79 const base::Time& reference_date, |
| 65 const base::Version& version, | 80 const base::Version& version, |
| 66 Study_Channel channel, | 81 Study_Channel channel, |
| 67 Study_FormFactor form_factor, | 82 Study_FormFactor form_factor, |
| 68 std::vector<ProcessedStudy>* filtered_studies); | 83 std::vector<ProcessedStudy>* filtered_studies); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 bool ValidateStudyAndComputeTotalProbability( | 132 bool ValidateStudyAndComputeTotalProbability( |
| 118 const Study& study, | 133 const Study& study, |
| 119 base::FieldTrial::Probability* total_probability); | 134 base::FieldTrial::Probability* total_probability); |
| 120 | 135 |
| 121 DISALLOW_COPY_AND_ASSIGN(VariationsSeedProcessor); | 136 DISALLOW_COPY_AND_ASSIGN(VariationsSeedProcessor); |
| 122 }; | 137 }; |
| 123 | 138 |
| 124 } // namespace chrome_variations | 139 } // namespace chrome_variations |
| 125 | 140 |
| 126 #endif // COMPONENTS_VARIATIONS_VARIATIONS_SEED_PROCESSOR_H_ | 141 #endif // COMPONENTS_VARIATIONS_VARIATIONS_SEED_PROCESSOR_H_ |
| OLD | NEW |