Index: base/test/gtest_util.h |
diff --git a/base/test/gtest_util.h b/base/test/gtest_util.h |
index f353d8364307dfc39269d71e6d84a448f6cb93b7..c39657cf7b532738a59850ea5f464ad2b46c1ce5 100644 |
--- a/base/test/gtest_util.h |
+++ b/base/test/gtest_util.h |
@@ -10,6 +10,23 @@ |
#include <vector> |
#include "base/compiler_specific.h" |
+#include "base/logging.h" |
+#include "build/build_config.h" |
+#include "testing/gtest/include/gtest/gtest.h" |
+ |
+// EXPECT/ASSERT_DCHECK_DEATH is intended to replace EXPECT/ASSERT_DEBUG_DEATH |
+// when the death is expected to be caused by a DCHECK. Contrary to |
+// EXPECT/ASSERT_DEBUG_DEATH however, it doesn't execute the statement in non- |
+// dcheck builds as DCHECKs are intended to catch things that should never |
+// happen and as such executing the statement results in undefined behavior. |
+// Death tests misbehave on Android. |
danakj
2016/07/20 19:33:45
Can you point to a bug or write something more abo
gab
2016/07/20 21:21:08
I don't know either, but a few did mentioned this.
|
+#if DCHECK_IS_ON() && defined(GTEST_HAS_DEATH_TEST) && !defined(OS_ANDROID) |
+#define EXPECT_DCHECK_DEATH(statement, regex) EXPECT_DEATH(statement, regex) |
+#define ASSERT_DCHECK_DEATH(statement, regex) ASSERT_DEATH(statement, regex) |
+#else |
+#define EXPECT_DCHECK_DEATH(statement, regex) |
+#define ASSERT_DCHECK_DEATH(statement, regex) |
+#endif |
namespace base { |