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

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

Issue 2793993002: [subresource_filter] Replace KMP by std::search. (Closed)
Patch Set: Fix DCHECK. 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..408a9845353bd54169d0c3b7eecb79194494d173 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,8 @@ 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));
+ ASSERT_NO_FATAL_FAILURE(
+ CreateUnindexedRulesetWithRules({suffix_rule}, test_unindexed_ruleset));
}
void TestRulesetCreator::CreateRulesetToDisallowURLsWithManySuffixes(
@@ -157,6 +151,14 @@ void TestRulesetCreator::CreateRulesetWithRules(
&test_ruleset_pair->indexed));
}
+void TestRulesetCreator::CreateUnindexedRulesetWithRules(
+ 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