123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- #ifndef BASE_TEST_TEST_FILE_UTIL_H_
- #define BASE_TEST_TEST_FILE_UTIL_H_
- #include <stddef.h>
- #include <string>
- #include "base/compiler_specific.h"
- #include "base/files/file_path.h"
- #include "base/macros.h"
- #include "build/build_config.h"
- #if defined(OS_ANDROID)
- #include <jni.h>
- #endif
- #if defined(OS_WIN)
- #include <windows.h>
- #endif
- namespace base {
- bool EvictFileFromSystemCacheWithRetry(const FilePath& file);
- bool DieFileDie(const FilePath& file, bool recurse);
- FilePath CreateUniqueTempDirectoryScopedToTest();
- void SyncPageCacheToDisk();
- bool EvictFileFromSystemCache(const FilePath& file);
- #if defined(OS_WIN)
- bool DenyFilePermission(const FilePath& path, DWORD permission);
- #endif
- bool MakeFileUnreadable(const FilePath& path) WARN_UNUSED_RESULT;
- bool MakeFileUnwritable(const FilePath& path) WARN_UNUSED_RESULT;
- class FilePermissionRestorer {
- public:
- explicit FilePermissionRestorer(const FilePath& path);
- ~FilePermissionRestorer();
- private:
- const FilePath path_;
- void* info_;
- size_t length_;
- DISALLOW_COPY_AND_ASSIGN(FilePermissionRestorer);
- };
- #if defined(OS_ANDROID)
- FilePath InsertImageIntoMediaStore(const FilePath& path);
- #endif
- }
- #endif
|