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

Unified Diff: components/subresource_filter/core/common/test_ruleset_creator.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_creator.cc
diff --git a/components/subresource_filter/core/common/test_ruleset_creator.cc b/components/subresource_filter/core/common/test_ruleset_creator.cc
index d87cf1b408d46e0df12ebd37242485b23e992ca4..7124feb4dc666537a8fece225b106d30b5efff12 100644
--- a/components/subresource_filter/core/common/test_ruleset_creator.cc
+++ b/components/subresource_filter/core/common/test_ruleset_creator.cc
@@ -45,11 +45,6 @@ std::vector<uint8_t> SerializeUnindexedRulesetWithMultipleRules(
return std::vector<uint8_t>(data, data + ruleset_contents.size());
}
-std::vector<uint8_t> SerializeUnindexedRulesetWithSingleRule(
- const proto::UrlRule& rule) {
- return SerializeUnindexedRulesetWithMultipleRules({rule});
-}
-
std::vector<uint8_t> SerializeIndexedRulesetWithMultipleRules(
const std::vector<proto::UrlRule>& rules) {
RulesetIndexer indexer;
@@ -126,9 +121,7 @@ void TestRulesetCreator::CreateUnindexedRulesetToDisallowURLsWithPathSuffix(
TestRuleset* test_unindexed_ruleset) {
DCHECK(test_unindexed_ruleset);
proto::UrlRule suffix_rule = CreateSuffixRule(suffix);
- ASSERT_NO_FATAL_FAILURE(CreateTestRulesetFromContents(
- SerializeUnindexedRulesetWithSingleRule(suffix_rule),
- test_unindexed_ruleset));
+ CreateRulesetWithRules({suffix_rule}, test_unindexed_ruleset);
engedy 2017/04/05 10:55:10 nit: Enclose this in ASSERT_NO_FATAL_FAILURE too,
pkalinnikov 2017/04/05 13:29:21 Done.
}
void TestRulesetCreator::CreateRulesetToDisallowURLsWithManySuffixes(
@@ -157,6 +150,14 @@ void TestRulesetCreator::CreateRulesetWithRules(
&test_ruleset_pair->indexed));
}
+void TestRulesetCreator::CreateRulesetWithRules(
+ const std::vector<proto::UrlRule>& rules,
+ TestRuleset* test_unindexed_ruleset) {
+ ASSERT_NO_FATAL_FAILURE(CreateTestRulesetFromContents(
+ SerializeUnindexedRulesetWithMultipleRules(rules),
+ test_unindexed_ruleset));
+}
+
void TestRulesetCreator::GetUniqueTemporaryPath(base::FilePath* path) {
DCHECK(path);
ASSERT_TRUE(scoped_temp_dir_.IsValid() ||

Powered by Google App Engine
This is Rietveld 408576698