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 #import <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
6 #include <dirent.h> | 6 #include <dirent.h> |
7 | 7 |
8 extern "C" { | 8 extern "C" { |
9 #include <sandbox.h> | 9 #include <sandbox.h> |
10 } | 10 } |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 EXPECT_EQ(expected, out); | 128 EXPECT_EQ(expected, out); |
129 | 129 |
130 } | 130 } |
131 } | 131 } |
132 | 132 |
133 // A class to handle auto-deleting a directory. | 133 // A class to handle auto-deleting a directory. |
134 class ScopedDirectoryDelete { | 134 class ScopedDirectoryDelete { |
135 public: | 135 public: |
136 inline void operator()(base::FilePath* x) const { | 136 inline void operator()(base::FilePath* x) const { |
137 if (x) { | 137 if (x) { |
138 base::Delete(*x, true); | 138 base::DeleteFile(*x, true); |
139 } | 139 } |
140 } | 140 } |
141 }; | 141 }; |
142 | 142 |
143 typedef scoped_ptr_malloc<base::FilePath, ScopedDirectoryDelete> | 143 typedef scoped_ptr_malloc<base::FilePath, ScopedDirectoryDelete> |
144 ScopedDirectory; | 144 ScopedDirectory; |
145 | 145 |
146 TEST_F(MacDirAccessSandboxTest, SandboxAccess) { | 146 TEST_F(MacDirAccessSandboxTest, SandboxAccess) { |
147 using file_util::CreateDirectory; | 147 using file_util::CreateDirectory; |
148 | 148 |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 PLOG(ERROR) << "Sandbox breach: was able to write (" | 301 PLOG(ERROR) << "Sandbox breach: was able to write (" |
302 << denied_file2.value() | 302 << denied_file2.value() |
303 << ")"; | 303 << ")"; |
304 return -1; | 304 return -1; |
305 } | 305 } |
306 | 306 |
307 return 0; | 307 return 0; |
308 } | 308 } |
309 | 309 |
310 } // namespace content | 310 } // namespace content |
OLD | NEW |