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/services/broker_process.h" | 5 #include "sandbox/linux/services/broker_process.h" |
6 | 6 |
7 #include <errno.h> | 7 #include <errno.h> |
8 #include <fcntl.h> | 8 #include <fcntl.h> |
9 #include <sys/stat.h> | 9 #include <sys/stat.h> |
10 #include <sys/types.h> | 10 #include <sys/types.h> |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 private: | 58 private: |
59 int fd_; | 59 int fd_; |
60 char full_file_name_[128]; | 60 char full_file_name_[128]; |
61 DISALLOW_COPY_AND_ASSIGN(ScopedTemporaryFile); | 61 DISALLOW_COPY_AND_ASSIGN(ScopedTemporaryFile); |
62 }; | 62 }; |
63 | 63 |
64 bool NoOpCallback() { return true; } | 64 bool NoOpCallback() { return true; } |
65 | 65 |
66 } // namespace | 66 } // namespace |
67 | 67 |
68 #if defined(OS_ANDROID) | |
69 #define DISABLE_ON_ANDROID(function) DISABLED_##function | |
70 #else | |
71 #define DISABLE_ON_ANDROID(function) function | |
72 #endif | |
73 | |
74 TEST(BrokerProcess, CreateAndDestroy) { | 68 TEST(BrokerProcess, CreateAndDestroy) { |
75 std::vector<std::string> read_whitelist; | 69 std::vector<std::string> read_whitelist; |
76 read_whitelist.push_back("/proc/cpuinfo"); | 70 read_whitelist.push_back("/proc/cpuinfo"); |
77 | 71 |
78 scoped_ptr<BrokerProcess> open_broker( | 72 scoped_ptr<BrokerProcess> open_broker( |
79 new BrokerProcess(EPERM, read_whitelist, std::vector<std::string>())); | 73 new BrokerProcess(EPERM, read_whitelist, std::vector<std::string>())); |
80 ASSERT_TRUE(open_broker->Init(base::Bind(&NoOpCallback))); | 74 ASSERT_TRUE(open_broker->Init(base::Bind(&NoOpCallback))); |
81 pid_t broker_pid = open_broker->broker_pid(); | 75 pid_t broker_pid = open_broker->broker_pid(); |
82 | 76 |
83 // Destroy the broker and check it has exited properly. | 77 // Destroy the broker and check it has exited properly. |
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
438 // expected. | 432 // expected. |
439 } | 433 } |
440 | 434 |
441 TEST(BrokerProcess, OpenComplexFlagsNoClientCheck) { | 435 TEST(BrokerProcess, OpenComplexFlagsNoClientCheck) { |
442 TestOpenComplexFlags(false /* fast_check_in_client */); | 436 TestOpenComplexFlags(false /* fast_check_in_client */); |
443 // Don't do anything here, so that ASSERT works in the subfunction as | 437 // Don't do anything here, so that ASSERT works in the subfunction as |
444 // expected. | 438 // expected. |
445 } | 439 } |
446 | 440 |
447 } // namespace sandbox | 441 } // namespace sandbox |
OLD | NEW |