1 // Copyright 2023 The Chromium Authors 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef BASE_TEST_SCOPED_BLOCK_TESTS_WRITING_TO_SPECIAL_DIRS_H_ 6 #define BASE_TEST_SCOPED_BLOCK_TESTS_WRITING_TO_SPECIAL_DIRS_H_ 7 8 #include <vector> 9 10 #include "base/files/block_tests_writing_to_special_dirs.h" 11 12 namespace base { 13 14 // This is used by test harnesses to detect and prevent tests writing to 15 // special directories, with help from `BlockTestsWritingToSpecialDirs`. 16 class ScopedBlockTestsWritingToSpecialDirs { 17 public: 18 // `dirs_to_block` contains the PathService keys of the dirs to block. 19 ScopedBlockTestsWritingToSpecialDirs( 20 std::vector<int> dirs_to_block, 21 FileWriteBlockedForTestingFunctionPtr failure_callback); 22 23 ScopedBlockTestsWritingToSpecialDirs( 24 const ScopedBlockTestsWritingToSpecialDirs&) = delete; 25 ScopedBlockTestsWritingToSpecialDirs& operator=( 26 const ScopedBlockTestsWritingToSpecialDirs&) = delete; 27 28 ~ScopedBlockTestsWritingToSpecialDirs(); 29 }; 30 31 } // namespace base 32 33 #endif // BASE_TEST_SCOPED_BLOCK_TESTS_WRITING_TO_SPECIAL_DIRS_H_ 34