| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "content/common/sandbox_mac.h" | |
| 6 | |
| 7 #include <fcntl.h> | 5 #include <fcntl.h> |
| 8 #include <stdint.h> | 6 #include <stdint.h> |
| 9 #include <sys/stat.h> | 7 #include <sys/stat.h> |
| 10 #include <unistd.h> | 8 #include <unistd.h> |
| 11 | 9 |
| 12 #include "base/process/kill.h" | 10 #include "base/process/kill.h" |
| 13 #include "base/test/multiprocess_test.h" | 11 #include "base/test/multiprocess_test.h" |
| 14 #include "base/test/test_timeouts.h" | 12 #include "base/test/test_timeouts.h" |
| 13 #include "sandbox/mac/sandbox_compiler.h" |
| 15 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
| 16 #include "testing/multiprocess_func_list.h" | 15 #include "testing/multiprocess_func_list.h" |
| 17 | 16 |
| 18 namespace content { | 17 namespace sandbox { |
| 19 | 18 |
| 20 class SandboxMacCompilerTest : public base::MultiProcessTest {}; | 19 class SandboxMacCompilerTest : public base::MultiProcessTest {}; |
| 21 | 20 |
| 22 MULTIPROCESS_TEST_MAIN(BasicProfileProcess) { | 21 MULTIPROCESS_TEST_MAIN(BasicProfileProcess) { |
| 23 std::string profile = | 22 std::string profile = |
| 24 "(version 1)" | 23 "(version 1)" |
| 25 "(allow file-read* file-write* (literal \"/\"))"; | 24 "(allow file-read* file-write* (literal \"/\"))"; |
| 26 | 25 |
| 27 SandboxCompiler compiler(profile); | 26 SandboxCompiler compiler(profile); |
| 28 | 27 |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 | 150 |
| 152 TEST_F(SandboxMacCompilerTest, ProfileFunctionalityTestError) { | 151 TEST_F(SandboxMacCompilerTest, ProfileFunctionalityTestError) { |
| 153 base::Process process = SpawnChild("ProfileFunctionalityTestErrorProcess"); | 152 base::Process process = SpawnChild("ProfileFunctionalityTestErrorProcess"); |
| 154 ASSERT_TRUE(process.IsValid()); | 153 ASSERT_TRUE(process.IsValid()); |
| 155 int exit_code = 42; | 154 int exit_code = 42; |
| 156 EXPECT_TRUE(process.WaitForExitWithTimeout(TestTimeouts::action_max_timeout(), | 155 EXPECT_TRUE(process.WaitForExitWithTimeout(TestTimeouts::action_max_timeout(), |
| 157 &exit_code)); | 156 &exit_code)); |
| 158 EXPECT_EQ(exit_code, 0); | 157 EXPECT_EQ(exit_code, 0); |
| 159 } | 158 } |
| 160 | 159 |
| 161 } // namespace content | 160 } // namespace sandbox |
| OLD | NEW |