| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 SANDBOX_LINUX_TESTS_UNIT_TESTS_H_ | 5 #ifndef SANDBOX_LINUX_TESTS_UNIT_TESTS_H_ |
| 6 #define SANDBOX_LINUX_TESTS_UNIT_TESTS_H_ | 6 #define SANDBOX_LINUX_TESTS_UNIT_TESTS_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
| 10 #include "sandbox/linux/tests/sandbox_test_runner_function_pointer.h" | 10 #include "sandbox/linux/tests/sandbox_test_runner_function_pointer.h" |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 static void AssertionFailure(const char* expr, const char* file, int line); | 141 static void AssertionFailure(const char* expr, const char* file, int line); |
| 142 | 142 |
| 143 // Sometimes we determine at run-time that a test should be disabled. | 143 // Sometimes we determine at run-time that a test should be disabled. |
| 144 // Call this method if we want to return from a test and completely | 144 // Call this method if we want to return from a test and completely |
| 145 // ignore its results. | 145 // ignore its results. |
| 146 // You should not call this method, if the test already ran any test-relevant | 146 // You should not call this method, if the test already ran any test-relevant |
| 147 // code. Most notably, you should not call it, you already wrote any messages | 147 // code. Most notably, you should not call it, you already wrote any messages |
| 148 // to stderr. | 148 // to stderr. |
| 149 static void IgnoreThisTest(); | 149 static void IgnoreThisTest(); |
| 150 | 150 |
| 151 // A DeathCheck method that verifies that the test completed succcessfully. | 151 // A DeathCheck method that verifies that the test completed successfully. |
| 152 // This is the default test mode for SANDBOX_TEST(). The "aux" parameter | 152 // This is the default test mode for SANDBOX_TEST(). The "aux" parameter |
| 153 // of this DeathCheck is unused (and thus unnamed) | 153 // of this DeathCheck is unused (and thus unnamed) |
| 154 static void DeathSuccess(int status, const std::string& msg, const void*); | 154 static void DeathSuccess(int status, const std::string& msg, const void*); |
| 155 | 155 |
| 156 // A DeathCheck method that verifies that the test completed succcessfully | 156 // A DeathCheck method that verifies that the test completed successfully |
| 157 // allowing for log error messages. | 157 // allowing for log error messages. |
| 158 static void DeathSuccessAllowNoise(int status, | 158 static void DeathSuccessAllowNoise(int status, |
| 159 const std::string& msg, | 159 const std::string& msg, |
| 160 const void*); | 160 const void*); |
| 161 | 161 |
| 162 // A DeathCheck method that verifies that the test completed with error | 162 // A DeathCheck method that verifies that the test completed with error |
| 163 // code "1" and printed a message containing a particular substring. The | 163 // code "1" and printed a message containing a particular substring. The |
| 164 // "aux" pointer should point to a C-string containing the expected error | 164 // "aux" pointer should point to a C-string containing the expected error |
| 165 // message. This method is useful for checking assertion failures such as | 165 // message. This method is useful for checking assertion failures such as |
| 166 // in SANDBOX_ASSERT() and/or SANDBOX_DIE(). | 166 // in SANDBOX_ASSERT() and/or SANDBOX_DIE(). |
| (...skipping 25 matching lines...) Expand all Loading... |
| 192 const std::string& msg, | 192 const std::string& msg, |
| 193 const void* aux); | 193 const void* aux); |
| 194 | 194 |
| 195 private: | 195 private: |
| 196 DISALLOW_IMPLICIT_CONSTRUCTORS(UnitTests); | 196 DISALLOW_IMPLICIT_CONSTRUCTORS(UnitTests); |
| 197 }; | 197 }; |
| 198 | 198 |
| 199 } // namespace | 199 } // namespace |
| 200 | 200 |
| 201 #endif // SANDBOX_LINUX_TESTS_UNIT_TESTS_H_ | 201 #endif // SANDBOX_LINUX_TESTS_UNIT_TESTS_H_ |
| OLD | NEW |