#include "components/flags_ui/flags_test_helpers.h"
#include <gtest/gtest.h>
#include <map>
#include <string>
#include <string_view>
#include <vector>
#include "base/base_paths.h"
#include "base/containers/contains.h"
#include "base/files/file_path.h"
#include "base/json/json_file_value_serializer.h"
#include "base/path_service.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/values.h"
#include "components/flags_ui/feature_entry.h"
#include "components/flags_ui/flags_state.h"
namespace {
constexpr char kMetadataFileName[] = …;
constexpr char kNeverExpireFileName[] = …;
base::Value ReadFileContentsAsJSON(const std::string& filename) { … }
struct FlagMetadataEntry { … };
FlagMetadataMap;
FlagMetadataMap LoadFlagMetadata() { … }
std::vector<std::string> LoadFlagNeverExpireList() { … }
bool IsValidLookingOwner(std::string_view owner) { … }
std::string NormalizeName(const std::string& name) { … }
constexpr char kStartSentinel[] = …;
NameNameMap;
NameVector;
NameNameMap BuildAfterMap(const NameVector& strings) { … }
std::pair<NameVector, NameNameMap> NormalizeNames(const NameVector& names) { … }
void EnsureNamesAreAlphabetical(const NameVector& names,
const std::string& filename) { … }
bool IsUnexpireFlagFor(const flags_ui::FeatureEntry& entry, int milestone) { … }
}
namespace flags_ui {
namespace testing {
void EnsureEveryFlagHasMetadata(
const base::span<const flags_ui::FeatureEntry>& entries) { … }
void EnsureOnlyPermittedFlagsNeverExpire() { … }
void EnsureEveryFlagHasNonEmptyOwners() { … }
void EnsureOwnersLookValid() { … }
void EnsureFlagsAreListedInAlphabeticalOrder() { … }
void EnsureRecentUnexpireFlagsArePresent(
const base::span<const flags_ui::FeatureEntry>& entries,
int current_milestone) { … }
}
}