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

Side by Side Diff: content/common/sandbox_mac_diraccess_unittest.mm

Issue 100573002: Move directory creation functions to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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
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 #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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 if (x) { 138 if (x) {
139 base::DeleteFile(*x, true); 139 base::DeleteFile(*x, true);
140 } 140 }
141 } 141 }
142 }; 142 };
143 143
144 typedef scoped_ptr_malloc<base::FilePath, ScopedDirectoryDelete> 144 typedef scoped_ptr_malloc<base::FilePath, ScopedDirectoryDelete>
145 ScopedDirectory; 145 ScopedDirectory;
146 146
147 TEST_F(MacDirAccessSandboxTest, SandboxAccess) { 147 TEST_F(MacDirAccessSandboxTest, SandboxAccess) {
148 using file_util::CreateDirectory; 148 using base::CreateDirectory;
149 149
150 base::FilePath tmp_dir; 150 base::FilePath tmp_dir;
151 ASSERT_TRUE(base::CreateNewTempDirectory(base::FilePath::StringType(), 151 ASSERT_TRUE(base::CreateNewTempDirectory(base::FilePath::StringType(),
152 &tmp_dir)); 152 &tmp_dir));
153 // This step is important on OS X since the sandbox only understands "real" 153 // This step is important on OS X since the sandbox only understands "real"
154 // paths and the paths CreateNewTempDirectory() returns are empirically in 154 // paths and the paths CreateNewTempDirectory() returns are empirically in
155 // /var which is a symlink to /private/var . 155 // /var which is a symlink to /private/var .
156 tmp_dir = Sandbox::GetCanonicalSandboxPath(tmp_dir); 156 tmp_dir = Sandbox::GetCanonicalSandboxPath(tmp_dir);
157 ScopedDirectory cleanup(&tmp_dir); 157 ScopedDirectory cleanup(&tmp_dir);
158 158
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 PLOG(ERROR) << "Sandbox breach: was able to write (" 303 PLOG(ERROR) << "Sandbox breach: was able to write ("
304 << denied_file2.value() 304 << denied_file2.value()
305 << ")"; 305 << ")";
306 return -1; 306 return -1;
307 } 307 }
308 308
309 return 0; 309 return 0;
310 } 310 }
311 311
312 } // namespace content 312 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/storage_partition_impl_unittest.cc ('k') | content/renderer/gpu/gpu_benchmarking_extension.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698