Chromium Code Reviews| 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 <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 33 class VariationsSeedProcessor { | 33 class VariationsSeedProcessor { |
| 34 public: | 34 public: |
| 35 typedef base::Callback<void(uint32_t, const base::string16&)> | 35 typedef base::Callback<void(uint32_t, const base::string16&)> |
| 36 UIStringOverrideCallback; | 36 UIStringOverrideCallback; |
| 37 | 37 |
| 38 VariationsSeedProcessor(); | 38 VariationsSeedProcessor(); |
| 39 virtual ~VariationsSeedProcessor(); | 39 virtual ~VariationsSeedProcessor(); |
| 40 | 40 |
| 41 // Creates field trials from the specified variations |seed|, based on the | 41 // Creates field trials from the specified variations |seed|, based on the |
| 42 // specified configuration, as specified in the parameters. | 42 // specified configuration, as specified in the parameters. |
| 43 void CreateTrialsFromSeed(const VariationsSeed& seed, | 43 void CreateTrialsFromSeed( |
| 44 const std::string& locale, | 44 const VariationsSeed& seed, |
| 45 const base::Time& reference_date, | 45 const std::string& locale, |
| 46 const base::Version& version, | 46 const base::Time& reference_date, |
| 47 Study_Channel channel, | 47 const base::Version& version, |
| 48 Study_FormFactor form_factor, | 48 Study_Channel channel, |
| 49 const std::string& hardware_class, | 49 Study_FormFactor form_factor, |
| 50 const std::string& session_consistency_country, | 50 const std::string& hardware_class, |
| 51 const std::string& permanent_consistency_country, | 51 const std::string& session_consistency_country, |
| 52 const UIStringOverrideCallback& override_callback, | 52 const std::string& permanent_consistency_country, |
| 53 base::FeatureList* feature_list); | 53 const UIStringOverrideCallback& override_callback, |
| 54 base::FeatureList* feature_list, | |
|
Alexei Svitkine (slow)
2016/05/18 15:03:30
Nit: This non-const param should be last.
jwd
2016/05/18 18:31:41
Done.
| |
| 55 const base::FieldTrial::EntropyProvider* low_entropy_provider); | |
| 56 | |
| 57 static bool ShouldStudyUseLowEntropy(const Study& study); | |
|
Alexei Svitkine (slow)
2016/05/18 15:03:31
Nit: Add a comment.
jwd
2016/05/18 18:31:41
Done.
| |
| 54 | 58 |
| 55 private: | 59 private: |
| 56 friend class VariationsSeedProcessorTest; | 60 friend class VariationsSeedProcessorTest; |
| 57 FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest, | 61 FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest, |
| 58 AllowForceGroupAndVariationId); | 62 AllowForceGroupAndVariationId); |
| 59 FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest, | 63 FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest, |
| 60 AllowVariationIdWithForcingFlag); | 64 AllowVariationIdWithForcingFlag); |
| 61 FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest, | 65 FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest, |
| 62 ForbidForceGroupWithVariationId); | 66 ForbidForceGroupWithVariationId); |
| 63 FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest, ForceGroupWithFlag1); | 67 FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest, ForceGroupWithFlag1); |
| 64 FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest, ForceGroupWithFlag2); | 68 FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest, ForceGroupWithFlag2); |
| 65 FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest, | 69 FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest, |
| 66 ForceGroup_ChooseFirstGroupWithFlag); | 70 ForceGroup_ChooseFirstGroupWithFlag); |
| 67 FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest, | 71 FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest, |
| 68 ForceGroup_DontChooseGroupWithFlag); | 72 ForceGroup_DontChooseGroupWithFlag); |
| 69 FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest, IsStudyExpired); | 73 FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest, IsStudyExpired); |
| 70 FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest, VariationParams); | 74 FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest, VariationParams); |
| 71 FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest, | 75 FRIEND_TEST_ALL_PREFIXES(VariationsSeedProcessorTest, |
| 72 VariationParamsWithForcingFlag); | 76 VariationParamsWithForcingFlag); |
| 73 | 77 |
| 74 // Check if the |study| is only associated with platform Android/iOS and | 78 // Check if the |study| is only associated with platform Android/iOS and |
| 75 // channel dev/canary. If so, forcing flag and variation id can both be set. | 79 // channel dev/canary. If so, forcing flag and variation id can both be set. |
| 76 // (Otherwise, forcing_flag and variation_id are mutually exclusive.) | 80 // (Otherwise, forcing_flag and variation_id are mutually exclusive.) |
| 77 bool AllowVariationIdWithForcingFlag(const Study& study); | 81 bool AllowVariationIdWithForcingFlag(const Study& study); |
| 78 | 82 |
| 79 // Creates and registers a field trial from the |processed_study| data. | 83 // Creates and registers a field trial from the |processed_study| data. |
| 80 // Disables the trial if |processed_study.is_expired| is true. | 84 // Disables the trial if |processed_study.is_expired| is true. Uses |
| 81 void CreateTrialFromStudy(const ProcessedStudy& processed_study, | 85 // |low_entropy_provider| if ShouldStudyUseLowEntropy returns true for the |
| 82 const UIStringOverrideCallback& override_callback, | 86 // study. |
|
Alexei Svitkine (slow)
2016/05/18 15:03:31
Nit: Add the same comment to CreateTrialsFromSeed(
jwd
2016/05/18 18:31:41
Done.
| |
| 83 base::FeatureList* feature_list); | 87 void CreateTrialFromStudy( |
| 88 const ProcessedStudy& processed_study, | |
| 89 const UIStringOverrideCallback& override_callback, | |
| 90 const base::FieldTrial::EntropyProvider* low_entropy_provider, | |
| 91 base::FeatureList* feature_list); | |
| 84 | 92 |
| 85 DISALLOW_COPY_AND_ASSIGN(VariationsSeedProcessor); | 93 DISALLOW_COPY_AND_ASSIGN(VariationsSeedProcessor); |
| 86 }; | 94 }; |
| 87 | 95 |
| 88 } // namespace variations | 96 } // namespace variations |
| 89 | 97 |
| 90 #endif // COMPONENTS_VARIATIONS_VARIATIONS_SEED_PROCESSOR_H_ | 98 #endif // COMPONENTS_VARIATIONS_VARIATIONS_SEED_PROCESSOR_H_ |
| OLD | NEW |