| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_unittest_helper.h" | 5 #include "content/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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 | 49 |
| 50 } // namespace internal | 50 } // namespace internal |
| 51 | 51 |
| 52 bool MacSandboxTest::RunTestInAllSandboxTypes(const char* test_name, | 52 bool MacSandboxTest::RunTestInAllSandboxTypes(const char* test_name, |
| 53 const char* test_data) { | 53 const char* test_data) { |
| 54 // Go through all the sandbox types, and run the test case in each of them | 54 // Go through all the sandbox types, and run the test case in each of them |
| 55 // if one fails, abort. | 55 // if one fails, abort. |
| 56 for(int i = static_cast<int>(SANDBOX_TYPE_FIRST_TYPE); | 56 for(int i = static_cast<int>(SANDBOX_TYPE_FIRST_TYPE); |
| 57 i < SANDBOX_TYPE_AFTER_LAST_TYPE; | 57 i < SANDBOX_TYPE_AFTER_LAST_TYPE; |
| 58 ++i) { | 58 ++i) { |
| 59 // This sandbox type is not enforced using a Seatbelt policy. |
| 60 if (i == SANDBOX_TYPE_NPAPI) |
| 61 continue; |
| 59 | 62 |
| 60 if (!RunTestInSandbox(static_cast<SandboxType>(i), | 63 if (!RunTestInSandbox(static_cast<SandboxType>(i), |
| 61 test_name, test_data)) { | 64 test_name, test_data)) { |
| 62 LOG(ERROR) << "Sandboxed test (" << test_name << ")" << | 65 LOG(ERROR) << "Sandboxed test (" << test_name << ")" << |
| 63 "Failed in sandbox type " << i << | 66 "Failed in sandbox type " << i << |
| 64 "user data: (" << test_data << ")"; | 67 "user data: (" << test_data << ")"; |
| 65 return false; | 68 return false; |
| 66 } | 69 } |
| 67 } | 70 } |
| 68 return true; | 71 return true; |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 | 164 |
| 162 if (!test_case->SandboxedTest()) { | 165 if (!test_case->SandboxedTest()) { |
| 163 LOG(ERROR) << sandbox_test_name << "Failed sandboxed test"; | 166 LOG(ERROR) << sandbox_test_name << "Failed sandboxed test"; |
| 164 return -1; | 167 return -1; |
| 165 } | 168 } |
| 166 | 169 |
| 167 return 0; | 170 return 0; |
| 168 } | 171 } |
| 169 | 172 |
| 170 } // namespace content | 173 } // namespace content |
| OLD | NEW |