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

Side by Side Diff: third_party/WebKit/Source/platform/wtf/AssertionsTest.cpp

Issue 2712823003: Various logging-related cleanups & reformatting. (Closed)
Patch Set: Fix base unit-tests Created 3 years, 6 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 unified diff | Download patch
« no previous file with comments | « base/test/gtest_util.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #include "platform/wtf/Assertions.h" 5 #include "platform/wtf/Assertions.h"
6 6
7 #include "platform/wtf/text/StringBuilder.h" 7 #include "platform/wtf/text/StringBuilder.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 #include <stdio.h> 9 #include <stdio.h>
10 10
11 namespace WTF { 11 namespace WTF {
12 12
13 TEST(AssertionsTest, Assertions) { 13 TEST(AssertionsTest, Assertions) {
14 DCHECK(true); 14 DCHECK(true);
15 #if DCHECK_IS_ON() 15 #if DCHECK_IS_ON()
16 EXPECT_DEATH_IF_SUPPORTED(DCHECK(false), ""); 16 EXPECT_DEATH_IF_SUPPORTED(DCHECK(false), "");
17 EXPECT_DEATH_IF_SUPPORTED(NOTREACHED(), ""); 17 EXPECT_DEATH_IF_SUPPORTED(NOTREACHED(), "");
18 EXPECT_DEATH_IF_SUPPORTED(DCHECK_AT(false, __FILE__, __LINE__), "");
19 #else
20 DCHECK(false);
21 NOTREACHED();
22 DCHECK_AT(false, __FILE__, __LINE__);
18 #endif 23 #endif
19 24
20 CHECK(true); 25 CHECK(true);
21 EXPECT_DEATH_IF_SUPPORTED(CHECK(false), ""); 26 EXPECT_DEATH_IF_SUPPORTED(CHECK(false), "");
22 27
23 SECURITY_DCHECK(true); 28 SECURITY_DCHECK(true);
24 #if ENABLE(SECURITY_ASSERT) 29 #if ENABLE(SECURITY_ASSERT)
25 EXPECT_DEATH_IF_SUPPORTED(SECURITY_DCHECK(false), ""); 30 EXPECT_DEATH_IF_SUPPORTED(SECURITY_DCHECK(false), "");
31 #else
32 SECURITY_DCHECK(false);
26 #endif 33 #endif
27 34
28 SECURITY_CHECK(true); 35 SECURITY_CHECK(true);
29 EXPECT_DEATH_IF_SUPPORTED(SECURITY_CHECK(false), ""); 36 EXPECT_DEATH_IF_SUPPORTED(SECURITY_CHECK(false), "");
30 }; 37 };
31 38
32 #if !LOG_DISABLED 39 #if !LOG_DISABLED
33 static const int kPrinterBufferSize = 256; 40 static const int kPrinterBufferSize = 256;
34 static char g_buffer[kPrinterBufferSize]; 41 static char g_buffer[kPrinterBufferSize];
35 static StringBuilder g_builder; 42 static StringBuilder g_builder;
(...skipping 24 matching lines...) Expand all
60 " ( c\n" 67 " ( c\n"
61 " ( d -1 hello )\n" 68 " ( d -1 hello )\n"
62 " )\n" 69 " )\n"
63 " a2 0.5\n" 70 " a2 0.5\n"
64 ")\n", 71 ")\n",
65 g_builder.ToString()); 72 g_builder.ToString());
66 }; 73 };
67 #endif // !LOG_DISABLED 74 #endif // !LOG_DISABLED
68 75
69 } // namespace WTF 76 } // namespace WTF
OLDNEW
« no previous file with comments | « base/test/gtest_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698