#include "base/test/scoped_feature_list.h"
#include <atomic>
#include <string_view>
#include <utility>
#include <vector>
#include "base/check_op.h"
#include "base/containers/contains.h"
#include "base/containers/flat_map.h"
#include "base/memory/ptr_util.h"
#include "base/metrics/field_trial_param_associator.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/test/mock_entropy_provider.h"
#include "base/test/task_environment.h"
namespace base {
namespace test {
struct ScopedFeatureList::FeatureWithStudyGroup { … };
struct ScopedFeatureList::Features { … };
namespace {
constexpr char kTrialGroup[] = …;
bool ParseEnableFeatures(const std::string& enable_features,
std::vector<ScopedFeatureList::FeatureWithStudyGroup>&
parsed_enable_features) { … }
std::string EscapeValue(const std::string& value) { … }
std::string_view GetFeatureName(std::string_view feature) { … }
bool ContainsFeature(
const std::vector<ScopedFeatureList::FeatureWithStudyGroup>& feature_vector,
std::string_view feature_name) { … }
void OverrideFeatures(
const std::vector<ScopedFeatureList::FeatureWithStudyGroup>& features_list,
FeatureList::OverrideState override_state,
ScopedFeatureList::Features* merged_features) { … }
void OverrideFeatures(const std::string& features_list,
FeatureList::OverrideState override_state,
ScopedFeatureList::Features* merged_features) { … }
std::string HexEncodeString(const std::string& input) { … }
std::string HexDecodeString(const std::string& input) { … }
std::string CreateCommandLineArgumentFromFeatureList(
const std::vector<ScopedFeatureList::FeatureWithStudyGroup>& feature_list,
bool enable_features) { … }
}
FeatureRefAndParams::FeatureRefAndParams(const Feature& feature,
const FieldTrialParams& params)
: … { … }
FeatureRefAndParams::FeatureRefAndParams(const FeatureRefAndParams& other) =
default;
FeatureRefAndParams::~FeatureRefAndParams() = default;
ScopedFeatureList::ScopedFeatureList() = default;
ScopedFeatureList::ScopedFeatureList(const Feature& enable_feature) { … }
ScopedFeatureList::~ScopedFeatureList() { … }
void ScopedFeatureList::Reset() { … }
void ScopedFeatureList::Init() { … }
void ScopedFeatureList::InitWithEmptyFeatureAndFieldTrialLists() { … }
void ScopedFeatureList::InitWithNullFeatureAndFieldTrialLists() { … }
void ScopedFeatureList::InitWithFeatureList(
std::unique_ptr<FeatureList> feature_list) { … }
void ScopedFeatureList::InitFromCommandLine(
const std::string& enable_features,
const std::string& disable_features) { … }
void ScopedFeatureList::InitWithFeatures(
const std::vector<FeatureRef>& enabled_features,
const std::vector<FeatureRef>& disabled_features) { … }
void ScopedFeatureList::InitAndEnableFeature(const Feature& feature) { … }
void ScopedFeatureList::InitAndDisableFeature(const Feature& feature) { … }
void ScopedFeatureList::InitWithFeatureState(const Feature& feature,
bool enabled) { … }
void ScopedFeatureList::InitWithFeatureStates(
const flat_map<FeatureRef, bool>& feature_states) { … }
void ScopedFeatureList::InitWithFeaturesImpl(
const std::vector<FeatureRef>& enabled_features,
const std::vector<FeatureRefAndParams>& enabled_features_and_params,
const std::vector<FeatureRef>& disabled_features,
bool keep_existing_states) { … }
void ScopedFeatureList::InitAndEnableFeatureWithParameters(
const Feature& feature,
const FieldTrialParams& feature_parameters) { … }
void ScopedFeatureList::InitWithFeaturesAndParameters(
const std::vector<FeatureRefAndParams>& enabled_features,
const std::vector<FeatureRef>& disabled_features) { … }
void ScopedFeatureList::InitWithMergedFeatures(
Features&& merged_features,
bool create_associated_field_trials,
bool keep_existing_states) { … }
}
}