chromium/components/policy/core/common/config_dir_policy_loader_unittest.cc

// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#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 {

// Subdirectory of the config dir that contains mandatory policies.
const base::FilePath::CharType kMandatoryPath[] =);
// The policy input supports trailing comma and c++ styled comments.
const char PolicyWithQuirks[] =;

#if !BUILDFLAG(IS_CHROMEOS)
const char PrecedencePolicies[] =;
#endif  // BUILDFLAG(IS_CHROMEOS)

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() {}

// static
PolicyProviderTestHarness* TestHarness::Create() {}

}  // namespace

// Instantiate abstract test case for basic policy reading tests.
INSTANTIATE_TEST_SUITE_P();

// Instantiate abstract test case for 3rd party policy reading tests.
INSTANTIATE_TEST_SUITE_P();

// Some tests that exercise special functionality in ConfigDirPolicyLoader.
class ConfigDirPolicyLoaderTest : public PolicyTestBase {};

// The preferences dictionary is expected to be empty when there are no files to
// load.
TEST_F(ConfigDirPolicyLoaderTest, ReadPrefsEmpty) {}

// Reading from a non-existent directory should result in an empty preferences
// dictionary.
TEST_F(ConfigDirPolicyLoaderTest, ReadPrefsNonExistentDirectory) {}

TEST_F(ConfigDirPolicyLoaderTest, ReadPrefsWithComments) {}

// Test merging values from different files.
TEST_F(ConfigDirPolicyLoaderTest, ReadPrefsMergePrefs) {}

#if !BUILDFLAG(IS_CHROMEOS)
TEST_F(ConfigDirPolicyLoaderTest, LoadPrecedencePolicies) {}
#endif  // BUILDFLAG(IS_CHROMEOS)

}  // namespace policy