summaryrefslogtreecommitdiff
path: root/chromium/third_party/blink/renderer/platform/wtf/assertions_test.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/third_party/blink/renderer/platform/wtf/assertions_test.cc')
-rw-r--r--chromium/third_party/blink/renderer/platform/wtf/assertions_test.cc38
1 files changed, 38 insertions, 0 deletions
diff --git a/chromium/third_party/blink/renderer/platform/wtf/assertions_test.cc b/chromium/third_party/blink/renderer/platform/wtf/assertions_test.cc
new file mode 100644
index 00000000000..c242681558f
--- /dev/null
+++ b/chromium/third_party/blink/renderer/platform/wtf/assertions_test.cc
@@ -0,0 +1,38 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "third_party/blink/renderer/platform/wtf/assertions.h"
+
+#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/blink/renderer/platform/wtf/text/string_builder.h"
+
+namespace WTF {
+
+TEST(AssertionsTest, Assertions) {
+ DCHECK(true);
+#if DCHECK_IS_ON()
+ EXPECT_DEATH_IF_SUPPORTED(DCHECK(false), "");
+ EXPECT_DEATH_IF_SUPPORTED(NOTREACHED(), "");
+ EXPECT_DEATH_IF_SUPPORTED(DCHECK_AT(false, __FILE__, __LINE__), "");
+#else
+ DCHECK(false);
+ NOTREACHED();
+ DCHECK_AT(false, __FILE__, __LINE__);
+#endif
+
+ CHECK(true);
+ EXPECT_DEATH_IF_SUPPORTED(CHECK(false), "");
+
+ SECURITY_DCHECK(true);
+#if ENABLE_SECURITY_ASSERT
+ EXPECT_DEATH_IF_SUPPORTED(SECURITY_DCHECK(false), "");
+#else
+ SECURITY_DCHECK(false);
+#endif
+
+ SECURITY_CHECK(true);
+ EXPECT_DEATH_IF_SUPPORTED(SECURITY_CHECK(false), "");
+};
+
+} // namespace WTF