| 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 | 16 |
| 17 class FilePath; | 17 class FilePath; |
| 18 | 18 |
| 19 // Clear a specific file from the system cache like EvictFileFromSystemCache, | 19 // Clear a specific file from the system cache like EvictFileFromSystemCache, |
| 20 // but on failure it will sleep and retry. On the Windows buildbots, eviction | 20 // but on failure it will sleep and retry. On the Windows buildbots, eviction |
| 21 // can fail if the file is marked in use, and this will throw off timings that | 21 // can fail if the file is marked in use, and this will throw off timings that |
| 22 // rely on uncached files. | 22 // rely on uncached files. |
| 23 bool EvictFileFromSystemCacheWithRetry(const FilePath& file); | 23 bool EvictFileFromSystemCacheWithRetry(const FilePath& file); |
| 24 | 24 |
| 25 } // namespace base | 25 } // namespace base |
| 26 | 26 |
| 27 // TODO(brettw) move all of this to the base namespace. | 27 // TODO(brettw) move all of this to the base namespace. |
| 28 namespace file_util { | 28 namespace file_util { |
| 29 | 29 |
| 30 // Wrapper over file_util::Delete. On Windows repeatedly invokes Delete in case | 30 // Wrapper over base::Delete. On Windows repeatedly invokes Delete in case |
| 31 // of failure to workaround Windows file locking semantics. Returns true on | 31 // of failure to workaround Windows file locking semantics. Returns true on |
| 32 // success. | 32 // success. |
| 33 bool DieFileDie(const base::FilePath& file, bool recurse); | 33 bool DieFileDie(const base::FilePath& file, bool recurse); |
| 34 | 34 |
| 35 // Clear a specific file from the system cache. After this call, trying | 35 // Clear a specific file from the system cache. After this call, trying |
| 36 // to access this file will result in a cold load from the hard drive. | 36 // to access this file will result in a cold load from the hard drive. |
| 37 bool EvictFileFromSystemCache(const base::FilePath& file); | 37 bool EvictFileFromSystemCache(const base::FilePath& file); |
| 38 | 38 |
| 39 #if defined(OS_WIN) | 39 #if defined(OS_WIN) |
| 40 // Returns true if the volume supports Alternate Data Streams. | 40 // Returns true if the volume supports Alternate Data Streams. |
| (...skipping 27 matching lines...) Expand all Loading... |
| 68 const base::FilePath path_; | 68 const base::FilePath path_; |
| 69 void* info_; // The opaque stored permission information. | 69 void* info_; // The opaque stored permission information. |
| 70 size_t length_; // The length of the stored permission information. | 70 size_t length_; // The length of the stored permission information. |
| 71 | 71 |
| 72 DISALLOW_COPY_AND_ASSIGN(PermissionRestorer); | 72 DISALLOW_COPY_AND_ASSIGN(PermissionRestorer); |
| 73 }; | 73 }; |
| 74 | 74 |
| 75 } // namespace file_util | 75 } // namespace file_util |
| 76 | 76 |
| 77 #endif // BASE_TEST_TEST_FILE_UTIL_H_ | 77 #endif // BASE_TEST_TEST_FILE_UTIL_H_ |
| OLD | NEW |