summaryrefslogtreecommitdiff
path: root/chromium/third_party/blink/renderer/platform/wtf/assertions_test.cc
blob: c242681558f7f5d6425247e3874d19dd0a898b36 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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