chromium/components/policy/core/browser/url_allowlist_policy_handler_unittest.cc

// Copyright 2021 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/browser/url_allowlist_policy_handler.h"

#include <memory>
#include <utility>

#include "base/strings/string_number_conversions.h"
#include "base/values.h"
#include "components/policy/core/browser/policy_error_map.h"
#include "components/policy/core/common/policy_map.h"
#include "components/policy/core/common/policy_pref_names.h"
#include "components/policy/core/common/policy_types.h"
#include "components/policy/policy_constants.h"
#include "components/prefs/pref_value_map.h"
#include "components/strings/grit/components_strings.h"
#include "components/url_matcher/url_util.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/base/l10n/l10n_util.h"

namespace policy {

namespace {

const char kTestAllowlistValue[] =;

}  // namespace

class URLAllowlistPolicyHandlerTest : public testing::Test {};

TEST_F(URLAllowlistPolicyHandlerTest, CheckPolicySettings_WrongType) {}

TEST_F(URLAllowlistPolicyHandlerTest, ApplyPolicySettings_NothingSpecified) {}

TEST_F(URLAllowlistPolicyHandlerTest, ApplyPolicySettings_WrongType) {}

TEST_F(URLAllowlistPolicyHandlerTest, ApplyPolicySettings_Empty) {}

TEST_F(URLAllowlistPolicyHandlerTest, ApplyPolicySettings_WrongElementType) {}

TEST_F(URLAllowlistPolicyHandlerTest, ApplyPolicySettings_Successful) {}

TEST_F(URLAllowlistPolicyHandlerTest,
       ApplyPolicySettings_CheckPolicySettingsMaxFiltersLimitOK) {}

// Test that the warning message, mapped to
// |IDS_POLICY_URL_ALLOW_BLOCK_LIST_MAX_FILTERS_LIMIT_WARNING|, is added to
// |errors_| when URLAllowlist entries exceed the max filters per policy limit.
TEST_F(URLAllowlistPolicyHandlerTest,
       ApplyPolicySettings_CheckPolicySettingsMaxFiltersLimitExceeded) {}

TEST_F(URLAllowlistPolicyHandlerTest, ValidatePolicy) {}

// When the invalid sequence with '*' in the host is added to the allowlist, the
// policy can still be applied, but an error is added to the error map to
// indicate an invalid URL.
TEST_F(URLAllowlistPolicyHandlerTest, CheckPolicyURLHostWithAsterik) {}

}  // namespace policy