| 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_ASSOCIATED_DATA_H_ | 5 #ifndef COMPONENTS_VARIATIONS_VARIATIONS_ASSOCIATED_DATA_H_ |
| 6 #define COMPONENTS_VARIATIONS_VARIATIONS_ASSOCIATED_DATA_H_ | 6 #define COMPONENTS_VARIATIONS_VARIATIONS_ASSOCIATED_DATA_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 // field trial being marked as active if found (i.e. group() will be called on | 146 // field trial being marked as active if found (i.e. group() will be called on |
| 147 // it), if it wasn't already. Currently, this information is only available from | 147 // it), if it wasn't already. Currently, this information is only available from |
| 148 // the browser process. Thread safe. | 148 // the browser process. Thread safe. |
| 149 std::string GetVariationParamValue(const std::string& trial_name, | 149 std::string GetVariationParamValue(const std::string& trial_name, |
| 150 const std::string& param_name); | 150 const std::string& param_name); |
| 151 | 151 |
| 152 // Retrieves a specific parameter value corresponding to |param_name| for the | 152 // Retrieves a specific parameter value corresponding to |param_name| for the |
| 153 // variation associated with the specified |feature|. A feature is associated | 153 // variation associated with the specified |feature|. A feature is associated |
| 154 // with at most one variation, through the variation's associated field trial, | 154 // with at most one variation, through the variation's associated field trial, |
| 155 // and selected group. See base/feature_list.h for more information on | 155 // and selected group. See base/feature_list.h for more information on |
| 156 // features. If the feature is not enabled, or if there's no associated | 156 // features. If the feature is not enabled, or the specified parameter does not |
| 157 // variation params, returns false and does not modify |params|. Calling this | 157 // exist, returns an empty string.Calling this function will result in the |
| 158 // function will result in the associated field trial being marked as active if | 158 // associated field trial being marked as active if found (i.e. group() will be |
| 159 // found (i.e. group() will be called on it), if it wasn't already. Currently, | 159 // called on it), if it wasn't already. Currently, this information is only |
| 160 // this information is only available from the browser process. Thread safe. | 160 // available from the browser process. Thread safe. |
| 161 std::string GetVariationParamValueByFeature(const base::Feature& feature, | 161 std::string GetVariationParamValueByFeature(const base::Feature& feature, |
| 162 const std::string& param_name); | 162 const std::string& param_name); |
| 163 | 163 |
| 164 // Expose some functions for testing. | 164 // Expose some functions for testing. |
| 165 namespace testing { | 165 namespace testing { |
| 166 | 166 |
| 167 // Use this class as a member in your test class to set variation params for | 167 // Use this class as a member in your test class to set variation params for |
| 168 // your tests. You can directly set the parameters in the constructor (if they | 168 // your tests. You can directly set the parameters in the constructor (if they |
| 169 // are used by other members upon construction). You can change them later | 169 // are used by other members upon construction). You can change them later |
| 170 // arbitrarily many times using the SetVariationParams function. Internally, it | 170 // arbitrarily many times using the SetVariationParams function. Internally, it |
| (...skipping 22 matching lines...) Expand all Loading... |
| 193 void ClearAllVariationIDs(); | 193 void ClearAllVariationIDs(); |
| 194 | 194 |
| 195 // Clears all of the associated params. | 195 // Clears all of the associated params. |
| 196 void ClearAllVariationParams(); | 196 void ClearAllVariationParams(); |
| 197 | 197 |
| 198 } // namespace testing | 198 } // namespace testing |
| 199 | 199 |
| 200 } // namespace variations | 200 } // namespace variations |
| 201 | 201 |
| 202 #endif // COMPONENTS_VARIATIONS_VARIATIONS_ASSOCIATED_DATA_H_ | 202 #endif // COMPONENTS_VARIATIONS_VARIATIONS_ASSOCIATED_DATA_H_ |
| OLD | NEW |