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

Unified Diff: components/subresource_filter/core/browser/ruleset_service_unittest.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/browser/ruleset_service_unittest.cc
diff --git a/components/subresource_filter/core/browser/ruleset_service_unittest.cc b/components/subresource_filter/core/browser/ruleset_service_unittest.cc
index dccef00822dacd4d45b4f3f2a7e8f85f8e415f15..c0ae974a4aa3613e9518ff26ac1daa67bdb4e4d7 100644
--- a/components/subresource_filter/core/browser/ruleset_service_unittest.cc
+++ b/components/subresource_filter/core/browser/ruleset_service_unittest.cc
@@ -27,7 +27,9 @@
#include "build/build_config.h"
#include "components/prefs/testing_pref_service.h"
#include "components/subresource_filter/core/browser/ruleset_service_delegate.h"
+#include "components/subresource_filter/core/common/proto/rules.pb.h"
#include "components/subresource_filter/core/common/test_ruleset_creator.h"
+#include "components/subresource_filter/core/common/test_ruleset_utils.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -659,13 +661,12 @@ TEST_F(SubresourceFilteringRulesetServiceTest,
base::HistogramTester histogram_tester;
mock_delegate()->SimulateStartupCompleted();
- // URL patterns longer than 255 characters are not supported.
- const std::string kTooLongSuffix(1000, 'a');
+ // REGEXP patterns are not supported.
+ proto::UrlRule rule = testing::CreateUrlRule("[0-9]{3,6}-[0-9]+",
+ proto::URL_PATTERN_TYPE_REGEXP);
TestRulesetPair ruleset_with_unsupported_rule;
- ASSERT_NO_FATAL_FAILURE(
- test_ruleset_creator()
- ->CreateUnindexedRulesetToDisallowURLsWithPathSuffix(
- kTooLongSuffix, &ruleset_with_unsupported_rule.unindexed));
+ ASSERT_NO_FATAL_FAILURE(test_ruleset_creator()->CreateRulesetWithRules(
+ {rule}, &ruleset_with_unsupported_rule.unindexed));
IndexAndStoreAndPublishUpdatedRuleset(ruleset_with_unsupported_rule,
kTestContentVersion1);
RunUntilIdle();

Powered by Google App Engine
This is Rietveld 408576698