#include "components/policy/core/common/config_dir_policy_loader.h"
#include <memory>
#include <utility>
#include "base/compiler_specific.h"
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "base/json/json_string_value_serializer.h"
#include "base/memory/ref_counted.h"
#include "base/strings/string_number_conversions.h"
#include "base/task/sequenced_task_runner.h"
#include "base/values.h"
#include "components/policy/core/common/async_policy_provider.h"
#include "components/policy/core/common/configuration_policy_provider_test.h"
#include "components/policy/core/common/policy_bundle.h"
#include "components/policy/core/common/policy_map.h"
#include "components/policy/core/common/policy_namespace.h"
#include "components/policy/core/common/policy_types.h"
#include "components/policy/policy_constants.h"
#include "components/strings/grit/components_strings.h"
namespace policy {
namespace {
const base::FilePath::CharType kMandatoryPath[] = …);
const char PolicyWithQuirks[] = …;
#if !BUILDFLAG(IS_CHROMEOS)
const char PrecedencePolicies[] = …;
#endif
class TestHarness : public PolicyProviderTestHarness { … };
TestHarness::TestHarness()
: … { … }
TestHarness::~TestHarness() = default;
void TestHarness::SetUp() { … }
ConfigurationPolicyProvider* TestHarness::CreateProvider(
SchemaRegistry* registry,
scoped_refptr<base::SequencedTaskRunner> task_runner) { … }
void TestHarness::InstallEmptyPolicy() { … }
void TestHarness::InstallStringPolicy(const std::string& policy_name,
const std::string& policy_value) { … }
void TestHarness::InstallIntegerPolicy(const std::string& policy_name,
int policy_value) { … }
void TestHarness::InstallBooleanPolicy(const std::string& policy_name,
bool policy_value) { … }
void TestHarness::InstallStringListPolicy(
const std::string& policy_name,
const base::Value::List& policy_value) { … }
void TestHarness::InstallDictionaryPolicy(
const std::string& policy_name,
const base::Value::Dict& policy_value) { … }
void TestHarness::Install3rdPartyPolicy(const base::Value::Dict& policies) { … }
void TestHarness::WriteConfigFile(const base::Value::Dict& dict,
const std::string& file_name) { … }
void TestHarness::WriteConfigFile(const std::string& data,
const std::string& file_name) { … }
std::string TestHarness::NextConfigFileName() { … }
PolicyProviderTestHarness* TestHarness::Create() { … }
}
INSTANTIATE_TEST_SUITE_P(…);
INSTANTIATE_TEST_SUITE_P(…);
class ConfigDirPolicyLoaderTest : public PolicyTestBase { … };
TEST_F(ConfigDirPolicyLoaderTest, ReadPrefsEmpty) { … }
TEST_F(ConfigDirPolicyLoaderTest, ReadPrefsNonExistentDirectory) { … }
TEST_F(ConfigDirPolicyLoaderTest, ReadPrefsWithComments) { … }
TEST_F(ConfigDirPolicyLoaderTest, ReadPrefsMergePrefs) { … }
#if !BUILDFLAG(IS_CHROMEOS)
TEST_F(ConfigDirPolicyLoaderTest, LoadPrecedencePolicies) { … }
#endif
}