Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(681)

Unified Diff: components/subresource_filter/core/common/test_ruleset_utils.cc

Issue 2793993002: [subresource_filter] Replace KMP by std::search. (Closed)
Patch Set: Address comments from csharrison@ Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/subresource_filter/core/common/test_ruleset_utils.cc
diff --git a/components/subresource_filter/core/common/test_ruleset_utils.cc b/components/subresource_filter/core/common/test_ruleset_utils.cc
index e97548eced7e190a15055cccad56493eef9cbb7b..fe1207de09ecfe037abad4cb7b3dfc785b80a609 100644
--- a/components/subresource_filter/core/common/test_ruleset_utils.cc
+++ b/components/subresource_filter/core/common/test_ruleset_utils.cc
@@ -7,15 +7,23 @@
namespace subresource_filter {
namespace testing {
-proto::UrlRule CreateSuffixRule(base::StringPiece suffix) {
+proto::UrlRule CreateUrlRule(base::StringPiece pattern,
+ proto::UrlPatternType pattern_type) {
proto::UrlRule rule;
rule.set_semantics(proto::RULE_SEMANTICS_BLACKLIST);
rule.set_source_type(proto::SOURCE_TYPE_ANY);
rule.set_element_types(proto::ELEMENT_TYPE_ALL);
- rule.set_url_pattern_type(proto::URL_PATTERN_TYPE_SUBSTRING);
+ rule.set_url_pattern_type(pattern_type);
rule.set_anchor_left(proto::ANCHOR_TYPE_NONE);
+ rule.set_anchor_right(proto::ANCHOR_TYPE_NONE);
+ rule.set_url_pattern(pattern.as_string());
+ return rule;
+}
+
+proto::UrlRule CreateSuffixRule(base::StringPiece suffix) {
+ proto::UrlRule rule =
+ CreateUrlRule(suffix, proto::URL_PATTERN_TYPE_SUBSTRING);
rule.set_anchor_right(proto::ANCHOR_TYPE_BOUNDARY);
- rule.set_url_pattern(suffix.as_string());
return rule;
}

Powered by Google App Engine
This is Rietveld 408576698