| 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 #include "sandbox/linux/syscall_broker/broker_process.h" | 5 #include "sandbox/linux/syscall_broker/broker_process.h" |
| 6 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 #include <fcntl.h> | 8 #include <fcntl.h> |
| 9 #include <sys/resource.h> | 9 #include <sys/resource.h> |
| 10 #include <sys/stat.h> | 10 #include <sys/stat.h> |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 #include "base/memory/scoped_ptr.h" | 24 #include "base/memory/scoped_ptr.h" |
| 25 #include "base/posix/eintr_wrapper.h" | 25 #include "base/posix/eintr_wrapper.h" |
| 26 #include "base/posix/unix_domain_socket_linux.h" | 26 #include "base/posix/unix_domain_socket_linux.h" |
| 27 #include "sandbox/linux/tests/scoped_temporary_file.h" | 27 #include "sandbox/linux/tests/scoped_temporary_file.h" |
| 28 #include "sandbox/linux/tests/test_utils.h" | 28 #include "sandbox/linux/tests/test_utils.h" |
| 29 #include "sandbox/linux/tests/unit_tests.h" | 29 #include "sandbox/linux/tests/unit_tests.h" |
| 30 #include "testing/gtest/include/gtest/gtest.h" | 30 #include "testing/gtest/include/gtest/gtest.h" |
| 31 | 31 |
| 32 namespace sandbox { | 32 namespace sandbox { |
| 33 | 33 |
| 34 namespace syscall_broker { |
| 35 |
| 34 class BrokerProcessTestHelper { | 36 class BrokerProcessTestHelper { |
| 35 public: | 37 public: |
| 36 static int get_ipc_socketpair(const BrokerProcess* broker) { | 38 static int get_ipc_socketpair(const BrokerProcess* broker) { |
| 37 return broker->ipc_socketpair_; | 39 return broker->ipc_socketpair_; |
| 38 } | 40 } |
| 39 }; | 41 }; |
| 40 | 42 |
| 41 namespace { | 43 namespace { |
| 42 | 44 |
| 43 bool NoOpCallback() { | 45 bool NoOpCallback() { |
| (...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 465 for (rlim_t i = 0; i < fd_limit; ++i) { | 467 for (rlim_t i = 0; i < fd_limit; ++i) { |
| 466 SANDBOX_ASSERT( | 468 SANDBOX_ASSERT( |
| 467 UnixDomainSocket::SendMsg(ipc_fd, kBogus, sizeof(kBogus), fds)); | 469 UnixDomainSocket::SendMsg(ipc_fd, kBogus, sizeof(kBogus), fds)); |
| 468 } | 470 } |
| 469 | 471 |
| 470 const int fd = open_broker.Open(kCpuInfo, O_RDONLY); | 472 const int fd = open_broker.Open(kCpuInfo, O_RDONLY); |
| 471 SANDBOX_ASSERT(fd >= 0); | 473 SANDBOX_ASSERT(fd >= 0); |
| 472 SANDBOX_ASSERT(0 == IGNORE_EINTR(close(fd))); | 474 SANDBOX_ASSERT(0 == IGNORE_EINTR(close(fd))); |
| 473 } | 475 } |
| 474 | 476 |
| 477 } // namespace syscall_broker |
| 478 |
| 475 } // namespace sandbox | 479 } // namespace sandbox |
| OLD | NEW |