// Copyright 2016 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef COMPONENTS_SUBRESOURCE_FILTER_CORE_COMMON_TEST_RULESET_CREATOR_H_ #define COMPONENTS_SUBRESOURCE_FILTER_CORE_COMMON_TEST_RULESET_CREATOR_H_ #include <stdint.h> #include <string_view> #include <vector> #include "base/files/file.h" #include "base/files/file_path.h" #include "base/files/scoped_temp_dir.h" #include "components/url_pattern_index/proto/rules.pb.h" namespace subresource_filter { namespace testing { // Encapsulates a testing subresource filtering ruleset serialized either in // indexed or unindexed format. The ruleset |contents| can be accessed directly // as a byte buffer, as well as through the file |path| pointing to a temporary // file that is cleaned up when the TestRulesetCreator is destroyed. struct TestRuleset { … }; // Encapsulates the same ruleset in both indexed and unindexed formats. struct TestRulesetPair { … }; // Helper class to create subresource filtering rulesets for testing. // // All temporary files and paths are cleaned up when the instance goes out of // scope, but file handles already open can still be used and read even after // this has happened. class TestRulesetCreator { … }; } // namespace testing } // namespace subresource_filter #endif // COMPONENTS_SUBRESOURCE_FILTER_CORE_COMMON_TEST_RULESET_CREATOR_H_