OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef COMPONENTS_SUBRESOURCE_FILTER_CORE_COMMON_TEST_RULESET_UTILS_H_ | 5 #ifndef COMPONENTS_SUBRESOURCE_FILTER_CORE_COMMON_TEST_RULESET_UTILS_H_ |
6 #define COMPONENTS_SUBRESOURCE_FILTER_CORE_COMMON_TEST_RULESET_UTILS_H_ | 6 #define COMPONENTS_SUBRESOURCE_FILTER_CORE_COMMON_TEST_RULESET_UTILS_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/strings/string_piece.h" | 12 #include "base/strings/string_piece.h" |
13 #include "components/subresource_filter/core/common/proto/rules.pb.h" | 13 #include "components/subresource_filter/core/common/proto/rules.pb.h" |
14 | 14 |
15 namespace subresource_filter { | 15 namespace subresource_filter { |
16 namespace testing { | 16 namespace testing { |
17 | 17 |
| 18 // Creates a blacklist URL rule which targets subresources of any type such that |
| 19 // the resource URL ends with |suffix|. |
18 proto::UrlRule CreateSuffixRule(base::StringPiece suffix); | 20 proto::UrlRule CreateSuffixRule(base::StringPiece suffix); |
19 | 21 |
| 22 // Same as CreateUrlRule(pattern, proto::URL_PATTERN_TYPE_WILDCARDED), but the |
| 23 // rule applies to the specified |activation_types|, and to no element types. |
| 24 // Additionally, it is restricted to a set of |domains| (if provided). |
20 proto::UrlRule CreateWhitelistRuleForDocument( | 25 proto::UrlRule CreateWhitelistRuleForDocument( |
21 base::StringPiece pattern, | 26 base::StringPiece pattern, |
22 int32_t activation_types = proto::ACTIVATION_TYPE_DOCUMENT, | 27 int32_t activation_types = proto::ACTIVATION_TYPE_DOCUMENT, |
23 std::vector<std::string> domains = std::vector<std::string>()); | 28 std::vector<std::string> domains = std::vector<std::string>()); |
24 | 29 |
25 } // namespace testing | 30 } // namespace testing |
26 } // namespace subresource_filter | 31 } // namespace subresource_filter |
27 | 32 |
28 #endif // COMPONENTS_SUBRESOURCE_FILTER_CORE_COMMON_TEST_RULESET_UTILS_H_ | 33 #endif // COMPONENTS_SUBRESOURCE_FILTER_CORE_COMMON_TEST_RULESET_UTILS_H_ |
OLD | NEW |