Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(24)

Side by Side Diff: base/test/test_file_util.h

Issue 2047483003: Add fallback behavior if the last used profile cannot initialize (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bug-614753-fix
Patch Set: Fix a mistake in a comment. (Didn't check Atom reflow output, sorry :-( ) Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | base/test/test_file_util_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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>
11 11
12 #include <string> 12 #include <string>
13 13
14 #include "base/compiler_specific.h" 14 #include "base/compiler_specific.h"
15 #include "base/files/file_path.h" 15 #include "base/files/file_path.h"
16 #include "base/macros.h" 16 #include "base/macros.h"
17 #include "build/build_config.h" 17 #include "build/build_config.h"
18 18
19 #if defined(OS_ANDROID) 19 #if defined(OS_ANDROID)
20 #include <jni.h> 20 #include <jni.h>
21 #endif 21 #endif
22 22
23 #if defined(OS_WIN)
24 #include <windows.h>
25 #endif
26
23 namespace base { 27 namespace base {
24 28
25 class FilePath; 29 class FilePath;
26 30
27 // Clear a specific file from the system cache like EvictFileFromSystemCache, 31 // Clear a specific file from the system cache like EvictFileFromSystemCache,
28 // but on failure it will sleep and retry. On the Windows buildbots, eviction 32 // but on failure it will sleep and retry. On the Windows buildbots, eviction
29 // can fail if the file is marked in use, and this will throw off timings that 33 // can fail if the file is marked in use, and this will throw off timings that
30 // rely on uncached files. 34 // rely on uncached files.
31 bool EvictFileFromSystemCacheWithRetry(const FilePath& file); 35 bool EvictFileFromSystemCacheWithRetry(const FilePath& file);
32 36
33 // Wrapper over base::Delete. On Windows repeatedly invokes Delete in case 37 // Wrapper over base::Delete. On Windows repeatedly invokes Delete in case
34 // of failure to workaround Windows file locking semantics. Returns true on 38 // of failure to workaround Windows file locking semantics. Returns true on
35 // success. 39 // success.
36 bool DieFileDie(const FilePath& file, bool recurse); 40 bool DieFileDie(const FilePath& file, bool recurse);
37 41
38 // Clear a specific file from the system cache. After this call, trying 42 // Clear a specific file from the system cache. After this call, trying
39 // 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.
40 bool EvictFileFromSystemCache(const FilePath& file); 44 bool EvictFileFromSystemCache(const FilePath& file);
41 45
42 #if defined(OS_WIN) 46 #if defined(OS_WIN)
47 // Deny |permission| on the file |path| for the current user. |permission| is an
48 // ACCESS_MASK structure which is defined in
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
51 // possible values.
52 bool DenyFilePermission(const FilePath& path, DWORD permission);
53
43 // Returns true if the volume supports Alternate Data Streams. 54 // Returns true if the volume supports Alternate Data Streams.
44 bool VolumeSupportsADS(const FilePath& path); 55 bool VolumeSupportsADS(const FilePath& path);
45 56
46 // Returns true if the ZoneIdentifier is correctly set to "Internet" (3). 57 // Returns true if the ZoneIdentifier is correctly set to "Internet" (3).
47 // Note that this function must be called from the same process as 58 // Note that this function must be called from the same process as
48 // the one that set the zone identifier. I.e. don't use it in UI/automation 59 // the one that set the zone identifier. I.e. don't use it in UI/automation
49 // based tests. 60 // based tests.
50 bool HasInternetZoneIdentifier(const FilePath& full_path); 61 bool HasInternetZoneIdentifier(const FilePath& full_path);
51 #endif // defined(OS_WIN) 62 #endif // defined(OS_WIN)
52 63
(...skipping 21 matching lines...) Expand all
74 bool RegisterContentUriTestUtils(JNIEnv* env); 85 bool RegisterContentUriTestUtils(JNIEnv* env);
75 86
76 // Insert an image file into the MediaStore, and retrieve the content URI for 87 // Insert an image file into the MediaStore, and retrieve the content URI for
77 // testing purpose. 88 // testing purpose.
78 FilePath InsertImageIntoMediaStore(const FilePath& path); 89 FilePath InsertImageIntoMediaStore(const FilePath& path);
79 #endif // defined(OS_ANDROID) 90 #endif // defined(OS_ANDROID)
80 91
81 } // namespace base 92 } // namespace base
82 93
83 #endif // BASE_TEST_TEST_FILE_UTIL_H_ 94 #endif // BASE_TEST_TEST_FILE_UTIL_H_
OLDNEW
« no previous file with comments | « no previous file | base/test/test_file_util_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698