| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #ifndef CHROME_COMMON_SANDBOX_MAC_UNITTEST_HELPER_H_ | 5 #ifndef CHROME_COMMON_SANDBOX_MAC_UNITTEST_HELPER_H_ |
| 6 #define CHROME_COMMON_SANDBOX_MAC_UNITTEST_HELPER_H_ | 6 #define CHROME_COMMON_SANDBOX_MAC_UNITTEST_HELPER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/test/multiprocess_test.h" | 9 #include "base/test/multiprocess_test.h" |
| 10 #include "chrome/common/sandbox_mac.h" | 10 #include "chrome/common/sandbox_mac.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 | 43 |
| 44 // Base test type with helper functions to spawn a subprocess that exercises | 44 // Base test type with helper functions to spawn a subprocess that exercises |
| 45 // a given test in the sandbox. | 45 // a given test in the sandbox. |
| 46 class MacSandboxTest : public base::MultiProcessTest { | 46 class MacSandboxTest : public base::MultiProcessTest { |
| 47 public: | 47 public: |
| 48 // Runs a test specified by |test_name| in a sandbox of the type specified | 48 // Runs a test specified by |test_name| in a sandbox of the type specified |
| 49 // by |sandbox_type|. |test_data| is a custom string that a test can pass | 49 // by |sandbox_type|. |test_data| is a custom string that a test can pass |
| 50 // to the child process runing in the sandbox. | 50 // to the child process runing in the sandbox. |
| 51 // Returns true if the test passes, false if either of the functions in | 51 // Returns true if the test passes, false if either of the functions in |
| 52 // the corresponding MacSandboxTestCase return false. | 52 // the corresponding MacSandboxTestCase return false. |
| 53 bool RunTestInSandbox(sandbox::SandboxProcessType sandbox_type, | 53 bool RunTestInSandbox(sandbox::Sandbox::SandboxProcessType sandbox_type, |
| 54 const char* test_name, | 54 const char* test_name, |
| 55 const char* test_data); | 55 const char* test_data); |
| 56 | 56 |
| 57 // Runs the test specified by |test_name| in all the different sandbox types, | 57 // Runs the test specified by |test_name| in all the different sandbox types, |
| 58 // one by one. | 58 // one by one. |
| 59 // Returns true if the test passes, false if either of the functions in | 59 // Returns true if the test passes, false if either of the functions in |
| 60 // the corresponding MacSandboxTestCase return false in any of the spawned | 60 // the corresponding MacSandboxTestCase return false in any of the spawned |
| 61 // processes. | 61 // processes. |
| 62 bool RunTestInAllSandboxTypes(const char* test_name, | 62 bool RunTestInAllSandboxTypes(const char* test_name, |
| 63 const char* test_data); | 63 const char* test_data); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 namespace { \ | 108 namespace { \ |
| 109 sandboxtest::internal::RegisterSandboxTest<class_name> \ | 109 sandboxtest::internal::RegisterSandboxTest<class_name> \ |
| 110 register_test##class_name(#class_name); \ | 110 register_test##class_name(#class_name); \ |
| 111 } // namespace | 111 } // namespace |
| 112 | 112 |
| 113 } // namespace internal | 113 } // namespace internal |
| 114 | 114 |
| 115 } // namespace sandboxtest | 115 } // namespace sandboxtest |
| 116 | 116 |
| 117 #endif // CHROME_COMMON_SANDBOX_MAC_UNITTEST_HELPER_H_ | 117 #endif // CHROME_COMMON_SANDBOX_MAC_UNITTEST_HELPER_H_ |
| OLD | NEW |