chromium/components/url_pattern_index/url_pattern_index_unittest.cc

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

#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40285824): Remove this and convert code to safer constructs.
#pragma allow_unsafe_buffers
#endif

#include "components/url_pattern_index/url_pattern_index.h"

#include <algorithm>
#include <cstddef>
#include <memory>
#include <numeric>
#include <string>
#include <string_view>
#include <vector>

#include "base/containers/flat_set.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/rand_util.h"
#include "base/ranges/algorithm.h"
#include "base/strings/string_number_conversions.h"
#include "components/url_pattern_index/url_pattern.h"
#include "components/url_pattern_index/url_rule_test_support.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"
#include "url/origin.h"

namespace url_pattern_index {

kAnchorNone;
kAnyParty;
kBoundary;
kDocument;
kFont;
kImage;
kNoActivation;
kScript;
kSubdomain;
kSubstring;
kThirdParty;
MakeUrlRule;
EmbedderConditionsMatcher;

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

TEST_F(UrlPatternIndexTest, EmptyIndex) {}

TEST_F(UrlPatternIndexTest, OneSimpleRule) {}

TEST_F(UrlPatternIndexTest, NoRuleApplies) {}

TEST_F(UrlPatternIndexTest, ProtoCaseSensitivity) {}

TEST_F(UrlPatternIndexTest, CaseSensitivity) {}

TEST_F(UrlPatternIndexTest, OneRuleWithoutMetaInfo) {}

TEST_F(UrlPatternIndexTest, OneRuleWithThirdParty) {}

TEST_F(UrlPatternIndexTest, OneRuleWithDomainList) {}

TEST_F(UrlPatternIndexTest, OneRuleWithInitiatorAndRequestDomainLists) {}

TEST_F(UrlPatternIndexTest, OneRuleWithLongDomainList) {}

TEST_F(UrlPatternIndexTest, OneRuleWithElementTypes) {}

TEST_F(UrlPatternIndexTest, OneRuleWithActivationTypes) {}

TEST_F(UrlPatternIndexTest, OneRuleWithElementAndActivationTypes) {}

// Test that FindAllMatches will return the correct number of UrlRule matches
// for incoming requests.
TEST_F(UrlPatternIndexTest, MultipleRuleMatches) {}

TEST_F(UrlPatternIndexTest, MatchWithDisableGenericRules) {}

TEST_F(UrlPatternIndexTest, RulesWithUnsupportedTypes) {}

TEST_F(UrlPatternIndexTest, RulesWithSupportedAndUnsupportedTypes) {}

TEST_F(UrlPatternIndexTest, FindMatchReturnsCorrectRules) {}

// Tests UrlPatternIndexMatcher::FindMatch works with the kHighestPriority match
// strategy.
TEST_F(UrlPatternIndexTest, FindMatchHighestPriority) {}

TEST_F(UrlPatternIndexTest, LongUrl_NoMatch) {}

TEST_F(UrlPatternIndexTest, RequestMethod) {}

TEST_F(UrlPatternIndexTest, EmbedderConditions) {}

TEST_F(UrlPatternIndexTest, FindMatchWithDisabledRuleIds) {}

TEST_F(UrlPatternIndexTest, FindAllMatchesWithDisabledRuleIds) {}

}  // namespace url_pattern_index