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/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
11 | 11 |
12 namespace sandbox { | 12 namespace sandbox { |
13 | 13 |
14 // Has this been compiled to run on Android? | 14 // Has this been compiled to run on Android? |
15 bool IsAndroid(); | 15 bool IsAndroid(); |
16 | 16 |
17 bool IsArchitectureArm(); | 17 bool IsArchitectureArm(); |
18 | 18 |
19 // Is Valgrind currently being used? | 19 // Is Valgrind currently being used? |
20 bool IsRunningOnValgrind(); | 20 bool IsRunningOnValgrind(); |
21 | 21 |
22 #if defined(THREAD_SANITIZER) | 22 #if defined(THREAD_SANITIZER) |
23 #define DISABLE_ON_TSAN(test_name) DISABLED_##test_name | 23 #define DISABLE_ON_TSAN(test_name) DISABLED_##test_name |
24 #else | 24 #else |
25 #define DISABLE_ON_TSAN(test_name) test_name | 25 #define DISABLE_ON_TSAN(test_name) test_name |
26 #endif // defined(THREAD_SANITIZER) | 26 #endif // defined(THREAD_SANITIZER) |
27 | 27 |
| 28 #if defined(OS_ANDROID) |
| 29 #define DISABLE_ON_ANDROID(test_name) DISABLED_##test_name |
| 30 #else |
| 31 #define DISABLE_ON_ANDROID(test_name) test_name |
| 32 #endif |
| 33 |
28 // While it is perfectly OK for a complex test to provide its own DeathCheck | 34 // While it is perfectly OK for a complex test to provide its own DeathCheck |
29 // function. Most death tests have very simple requirements. These tests should | 35 // function. Most death tests have very simple requirements. These tests should |
30 // use one of the predefined DEATH_XXX macros as an argument to | 36 // use one of the predefined DEATH_XXX macros as an argument to |
31 // SANDBOX_DEATH_TEST(). You can check for a (sub-)string in the output of the | 37 // SANDBOX_DEATH_TEST(). You can check for a (sub-)string in the output of the |
32 // test, for a particular exit code, or for a particular death signal. | 38 // test, for a particular exit code, or for a particular death signal. |
33 // NOTE: If you do decide to write your own DeathCheck, make sure to use | 39 // NOTE: If you do decide to write your own DeathCheck, make sure to use |
34 // gtests's ASSERT_XXX() macros instead of SANDBOX_ASSERT(). See | 40 // gtests's ASSERT_XXX() macros instead of SANDBOX_ASSERT(). See |
35 // unit_tests.cc for examples. | 41 // unit_tests.cc for examples. |
36 #define DEATH_SUCCESS() sandbox::UnitTests::DeathSuccess, NULL | 42 #define DEATH_SUCCESS() sandbox::UnitTests::DeathSuccess, NULL |
37 #define DEATH_MESSAGE(msg) \ | 43 #define DEATH_MESSAGE(msg) \ |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 const std::string& msg, | 132 const std::string& msg, |
127 const void* aux); | 133 const void* aux); |
128 | 134 |
129 private: | 135 private: |
130 DISALLOW_IMPLICIT_CONSTRUCTORS(UnitTests); | 136 DISALLOW_IMPLICIT_CONSTRUCTORS(UnitTests); |
131 }; | 137 }; |
132 | 138 |
133 } // namespace | 139 } // namespace |
134 | 140 |
135 #endif // SANDBOX_LINUX_TESTS_UNIT_TESTS_H__ | 141 #endif // SANDBOX_LINUX_TESTS_UNIT_TESTS_H__ |
OLD | NEW |