#include "components/variations/active_field_trials.h"
#include <stddef.h>
#include <string_view>
#include <vector>
#include "base/command_line.h"
#include "base/containers/contains.h"
#include "base/metrics/field_trial.h"
#include "base/no_destructor.h"
#include "base/process/launch.h"
#include "base/ranges/algorithm.h"
#include "base/strings/strcat.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "components/variations/hashing.h"
#include "components/variations/synthetic_trials_active_group_id_provider.h"
#include "components/variations/variations_switches.h"
namespace variations {
namespace {
std::string& GetSeedVersionInternal() { … }
void AppendActiveGroupIdsAsStrings(
const std::vector<ActiveGroupId> name_group_ids,
std::vector<std::string>* output) { … }
uint32_t HashNameAndSuffix(std::string_view base_name,
std::string_view optional_suffix) { … }
uint32_t HashNameAndSuffix(std::string_view base_name,
std::string_view optional_suffix,
std::string_view optional_suffix2) { … }
ActiveGroupId MakeActiveGroupIdWithSuffix(std::string_view trial_name,
std::string_view group_name,
std::string_view optional_suffix,
bool is_overridden) { … }
}
ActiveGroupId MakeActiveGroupId(std::string_view trial_name,
std::string_view group_name) { … }
ActiveGroupId MakeActiveGroupId(std::string_view trial_name,
std::string_view group_name,
bool is_overridden) { … }
void GetFieldTrialActiveGroupIdsForActiveGroups(
std::string_view suffix,
const base::FieldTrial::ActiveGroups& active_groups,
std::vector<ActiveGroupId>* name_group_ids) { … }
void GetFieldTrialActiveGroupIds(std::string_view suffix,
std::vector<ActiveGroupId>* name_group_ids) { … }
void GetFieldTrialActiveGroupIds(
std::string_view suffix,
const base::FieldTrial::ActiveGroups& active_groups,
std::vector<ActiveGroupId>* name_group_ids) { … }
void GetFieldTrialActiveGroupIdsAsStrings(std::string_view suffix,
std::vector<std::string>* output) { … }
void GetFieldTrialActiveGroupIdsAsStrings(
std::string_view suffix,
const base::FieldTrial::ActiveGroups& active_groups,
std::vector<std::string>* output) { … }
void GetSyntheticTrialGroupIdsAsString(std::vector<std::string>* output) { … }
bool HasSyntheticTrial(const std::string& trial_name) { … }
bool IsInSyntheticTrialGroup(const std::string& trial_name,
const std::string& trial_group) { … }
void SetSeedVersion(const std::string& seed_version) { … }
const std::string& GetSeedVersion() { … }
#if BUILDFLAG(USE_BLINK)
void PopulateLaunchOptionsWithVariationsInfo(
#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_APPLE)
base::GlobalDescriptors::Key descriptor_key,
base::ScopedFD& descriptor_to_share,
#endif
base::CommandLine* command_line,
base::LaunchOptions* launch_options) { … }
#endif
namespace testing {
void TestGetFieldTrialActiveGroupIds(
std::string_view suffix,
const base::FieldTrial::ActiveGroups& active_groups,
std::vector<ActiveGroupId>* name_group_ids) { … }
}
}