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

Side by Side Diff: chrome/common/sandbox_mac_unittest_helper.mm

Issue 5580002: Mac: Tell the GPU sandbox to deny a few things. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: browser tests pass Created 10 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
« chrome/browser/gpu.sb ('K') | « chrome/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) 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 #include "chrome/common/sandbox_mac_unittest_helper.h" 5 #include "chrome/common/sandbox_mac_unittest_helper.h"
6 6
7 extern "C" { 7 extern "C" {
8 #include <sandbox.h> 8 #include <sandbox.h>
9 } 9 }
10 10
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 } // namespace internal 51 } // namespace internal
52 52
53 bool MacSandboxTest::RunTestInAllSandboxTypes(const char* test_name, 53 bool MacSandboxTest::RunTestInAllSandboxTypes(const char* test_name,
54 const char* test_data) { 54 const char* test_data) {
55 // Go through all the sandbox types, and run the test case in each of them 55 // Go through all the sandbox types, and run the test case in each of them
56 // if one fails, abort. 56 // if one fails, abort.
57 for(int i = static_cast<int>(Sandbox::SANDBOX_TYPE_FIRST_TYPE); 57 for(int i = static_cast<int>(Sandbox::SANDBOX_TYPE_FIRST_TYPE);
58 i < Sandbox::SANDBOX_AFTER_TYPE_LAST_TYPE; 58 i < Sandbox::SANDBOX_AFTER_TYPE_LAST_TYPE;
59 ++i) { 59 ++i) {
60 60
61 if (i == Sandbox::SANDBOX_TYPE_GPU) {
62 // TODO(thakis): Remove this once the gpu sandbox is more restricted.
63 // http://crbug.com/48607
64 continue;
65 }
66
67 if (!RunTestInSandbox(static_cast<Sandbox::SandboxProcessType>(i), 61 if (!RunTestInSandbox(static_cast<Sandbox::SandboxProcessType>(i),
68 test_name, test_data)) { 62 test_name, test_data)) {
69 LOG(ERROR) << "Sandboxed test (" << test_name << ")" << 63 LOG(ERROR) << "Sandboxed test (" << test_name << ")" <<
70 "Failed in sandbox type " << i << 64 "Failed in sandbox type " << i <<
71 "user data: (" << test_data << ")"; 65 "user data: (" << test_data << ")";
72 return false; 66 return false;
73 } 67 }
74 } 68 }
75 return true; 69 return true;
76 } 70 }
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 return -1; 137 return -1;
144 } 138 }
145 test_case->SetTestData(test_data); 139 test_case->SetTestData(test_data);
146 140
147 // Run Test. 141 // Run Test.
148 if (!test_case->BeforeSandboxInit()) { 142 if (!test_case->BeforeSandboxInit()) {
149 LOG(ERROR) << sandbox_test_name << "Failed test before sandbox init"; 143 LOG(ERROR) << sandbox_test_name << "Failed test before sandbox init";
150 return -1; 144 return -1;
151 } 145 }
152 146
153 Sandbox::SandboxWarmup(); 147 Sandbox::SandboxWarmup(sandbox_type);
154 148
155 if (!Sandbox::EnableSandbox(sandbox_type, FilePath())) { 149 if (!Sandbox::EnableSandbox(sandbox_type, FilePath())) {
156 LOG(ERROR) << "Failed to initialize sandbox " << sandbox_type; 150 LOG(ERROR) << "Failed to initialize sandbox " << sandbox_type;
157 return -1; 151 return -1;
158 } 152 }
159 153
160 if (!test_case->SandboxedTest()) { 154 if (!test_case->SandboxedTest()) {
161 LOG(ERROR) << sandbox_test_name << "Failed sandboxed test"; 155 LOG(ERROR) << sandbox_test_name << "Failed sandboxed test";
162 return -1; 156 return -1;
163 } 157 }
164 158
165 return 0; 159 return 0;
166 } 160 }
167 161
168 } // namespace 162 } // namespace
OLDNEW
« chrome/browser/gpu.sb ('K') | « chrome/common/sandbox_mac.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698