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

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

Issue 10539009: mac: Make the (10.6-only) sandbox hole for the components build smaller (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: test Created 8 years, 6 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
« content/common/sandbox_mac.mm ('K') | « content/common/sandbox_mac.mm ('k') | no next file » | 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 #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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 typedef scoped_ptr_malloc<FilePath, ScopedDirectoryDelete> ScopedDirectory; 143 typedef scoped_ptr_malloc<FilePath, ScopedDirectoryDelete> ScopedDirectory;
144 144
145 TEST_F(MacDirAccessSandboxTest, SandboxAccess) { 145 TEST_F(MacDirAccessSandboxTest, SandboxAccess) {
146 using file_util::CreateDirectory; 146 using file_util::CreateDirectory;
147 147
148 FilePath tmp_dir; 148 FilePath tmp_dir;
149 ASSERT_TRUE(file_util::CreateNewTempDirectory("", &tmp_dir)); 149 ASSERT_TRUE(file_util::CreateNewTempDirectory("", &tmp_dir));
150 // This step is important on OS X since the sandbox only understands "real" 150 // This step is important on OS X since the sandbox only understands "real"
151 // paths and the paths CreateNewTempDirectory() returns are empirically in 151 // paths and the paths CreateNewTempDirectory() returns are empirically in
152 // /var which is a symlink to /private/var . 152 // /var which is a symlink to /private/var .
153 Sandbox::GetCanonicalSandboxPath(&tmp_dir); 153 tmp_dir = Sandbox::GetCanonicalSandboxPath(tmp_dir);
154 ScopedDirectory cleanup(&tmp_dir); 154 ScopedDirectory cleanup(&tmp_dir);
155 155
156 const char* sandbox_dir_cases[] = { 156 const char* sandbox_dir_cases[] = {
157 "simple_dir_name", 157 "simple_dir_name",
158 "^hello++ $", // Regex. 158 "^hello++ $", // Regex.
159 "\\^.$|()[]*+?{}", // All regex characters. 159 "\\^.$|()[]*+?{}", // All regex characters.
160 }; 160 };
161 161
162 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(sandbox_dir_cases); ++i) { 162 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(sandbox_dir_cases); ++i) {
163 const char* sandbox_dir_name = sandbox_dir_cases[i]; 163 const char* sandbox_dir_name = sandbox_dir_cases[i];
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 PLOG(ERROR) << "Sandbox breach: was able to write (" 299 PLOG(ERROR) << "Sandbox breach: was able to write ("
300 << denied_file2.value() 300 << denied_file2.value()
301 << ")"; 301 << ")";
302 return -1; 302 return -1;
303 } 303 }
304 304
305 return 0; 305 return 0;
306 } 306 }
307 307
308 } // namespace sandbox 308 } // namespace sandbox
OLDNEW
« content/common/sandbox_mac.mm ('K') | « content/common/sandbox_mac.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698