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 #include "base/test/test_file_util.h" | 5 #include "base/test/test_file_util.h" |
6 | 6 |
7 #include <errno.h> | 7 #include <errno.h> |
8 #include <fcntl.h> | 8 #include <fcntl.h> |
9 #include <sys/stat.h> | 9 #include <sys/stat.h> |
10 #include <sys/types.h> | 10 #include <sys/types.h> |
11 | 11 |
12 #include <string> | 12 #include <string> |
13 | 13 |
14 #include "base/file_util.h" | 14 #include "base/file_util.h" |
| 15 #include "base/files/file_enumerator.h" |
15 #include "base/files/file_path.h" | 16 #include "base/files/file_path.h" |
16 #include "base/logging.h" | 17 #include "base/logging.h" |
17 #include "base/string_util.h" | 18 #include "base/string_util.h" |
18 #include "base/utf_string_conversions.h" | 19 #include "base/utf_string_conversions.h" |
19 | 20 |
20 using base::MakeAbsoluteFilePath; | |
21 | |
22 namespace file_util { | 21 namespace file_util { |
23 | 22 |
24 namespace { | 23 namespace { |
25 | 24 |
26 // Deny |permission| on the file |path|. | 25 // Deny |permission| on the file |path|. |
27 bool DenyFilePermission(const base::FilePath& path, mode_t permission) { | 26 bool DenyFilePermission(const base::FilePath& path, mode_t permission) { |
28 struct stat stat_buf; | 27 struct stat stat_buf; |
29 if (stat(path.value().c_str(), &stat_buf) != 0) | 28 if (stat(path.value().c_str(), &stat_buf) != 0) |
30 return false; | 29 return false; |
31 stat_buf.st_mode &= ~permission; | 30 stat_buf.st_mode &= ~permission; |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 DCHECK(info_ != NULL); | 108 DCHECK(info_ != NULL); |
110 DCHECK_NE(0u, length_); | 109 DCHECK_NE(0u, length_); |
111 } | 110 } |
112 | 111 |
113 PermissionRestorer::~PermissionRestorer() { | 112 PermissionRestorer::~PermissionRestorer() { |
114 if (!RestorePermissionInfo(path_, info_, length_)) | 113 if (!RestorePermissionInfo(path_, info_, length_)) |
115 NOTREACHED(); | 114 NOTREACHED(); |
116 } | 115 } |
117 | 116 |
118 } // namespace file_util | 117 } // namespace file_util |
OLD | NEW |