Index: components/variations/variations_associated_data.cc |
diff --git a/components/variations/variations_associated_data.cc b/components/variations/variations_associated_data.cc |
index 9aa51d379f3d884a094d208d621e0d4eaacbe7f8..9532121d7047c7d9b7ffa2a3458af8db714f665f 100644 |
--- a/components/variations/variations_associated_data.cc |
+++ b/components/variations/variations_associated_data.cc |
@@ -11,11 +11,15 @@ |
#include "base/feature_list.h" |
#include "base/macros.h" |
#include "base/memory/singleton.h" |
+#include "components/variations/entropy_provider.h" |
namespace variations { |
namespace { |
+const char kGroupTesting[] = "Testing"; |
+const char kEntropy[] = "test-entropy-seed"; |
+ |
// The internal singleton accessor for the map, used to keep it thread-safe. |
class GroupMapAccessor { |
public: |
@@ -252,6 +256,27 @@ std::string GetVariationParamValueByFeature(const base::Feature& feature, |
// They simply wrap existing functions in this file. |
namespace testing { |
+VariationParamsManager::VariationParamsManager( |
+ const std::string& trial_name, |
+ const std::map<std::string, std::string>& params) { |
+ SetVariationParams(trial_name, params); |
+} |
+ |
+VariationParamsManager::~VariationParamsManager() { |
+ ClearAllVariationIDs(); |
+ ClearAllVariationParams(); |
+ field_trial_list_.reset(); |
+} |
+ |
+void VariationParamsManager::SetVariationParams( |
+ const std::string& trial_name, |
+ const std::map<std::string, std::string>& params) { |
+ field_trial_list_.reset( |
+ new base::FieldTrialList(new metrics::SHA1EntropyProvider(kEntropy))); |
Alexei Svitkine (slow)
2016/07/15 14:51:01
You can just pass nullptr here.
jkrcal
2016/07/18 13:09:01
Done.
|
+ variations::AssociateVariationParams(trial_name, kGroupTesting, params); |
+ base::FieldTrialList::CreateFieldTrial(trial_name, kGroupTesting); |
+} |
+ |
void ClearAllVariationIDs() { |
GroupMapAccessor::GetInstance()->ClearAllMapsForTesting(); |
} |