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_RUNNER_H_ | 5 #ifndef CHROME_COMMON_SANDBOX_MAC_UNITTEST_RUNNER_H_ |
6 #define CHROME_COMMON_SANDBOX_MAC_UNITTEST_RUNNER_H_ | 6 #define CHROME_COMMON_SANDBOX_MAC_UNITTEST_RUNNER_H_ |
7 | 7 |
8 #include "base/multiprocess_test.h" | 8 #include "base/multiprocess_test.h" |
9 #include "chrome/common/sandbox_mac.h" | 9 #include "chrome/common/sandbox_mac.h" |
10 | 10 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 const char* test_data); | 62 const char* test_data); |
63 }; | 63 }; |
64 | 64 |
65 // Class to ease writing test cases that run inside the OS X sandbox. | 65 // Class to ease writing test cases that run inside the OS X sandbox. |
66 // This class is instantiated in a subprocess, and allows you to run test code | 66 // This class is instantiated in a subprocess, and allows you to run test code |
67 // at various stages of execution. | 67 // at various stages of execution. |
68 // Note that you must register the subclass you create with the | 68 // Note that you must register the subclass you create with the |
69 // REGISTER_SANDBOX_TEST_CASE so it's visible to the test driver. | 69 // REGISTER_SANDBOX_TEST_CASE so it's visible to the test driver. |
70 class MacSandboxTestCase { | 70 class MacSandboxTestCase { |
71 public: | 71 public: |
| 72 virtual ~MacSandboxTestCase() {} |
| 73 |
72 // Code that runs in the sandboxed subprocess before the sandbox is | 74 // Code that runs in the sandboxed subprocess before the sandbox is |
73 // initialized. | 75 // initialized. |
74 // Returning false from this function will cause the entire test case to fail. | 76 // Returning false from this function will cause the entire test case to fail. |
75 virtual bool BeforeSandboxInit() { return true; }; | 77 virtual bool BeforeSandboxInit() { return true; }; |
76 | 78 |
77 // Code that runs in the sandboxed subprocess when the sandbox has been | 79 // Code that runs in the sandboxed subprocess when the sandbox has been |
78 // enabled. | 80 // enabled. |
79 // Returning false from this function will cause the entire test case to fail. | 81 // Returning false from this function will cause the entire test case to fail. |
80 virtual bool SandboxedTest() = 0; | 82 virtual bool SandboxedTest() = 0; |
81 | 83 |
(...skipping 23 matching lines...) Expand all Loading... |
105 namespace { \ | 107 namespace { \ |
106 sandboxtest::internal::RegisterSandboxTest<class_name> \ | 108 sandboxtest::internal::RegisterSandboxTest<class_name> \ |
107 register_test##class_name(#class_name); \ | 109 register_test##class_name(#class_name); \ |
108 } // namespace | 110 } // namespace |
109 | 111 |
110 } // namespace internal | 112 } // namespace internal |
111 | 113 |
112 } // namespace sandboxtest | 114 } // namespace sandboxtest |
113 | 115 |
114 #endif // CHROME_COMMON_SANDBOX_MAC_UNITTEST_RUNNER_H_ | 116 #endif // CHROME_COMMON_SANDBOX_MAC_UNITTEST_RUNNER_H_ |
OLD | NEW |