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

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

Issue 2175763002: Integrate IndexedRuleset into DocumentSubresourceFilter. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix tests. Created 4 years, 5 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.h
diff --git a/components/subresource_filter/core/common/test_ruleset_creator.h b/components/subresource_filter/core/common/test_ruleset_creator.h
index 3601b98163d0f31c207921370fb3483558c52d67..6bc69de9a366341bff68a696fa7b54d0b24a5f3f 100644
--- a/components/subresource_filter/core/common/test_ruleset_creator.h
+++ b/components/subresource_filter/core/common/test_ruleset_creator.h
@@ -5,6 +5,10 @@
#ifndef COMPONENTS_SUBRESOURCE_FILTER_CORE_COMMON_TEST_RULESET_CREATOR_H_
#define COMPONENTS_SUBRESOURCE_FILTER_CORE_COMMON_TEST_RULESET_CREATOR_H_
+#include <stdint.h>
+
+#include <vector>
+
#include "base/files/file.h"
#include "base/files/scoped_temp_dir.h"
#include "base/macros.h"
@@ -20,8 +24,16 @@ class TestRulesetCreator {
~TestRulesetCreator();
// Creates a testing ruleset to disallow subresource loads from URL paths
- // having the given |suffix|, and returns a read-only file handle to it in
- // |ruleset_file|.
+ // having the given |suffix|, and replaces the |buffer| with the ruleset data.
+ //
+ // Enclose the call to this method in ASSERT_NO_FATAL_FAILURE to detect
+ // errors.
+ static void CreateRulesetToDisallowURLsWithPathSuffix(
+ base::StringPiece suffix,
+ std::vector<uint8_t>* buffer);
+
+ // Same as above, but puts the ruleset into a file and returns its read-only
+ // file handle in |ruleset_file|.
//
// The underlying temporary file will be deleted when the TestRulesetCreator
// instance goes out of scope, but the |ruleset_file| handle may outlive and
@@ -29,8 +41,8 @@ class TestRulesetCreator {
//
// Enclose the call to this method in ASSERT_NO_FATAL_FAILURE to detect
// errors.
- void CreateRulesetToDisallowURLsWithPathSuffix(base::StringPiece suffix,
- base::File* ruleset_file);
+ void CreateRulesetFileToDisallowURLsWithPathSuffix(base::StringPiece suffix,
+ base::File* ruleset_file);
private:
base::ScopedTempDir scoped_temp_dir_;

Powered by Google App Engine
This is Rietveld 408576698