#include "components/policy/core/browser/configuration_policy_handler.h"
#include <memory>
#include "base/check.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/json/json_reader.h"
#include "base/test/gmock_expected_support.h"
#include "base/values.h"
#include "components/policy/core/browser/configuration_policy_handler_parameters.h"
#include "components/policy/core/browser/policy_error_map.h"
#include "components/policy/core/common/policy_map.h"
#include "components/policy/core/common/policy_types.h"
#include "components/policy/core/common/schema.h"
#include "components/prefs/pref_value_map.h"
#include "testing/gmock/include/gmock/gmock.h"
namespace policy {
namespace {
const char kTestPolicy[] = …;
const char kTestPref[] = …;
const char kPolicyName[] = …;
constexpr char kValidationSchemaJson[] = …;
constexpr char kPolicyMapJsonValid[] = …;
constexpr char kPolicyMapJsonInvalid[] = …;
constexpr char kPolicyMapJsonUnparsable[] = …;
constexpr char kPolicyMapJsonWrongTypes[] = …;
constexpr char kPolicyMapJsonWrongRootType[] = …;
void GetIntegerTypeMap(
std::vector<std::unique_ptr<StringMappingListPolicyHandler::MappingEntry>>*
result) { … }
class TestSchemaValidatingPolicyHandler : public SchemaValidatingPolicyHandler { … };
class StringListPolicyHandler : public ListPolicyHandler { … };
std::unique_ptr<SimpleJsonStringSchemaValidatingPolicyHandler>
JsonStringHandlerForTesting() { … }
}
TEST(ListPolicyHandlerTest, CheckPolicySettings) { … }
TEST(StringListPolicyHandlerTest, ApplyPolicySettings) { … }
TEST(StringToIntEnumListPolicyHandlerTest, CheckPolicySettings) { … }
TEST(StringMappingListPolicyHandlerTest, ApplyPolicySettings) { … }
TEST(IntRangePolicyHandler, CheckPolicySettingsClamp) { … }
TEST(IntRangePolicyHandler, CheckPolicySettingsDontClamp) { … }
TEST(IntRangePolicyHandler, ApplyPolicySettingsClamp) { … }
TEST(IntRangePolicyHandler, ApplyPolicySettingsDontClamp) { … }
TEST(IntPercentageToDoublePolicyHandler, CheckPolicySettingsClamp) { … }
TEST(IntPercentageToDoublePolicyHandler, CheckPolicySettingsDontClamp) { … }
TEST(IntPercentageToDoublePolicyHandler, ApplyPolicySettingsClamp) { … }
TEST(IntPercentageToDoublePolicyHandler, ApplyPolicySettingsDontClamp) { … }
TEST(SchemaValidatingPolicyHandlerTest, CheckAndGetValueInvalid) { … }
TEST(SchemaValidatingPolicyHandlerTest, CheckAndGetValueUnknown) { … }
TEST(SimpleSchemaValidatingPolicyHandlerTest, CheckAndGetValue) { … }
TEST(SimpleJsonStringSchemaValidatingPolicyHandlerTest, ValidEmbeddedJson) { … }
TEST(SimpleJsonStringSchemaValidatingPolicyHandlerTest, InvalidEmbeddedJson) { … }
TEST(SimpleJsonStringSchemaValidatingPolicyHandlerTest, UnparsableJson) { … }
TEST(SimpleJsonStringSchemaValidatingPolicyHandlerTest, WrongType) { … }
TEST(SimpleJsonStringSchemaValidatingPolicyHandlerTest, WrongRootType) { … }
TEST(SimpleDeprecatingPolicyHandlerTest, CheckDeprecatedUsedWhenNoNewValue) { … }
TEST(URLPolicyHandler, CheckOnlyValidURLApplied) { … }
TEST(CloudUserOnlyPolicyHandler, CheckValidatesSource) { … }
}