Index: components/variations/variations_associated_data.h |
diff --git a/components/variations/variations_associated_data.h b/components/variations/variations_associated_data.h |
index 3eb9567cc3afe41848602b2fc9a2eabdaa00de77..1e3833b6b4720688359bef665871f122e30f5303 100644 |
--- a/components/variations/variations_associated_data.h |
+++ b/components/variations/variations_associated_data.h |
@@ -164,6 +164,29 @@ std::string GetVariationParamValueByFeature(const base::Feature& feature, |
// Expose some functions for testing. |
namespace testing { |
+// Use this class as a member in your test class to set variation params for |
+// your tests. You can directly set the parameters in the constructor (if they |
Alexei Svitkine (slow)
2016/07/15 14:51:01
Also mention that it creates a FieldTrialList as a
jkrcal
2016/07/18 13:09:01
Done.
|
+// are used by other members upon construction). You can change them later |
+// arbitrarily many times using the SetVariationParams function. The parameters |
+// are automatically cleared when this class is destructed so it works well for |
Alexei Svitkine (slow)
2016/07/15 14:51:01
Please make this sentence more precise to specify
jkrcal
2016/07/18 13:09:01
Done.
|
+// multiple tests of a given test class. |
+class VariationParamsManager { |
+ public: |
+ VariationParamsManager(const std::string& trial_name, |
+ const std::map<std::string, std::string>& params); |
+ |
Alexei Svitkine (slow)
2016/07/15 14:51:01
Nit: No need for empty line here.
jkrcal
2016/07/18 13:09:01
Done.
|
+ ~VariationParamsManager(); |
+ |
+ // Associates |params| with the given |trial_name|. It creates a new group, |
+ // used only for testing. Between two calls of this function, |
+ // ClearAllVariationParams() has to be called. |
+ void SetVariationParams(const std::string& trial_name, |
+ const std::map<std::string, std::string>& params); |
+ |
+ private: |
+ std::unique_ptr<base::FieldTrialList> field_trial_list_; |
+}; |
Alexei Svitkine (slow)
2016/07/15 14:51:01
DISALLOW_COPY_AND_ASSIGN()
jkrcal
2016/07/18 13:09:01
Done.
|
+ |
// Clears all of the mapped associations. |
void ClearAllVariationIDs(); |