field_trial_util.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. // Copyright 2014 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef COMPONENTS_VARIATIONS_FIELD_TRIAL_CONFIG_FIELD_TRIAL_UTIL_H_
  5. #define COMPONENTS_VARIATIONS_FIELD_TRIAL_CONFIG_FIELD_TRIAL_UTIL_H_
  6. #include <string>
  7. #include "components/variations/proto/study.pb.h"
  8. #include "components/variations/variations_seed_processor.h"
  9. namespace base {
  10. class FeatureList;
  11. }
  12. namespace variations {
  13. struct FieldTrialTestingConfig;
  14. // Unescapes special characters from the given string.
  15. std::string UnescapeValue(const std::string& value);
  16. // Escapes the trial name, or parameter name, or parameter value in a way that
  17. // makes it usable within variations::switches::kForceFieldTrialParams.
  18. std::string EscapeValue(const std::string& value);
  19. // Provides a mechanism to associate multiple set of params to multiple groups
  20. // with a formatted string specified from commandline. See
  21. // kForceFieldTrialParams in components/variations/variations_switches.cc for
  22. // more details on the formatting.
  23. bool AssociateParamsFromString(const std::string& variations_string);
  24. // Provides a mechanism to associate multiple set of params and features to
  25. // multiple groups with the |config| struct. This will also force the selection
  26. // of FieldTrial groups specified in the |config|. Registers features associated
  27. // with default field trials with |feature_list|.
  28. void AssociateParamsFromFieldTrialConfig(
  29. const FieldTrialTestingConfig& config,
  30. const VariationsSeedProcessor::UIStringOverrideCallback& callback,
  31. Study::Platform platform,
  32. Study::FormFactor current_form_factor,
  33. base::FeatureList* feature_list);
  34. // Associates params and features to FieldTrial groups and forces the selection
  35. // of groups specified in testing/variations/fieldtrial_testing_config.json.
  36. // Registers features associated with default field trials with |feature_list|.
  37. void AssociateDefaultFieldTrialConfig(
  38. const VariationsSeedProcessor::UIStringOverrideCallback& callback,
  39. Study::Platform platform,
  40. Study::FormFactor current_form_factor,
  41. base::FeatureList* feature_list);
  42. } // namespace variations
  43. #endif // COMPONENTS_VARIATIONS_FIELD_TRIAL_CONFIG_FIELD_TRIAL_UTIL_H_