chromium/components/subresource_filter/core/common/indexed_ruleset_unittest.cc

// Copyright 2016 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/subresource_filter/core/common/indexed_ruleset.h"

#include <memory>
#include <string_view>

#include "base/check.h"
#include "base/strings/utf_string_conversions.h"
#include "components/subresource_filter/core/common/first_party_origin.h"
#include "components/subresource_filter/core/common/load_policy.h"
#include "components/url_pattern_index/proto/rules.pb.h"
#include "components/url_pattern_index/url_pattern.h"
#include "components/url_pattern_index/url_rule_test_support.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"
#include "url/origin.h"

namespace subresource_filter {

proto;
testing;
MakeUrlRule;
UrlPattern;

class SubresourceFilterIndexedRulesetTest : public ::testing::Test {};

TEST_F(SubresourceFilterIndexedRulesetTest, EmptyRuleset) {}

TEST_F(SubresourceFilterIndexedRulesetTest, NoRuleApplies) {}

TEST_F(SubresourceFilterIndexedRulesetTest, SimpleBlocklist) {}

TEST_F(SubresourceFilterIndexedRulesetTest, SimpleBlocklistSubdocument) {}

TEST_F(SubresourceFilterIndexedRulesetTest, SimpleAllowlist) {}

TEST_F(SubresourceFilterIndexedRulesetTest, SimpleAllowlistSubdocument) {}

TEST_F(SubresourceFilterIndexedRulesetTest,
       SimpleAllowlistWithMatchingBlocklist) {}

TEST_F(SubresourceFilterIndexedRulesetTest,
       SimpleAllowlistWithMatchingBlocklistSubdocument) {}

// Ensure patterns containing non-ascii characters are disallowed.
TEST_F(SubresourceFilterIndexedRulesetTest, NonAsciiPatterns) {}

// Ensure that specifying non-ascii characters in percent encoded form in
// patterns works.
TEST_F(SubresourceFilterIndexedRulesetTest, PercentEncodedPatterns) {}

// Ensures that specifying patterns in punycode works for matching IDN domains.
TEST_F(SubresourceFilterIndexedRulesetTest, IDNHosts) {}

// Ensure patterns containing non-ascii domains are disallowed.
TEST_F(SubresourceFilterIndexedRulesetTest, NonAsciiDomain) {}

// Ensure patterns with percent encoded hosts match correctly.
//
// Warning: This test depends on the standard non-compliant URL behavior in
// Chrome. Currently, Chrome escapes '*' (%2A) character in URL host, but this
// behavior is non-compliant. See https://crbug.com/1416013 for details. We
// probably no longer need this test once https://crbug.com/1416013 is fixed.
TEST_F(SubresourceFilterIndexedRulesetTest, PercentEncodedHostPattern) {}

// Verifies the behavior for rules having percent encoded domains.
TEST_F(SubresourceFilterIndexedRulesetTest, PercentEncodedDomain) {}

TEST_F(SubresourceFilterIndexedRulesetTest, SimpleBlocklistAndAllowlist) {}

TEST_F(SubresourceFilterIndexedRulesetTest,
       OneBlocklistAndOneDeactivationRule) {}

TEST_F(SubresourceFilterIndexedRulesetTest, MatchingEmptyRuleset) {}

TEST_F(SubresourceFilterIndexedRulesetTest, MatchingNoRuleApplies) {}

TEST_F(SubresourceFilterIndexedRulesetTest, MatchingSimpleBlocklist) {}

TEST_F(SubresourceFilterIndexedRulesetTest, MatchingSimpleAllowlist) {}

TEST_F(SubresourceFilterIndexedRulesetTest,
       MatchingSimpleBlocklistAndAllowlist) {}

TEST_F(SubresourceFilterIndexedRulesetTest,
       MatchingOneBlocklistAndOneDeactivationRule) {}

}  // namespace subresource_filter