OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef COMPONENTS_SUBRESOURCE_FILTER_CORE_COMMON_TEST_RULESET_CREATOR_H_ | 5 #ifndef COMPONENTS_SUBRESOURCE_FILTER_CORE_COMMON_TEST_RULESET_CREATOR_H_ |
6 #define COMPONENTS_SUBRESOURCE_FILTER_CORE_COMMON_TEST_RULESET_CREATOR_H_ | 6 #define COMPONENTS_SUBRESOURCE_FILTER_CORE_COMMON_TEST_RULESET_CREATOR_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <vector> | 10 #include <vector> |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 // Returns a unique |path| that is valid for the lifetime of this instance. | 91 // Returns a unique |path| that is valid for the lifetime of this instance. |
92 // No file at |path| will be automatically created. | 92 // No file at |path| will be automatically created. |
93 void GetUniqueTemporaryPath(base::FilePath* path); | 93 void GetUniqueTemporaryPath(base::FilePath* path); |
94 | 94 |
95 private: | 95 private: |
96 // Writes the |ruleset_contents| to a temporary file, and initializes | 96 // Writes the |ruleset_contents| to a temporary file, and initializes |
97 // |ruleset| to have the same |contents|, and the |path| to this file. | 97 // |ruleset| to have the same |contents|, and the |path| to this file. |
98 void CreateTestRulesetFromContents(std::vector<uint8_t> ruleset_contents, | 98 void CreateTestRulesetFromContents(std::vector<uint8_t> ruleset_contents, |
99 TestRuleset* ruleset); | 99 TestRuleset* ruleset); |
100 | 100 |
101 base::ScopedTempDir scoped_temp_dir_; | 101 std::unique_ptr<base::ScopedTempDir> scoped_temp_dir_; |
102 int next_unique_file_suffix = 1; | 102 int next_unique_file_suffix = 1; |
103 | 103 |
104 DISALLOW_COPY_AND_ASSIGN(TestRulesetCreator); | 104 DISALLOW_COPY_AND_ASSIGN(TestRulesetCreator); |
105 }; | 105 }; |
106 | 106 |
107 } // namespace testing | 107 } // namespace testing |
108 } // namespace subresource_filter | 108 } // namespace subresource_filter |
109 | 109 |
110 #endif // COMPONENTS_SUBRESOURCE_FILTER_CORE_COMMON_TEST_RULESET_CREATOR_H_ | 110 #endif // COMPONENTS_SUBRESOURCE_FILTER_CORE_COMMON_TEST_RULESET_CREATOR_H_ |
OLD | NEW |