| 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 <stddef.h> | 10 #include <stddef.h> |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 // to access this file will result in a cold load from the hard drive. | 43 // to access this file will result in a cold load from the hard drive. |
| 44 bool EvictFileFromSystemCache(const FilePath& file); | 44 bool EvictFileFromSystemCache(const FilePath& file); |
| 45 | 45 |
| 46 #if defined(OS_WIN) | 46 #if defined(OS_WIN) |
| 47 // Deny |permission| on the file |path| for the current user. |permission| is an | 47 // Deny |permission| on the file |path| for the current user. |permission| is an |
| 48 // ACCESS_MASK structure which is defined in | 48 // ACCESS_MASK structure which is defined in |
| 49 // https://msdn.microsoft.com/en-us/library/windows/desktop/aa374892.aspx | 49 // https://msdn.microsoft.com/en-us/library/windows/desktop/aa374892.aspx |
| 50 // Refer to https://msdn.microsoft.com/en-us/library/aa822867.aspx for a list of | 50 // Refer to https://msdn.microsoft.com/en-us/library/aa822867.aspx for a list of |
| 51 // possible values. | 51 // possible values. |
| 52 bool DenyFilePermission(const FilePath& path, DWORD permission); | 52 bool DenyFilePermission(const FilePath& path, DWORD permission); |
| 53 | |
| 54 // Returns true if the volume supports Alternate Data Streams. | |
| 55 bool VolumeSupportsADS(const FilePath& path); | |
| 56 | |
| 57 // Returns true if the ZoneIdentifier is correctly set to "Internet" (3). | |
| 58 // Note that this function must be called from the same process as | |
| 59 // the one that set the zone identifier. I.e. don't use it in UI/automation | |
| 60 // based tests. | |
| 61 bool HasInternetZoneIdentifier(const FilePath& full_path); | |
| 62 #endif // defined(OS_WIN) | 53 #endif // defined(OS_WIN) |
| 63 | 54 |
| 64 // For testing, make the file unreadable or unwritable. | 55 // For testing, make the file unreadable or unwritable. |
| 65 // In POSIX, this does not apply to the root user. | 56 // In POSIX, this does not apply to the root user. |
| 66 bool MakeFileUnreadable(const FilePath& path) WARN_UNUSED_RESULT; | 57 bool MakeFileUnreadable(const FilePath& path) WARN_UNUSED_RESULT; |
| 67 bool MakeFileUnwritable(const FilePath& path) WARN_UNUSED_RESULT; | 58 bool MakeFileUnwritable(const FilePath& path) WARN_UNUSED_RESULT; |
| 68 | 59 |
| 69 // Saves the current permissions for a path, and restores it on destruction. | 60 // Saves the current permissions for a path, and restores it on destruction. |
| 70 class FilePermissionRestorer { | 61 class FilePermissionRestorer { |
| 71 public: | 62 public: |
| (...skipping 10 matching lines...) Expand all Loading... |
| 82 | 73 |
| 83 #if defined(OS_ANDROID) | 74 #if defined(OS_ANDROID) |
| 84 // Insert an image file into the MediaStore, and retrieve the content URI for | 75 // Insert an image file into the MediaStore, and retrieve the content URI for |
| 85 // testing purpose. | 76 // testing purpose. |
| 86 FilePath InsertImageIntoMediaStore(const FilePath& path); | 77 FilePath InsertImageIntoMediaStore(const FilePath& path); |
| 87 #endif // defined(OS_ANDROID) | 78 #endif // defined(OS_ANDROID) |
| 88 | 79 |
| 89 } // namespace base | 80 } // namespace base |
| 90 | 81 |
| 91 #endif // BASE_TEST_TEST_FILE_UTIL_H_ | 82 #endif // BASE_TEST_TEST_FILE_UTIL_H_ |
| OLD | NEW |