| 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; | |
| 62 | |
| 63 if (!RunTestInSandbox(static_cast<SandboxType>(i), | 59 if (!RunTestInSandbox(static_cast<SandboxType>(i), |
| 64 test_name, test_data)) { | 60 test_name, test_data)) { |
| 65 LOG(ERROR) << "Sandboxed test (" << test_name << ")" << | 61 LOG(ERROR) << "Sandboxed test (" << test_name << ")" << |
| 66 "Failed in sandbox type " << i << | 62 "Failed in sandbox type " << i << |
| 67 "user data: (" << test_data << ")"; | 63 "user data: (" << test_data << ")"; |
| 68 return false; | 64 return false; |
| 69 } | 65 } |
| 70 } | 66 } |
| 71 return true; | 67 return true; |
| 72 } | 68 } |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 | 160 |
| 165 if (!test_case->SandboxedTest()) { | 161 if (!test_case->SandboxedTest()) { |
| 166 LOG(ERROR) << sandbox_test_name << "Failed sandboxed test"; | 162 LOG(ERROR) << sandbox_test_name << "Failed sandboxed test"; |
| 167 return -1; | 163 return -1; |
| 168 } | 164 } |
| 169 | 165 |
| 170 return 0; | 166 return 0; |
| 171 } | 167 } |
| 172 | 168 |
| 173 } // namespace content | 169 } // namespace content |
| OLD | NEW |