| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 BASE_TEST_TEST_FILE_UTIL_H_ | 5 #ifndef BASE_TEST_TEST_FILE_UTIL_H_ |
| 6 #define BASE_TEST_TEST_FILE_UTIL_H_ | 6 #define BASE_TEST_TEST_FILE_UTIL_H_ |
| 7 | 7 |
| 8 // File utility functions used only by tests. | 8 // File utility functions used only by tests. |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
| 14 | 14 |
| 15 namespace base { | 15 namespace base { |
| 16 class FilePath; | 16 class FilePath; |
| 17 } | 17 } |
| 18 | 18 |
| 19 namespace file_util { | 19 namespace file_util { |
| 20 | 20 |
| 21 // Wrapper over file_util::Delete. On Windows repeatedly invokes Delete in case | 21 // Wrapper over file_util::Delete. On Windows repeatedly invokes Delete in case |
| 22 // of failure to workaround Windows file locking semantics. Returns true on | 22 // of failure to workaround Windows file locking semantics. Returns true on |
| 23 // success. | 23 // success. |
| 24 bool DieFileDie(const base::FilePath& file, bool recurse); | 24 bool DieFileDie(const base::FilePath& file, bool recurse); |
| 25 | 25 |
| 26 // Clear a specific file from the system cache. After this call, trying | 26 // Clear a specific file from the system cache. After this call, trying |
| 27 // to access this file will result in a cold load from the hard drive. | 27 // to access this file will result in a cold load from the hard drive. |
| 28 bool EvictFileFromSystemCache(const base::FilePath& file); | 28 bool EvictFileFromSystemCache(const base::FilePath& file); |
| 29 | 29 |
| 30 // Like CopyFileNoCache but recursively copies all files and subdirectories |
| 31 // in the given input directory to the output directory. Any files in the |
| 32 // destination that already exist will be overwritten. |
| 33 // |
| 34 // Returns true on success. False means there was some error copying, so the |
| 35 // state of the destination is unknown. |
| 36 bool CopyRecursiveDirNoCache(const base::FilePath& source_dir, |
| 37 const base::FilePath& dest_dir); |
| 38 |
| 30 #if defined(OS_WIN) | 39 #if defined(OS_WIN) |
| 31 // Returns true if the volume supports Alternate Data Streams. | 40 // Returns true if the volume supports Alternate Data Streams. |
| 32 bool VolumeSupportsADS(const base::FilePath& path); | 41 bool VolumeSupportsADS(const base::FilePath& path); |
| 33 | 42 |
| 34 // Returns true if the ZoneIdentifier is correctly set to "Internet" (3). | 43 // Returns true if the ZoneIdentifier is correctly set to "Internet" (3). |
| 35 // Note that this function must be called from the same process as | 44 // Note that this function must be called from the same process as |
| 36 // the one that set the zone identifier. I.e. don't use it in UI/automation | 45 // the one that set the zone identifier. I.e. don't use it in UI/automation |
| 37 // based tests. | 46 // based tests. |
| 38 bool HasInternetZoneIdentifier(const base::FilePath& full_path); | 47 bool HasInternetZoneIdentifier(const base::FilePath& full_path); |
| 39 #endif // defined(OS_WIN) | 48 #endif // defined(OS_WIN) |
| (...skipping 19 matching lines...) Expand all Loading... |
| 59 const base::FilePath path_; | 68 const base::FilePath path_; |
| 60 void* info_; // The opaque stored permission information. | 69 void* info_; // The opaque stored permission information. |
| 61 size_t length_; // The length of the stored permission information. | 70 size_t length_; // The length of the stored permission information. |
| 62 | 71 |
| 63 DISALLOW_COPY_AND_ASSIGN(PermissionRestorer); | 72 DISALLOW_COPY_AND_ASSIGN(PermissionRestorer); |
| 64 }; | 73 }; |
| 65 | 74 |
| 66 } // namespace file_util | 75 } // namespace file_util |
| 67 | 76 |
| 68 #endif // BASE_TEST_TEST_FILE_UTIL_H_ | 77 #endif // BASE_TEST_TEST_FILE_UTIL_H_ |
| OLD | NEW |