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

Side by Side Diff: ipc/ipc_send_fds_test.cc

Issue 2369553002: Suppress sandbox deprecation warnings by using the Seatbelt wrapper. (Closed)
Patch Set: Suppress sandbox deprecation warnings by using the Seatbelt wrapper. Created 4 years, 2 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
« no previous file with comments | « chrome/utility/safe_browsing/mac/crdmg.cc ('k') | sandbox/mac/seatbelt.h » ('j') | 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 #include "build/build_config.h" 5 #include "build/build_config.h"
6 6
7 #if defined(OS_POSIX) 7 #if defined(OS_POSIX)
8 #if defined(OS_MACOSX) 8 #if defined(OS_MACOSX)
9 extern "C" { 9 extern "C" {
10 #include <sandbox.h> 10 #include <sandbox.h>
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 189
190 MULTIPROCESS_IPC_TEST_CLIENT_MAIN(SendFdsSandboxedClient) { 190 MULTIPROCESS_IPC_TEST_CLIENT_MAIN(SendFdsSandboxedClient) {
191 struct stat st; 191 struct stat st;
192 const int fd = open(kDevZeroPath, O_RDONLY); 192 const int fd = open(kDevZeroPath, O_RDONLY);
193 fstat(fd, &st); 193 fstat(fd, &st);
194 if (IGNORE_EINTR(close(fd)) < 0) 194 if (IGNORE_EINTR(close(fd)) < 0)
195 return -1; 195 return -1;
196 196
197 // Enable the sandbox. 197 // Enable the sandbox.
198 char* error_buff = NULL; 198 char* error_buff = NULL;
199 int error = sandbox::Seatbelt::Init(kSBXProfilePureComputation, SANDBOX_NAMED, 199 int error = sandbox::Seatbelt::Init(
200 &error_buff); 200 sandbox::Seatbelt::kProfilePureComputation, SANDBOX_NAMED, &error_buff);
201 bool success = (error == 0 && error_buff == NULL); 201 bool success = (error == 0 && error_buff == NULL);
202 if (!success) 202 if (!success)
203 return -1; 203 return -1;
204 204
205 sandbox::Seatbelt::FreeError(error_buff); 205 sandbox::Seatbelt::FreeError(error_buff);
206 206
207 // Make sure sandbox is really enabled. 207 // Make sure sandbox is really enabled.
208 if (open(kDevZeroPath, O_RDONLY) != -1) { 208 if (open(kDevZeroPath, O_RDONLY) != -1) {
209 LOG(ERROR) << "Sandbox wasn't properly enabled"; 209 LOG(ERROR) << "Sandbox wasn't properly enabled";
210 return -1; 210 return -1;
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 base::WaitableEvent received_; 387 base::WaitableEvent received_;
388 }; 388 };
389 389
390 TEST_F(IPCMultiSendingFdsTest, StressTest) { 390 TEST_F(IPCMultiSendingFdsTest, StressTest) {
391 Run(); 391 Run();
392 } 392 }
393 393
394 } // namespace 394 } // namespace
395 395
396 #endif // defined(OS_POSIX) 396 #endif // defined(OS_POSIX)
OLDNEW
« no previous file with comments | « chrome/utility/safe_browsing/mac/crdmg.cc ('k') | sandbox/mac/seatbelt.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698