Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(310)

Unified Diff: util/misc/scoped_forbid_return_test.cc

Issue 992693003: Add ASSERT_DEATH_CHECK() to do ASSERT_DEATH() of CHECK() failures (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Address review feedback Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « util/misc/initialization_state_dcheck_test.cc ('k') | util/net/http_multipart_builder_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: util/misc/scoped_forbid_return_test.cc
diff --git a/util/misc/scoped_forbid_return_test.cc b/util/misc/scoped_forbid_return_test.cc
index 9a1b6d907c841db49d90b818350f74e9af5998cb..93a3e3279e7f1d812acd36500fe1d0870e986bac 100644
--- a/util/misc/scoped_forbid_return_test.cc
+++ b/util/misc/scoped_forbid_return_test.cc
@@ -14,7 +14,9 @@
#include "util/misc/scoped_forbid_return.h"
+#include "base/compiler_specific.h"
#include "gtest/gtest.h"
+#include "util/test/gtest_death_check.h"
namespace crashpad {
namespace test {
@@ -44,12 +46,17 @@ void ScopedForbidReturnHelper(ForbidReturnType type) {
const char kForbiddenMessage[] = "attempt to exit scope forbidden";
TEST(ScopedForbidReturnDeathTest, Default) {
- ASSERT_DEATH(ScopedForbidReturnHelper(kForbidReturnDefault),
- kForbiddenMessage);
+ // kForbiddenMessage may appear to be unused if ASSERT_DEATH_CHECK() throws it
+ // away.
+ ALLOW_UNUSED_LOCAL(kForbiddenMessage);
+
+ ASSERT_DEATH_CHECK(ScopedForbidReturnHelper(kForbidReturnDefault),
+ kForbiddenMessage);
}
TEST(ScopedForbidReturnDeathTest, Armed) {
- ASSERT_DEATH(ScopedForbidReturnHelper(kForbidReturnArmed), kForbiddenMessage);
+ ASSERT_DEATH_CHECK(ScopedForbidReturnHelper(kForbidReturnArmed),
+ kForbiddenMessage);
}
TEST(ScopedForbidReturn, Disarmed) {
« no previous file with comments | « util/misc/initialization_state_dcheck_test.cc ('k') | util/net/http_multipart_builder_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698