summaryrefslogtreecommitdiff
path: root/chromium/components/subresource_filter/core/common/test_ruleset_utils.h
blob: d7023f86b056d16108508f917ff0444f4205004b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef COMPONENTS_SUBRESOURCE_FILTER_CORE_COMMON_TEST_RULESET_UTILS_H_
#define COMPONENTS_SUBRESOURCE_FILTER_CORE_COMMON_TEST_RULESET_UTILS_H_

#include <stdint.h>
#include <string>
#include <vector>

#include "base/strings/string_piece.h"
#include "components/subresource_filter/core/common/proto/rules.pb.h"

namespace subresource_filter {
namespace testing {

// Creates a blacklist URL rule which targets subresources of any type such that
// the resource URL ends with |suffix|.
proto::UrlRule CreateSuffixRule(base::StringPiece suffix);

// Same as CreateUrlRule(pattern, proto::URL_PATTERN_TYPE_WILDCARDED), but the
// rule applies to the specified |activation_types|, and to no element types.
// Additionally, it is restricted to a set of |domains| (if provided).
proto::UrlRule CreateWhitelistRuleForDocument(
    base::StringPiece pattern,
    int32_t activation_types = proto::ACTIVATION_TYPE_DOCUMENT,
    std::vector<std::string> domains = std::vector<std::string>());

}  // namespace testing
}  // namespace subresource_filter

#endif  // COMPONENTS_SUBRESOURCE_FILTER_CORE_COMMON_TEST_RULESET_UTILS_H_