| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 BASE_TEST_GTEST_UTIL_H_ | 5 #ifndef BASE_TEST_GTEST_UTIL_H_ |
| 6 #define BASE_TEST_GTEST_UTIL_H_ | 6 #define BASE_TEST_GTEST_UTIL_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/logging.h" | 13 #include "base/logging.h" |
| 14 #include "build/build_config.h" | 14 #include "build/build_config.h" |
| 15 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
| 16 | 16 |
| 17 // EXPECT/ASSERT_DCHECK_DEATH is intended to replace EXPECT/ASSERT_DEBUG_DEATH | 17 // EXPECT/ASSERT_DCHECK_DEATH is intended to replace EXPECT/ASSERT_DEBUG_DEATH |
| 18 // when the death is expected to be caused by a DCHECK. Contrary to | 18 // when the death is expected to be caused by a DCHECK. Contrary to |
| 19 // EXPECT/ASSERT_DEBUG_DEATH however, it doesn't execute the statement in non- | 19 // EXPECT/ASSERT_DEBUG_DEATH however, it doesn't execute the statement in non- |
| 20 // dcheck builds as DCHECKs are intended to catch things that should never | 20 // dcheck builds as DCHECKs are intended to catch things that should never |
| 21 // happen and as such executing the statement results in undefined behavior | 21 // happen and as such executing the statement results in undefined behavior |
| 22 // (|statement| is compiled in unsupported configurations nonetheless). | 22 // (|statement| is compiled in unsupported configurations nonetheless). |
| 23 // Death tests misbehave on Android. | 23 // Death tests misbehave on Android. |
| 24 #if DCHECK_IS_ON() && defined(GTEST_HAS_DEATH_TEST) && !defined(OS_ANDROID) | 24 #if DCHECK_IS_ON() && defined(GTEST_HAS_DEATH_TEST) && !defined(OS_ANDROID) && \ |
| 25 !defined(DCHECK_IS_DUMP_WITHOUT_CRASH) |
| 25 | 26 |
| 26 // EXPECT/ASSERT_DCHECK_DEATH tests verify that a DCHECK is hit ("Check failed" | 27 // EXPECT/ASSERT_DCHECK_DEATH tests verify that a DCHECK is hit ("Check failed" |
| 27 // is part of the error message), but intentionally do not expose the gtest | 28 // is part of the error message), but intentionally do not expose the gtest |
| 28 // death test's full |regex| parameter to avoid users having to verify the exact | 29 // death test's full |regex| parameter to avoid users having to verify the exact |
| 29 // syntax of the error message produced by the DCHECK. | 30 // syntax of the error message produced by the DCHECK. |
| 30 #define EXPECT_DCHECK_DEATH(statement) EXPECT_DEATH(statement, "Check failed") | 31 #define EXPECT_DCHECK_DEATH(statement) EXPECT_DEATH(statement, "Check failed") |
| 31 #define ASSERT_DCHECK_DEATH(statement) ASSERT_DEATH(statement, "Check failed") | 32 #define ASSERT_DCHECK_DEATH(statement) ASSERT_DEATH(statement, "Check failed") |
| 32 | 33 |
| 33 #else | 34 #else |
| 34 // DCHECK_IS_ON() && defined(GTEST_HAS_DEATH_TEST) && !defined(OS_ANDROID) | 35 // DCHECK_IS_ON() && defined(GTEST_HAS_DEATH_TEST) && !defined(OS_ANDROID) |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 | 94 |
| 94 // Reads the list of gtest-based tests from |path| into |output|. | 95 // Reads the list of gtest-based tests from |path| into |output|. |
| 95 // Returns true on success. | 96 // Returns true on success. |
| 96 bool ReadTestNamesFromFile( | 97 bool ReadTestNamesFromFile( |
| 97 const FilePath& path, | 98 const FilePath& path, |
| 98 std::vector<TestIdentifier>* output) WARN_UNUSED_RESULT; | 99 std::vector<TestIdentifier>* output) WARN_UNUSED_RESULT; |
| 99 | 100 |
| 100 } // namespace base | 101 } // namespace base |
| 101 | 102 |
| 102 #endif // BASE_TEST_GTEST_UTIL_H_ | 103 #endif // BASE_TEST_GTEST_UTIL_H_ |
| OLD | NEW |