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

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

Issue 9355050: Added read-only file error test. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added comment. Created 8 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | base/test/test_file_util_posix.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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 #pragma once 7 #pragma once
8 8
9 // File utility functions used only by tests. 9 // File utility functions used only by tests.
10 10
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 // string16 elsewhere for Unicode strings, but in tests it is frequently 49 // string16 elsewhere for Unicode strings, but in tests it is frequently
50 // convenient to be able to compare paths to literals like L"foobar". 50 // convenient to be able to compare paths to literals like L"foobar".
51 std::wstring FilePathAsWString(const FilePath& path); 51 std::wstring FilePathAsWString(const FilePath& path);
52 FilePath WStringAsFilePath(const std::wstring& path); 52 FilePath WStringAsFilePath(const std::wstring& path);
53 53
54 // For testing, make the file unreadable or unwritable. 54 // For testing, make the file unreadable or unwritable.
55 // In POSIX, this does not apply to the root user. 55 // In POSIX, this does not apply to the root user.
56 bool MakeFileUnreadable(const FilePath& path) WARN_UNUSED_RESULT; 56 bool MakeFileUnreadable(const FilePath& path) WARN_UNUSED_RESULT;
57 bool MakeFileUnwritable(const FilePath& path) WARN_UNUSED_RESULT; 57 bool MakeFileUnwritable(const FilePath& path) WARN_UNUSED_RESULT;
58 58
59 // Gets a blob indicating the permission information for |path|.
60 // |length| is the length of the blob. Zero on failure.
61 // Returns the blob pointer, or NULL on failure.
62 void* GetPermissionInfo(const FilePath& path, size_t* length);
Paweł Hajdan Jr. 2012/02/27 09:09:25 I don't like this interface. How about a scoped ob
ahendrickson 2012/02/27 16:39:34 Done.
63
64 // Restores the permission information for |path|, given the blob retrieved
65 // using |GetPermissionInfo()|.
66 // |info| is the pointer to the blob.
67 // |length| is the length of the blob.
68 // Either |info| or |length| may be NULL/0, in which case nothing happens.
69 bool RestorePermissionInfo(const FilePath& path, void* info, size_t length);
70
59 } // namespace file_util 71 } // namespace file_util
60 72
61 #endif // BASE_TEST_TEST_FILE_UTIL_H_ 73 #endif // BASE_TEST_TEST_FILE_UTIL_H_
OLDNEW
« no previous file with comments | « no previous file | base/test/test_file_util_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698