| OLD | NEW |
| 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 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 #if ENABLE(SECURITY_ASSERT) | 29 #if ENABLE(SECURITY_ASSERT) |
| 30 EXPECT_DEATH_IF_SUPPORTED(SECURITY_DCHECK(false), ""); | 30 EXPECT_DEATH_IF_SUPPORTED(SECURITY_DCHECK(false), ""); |
| 31 #else | 31 #else |
| 32 SECURITY_DCHECK(false); | 32 SECURITY_DCHECK(false); |
| 33 #endif | 33 #endif |
| 34 | 34 |
| 35 SECURITY_CHECK(true); | 35 SECURITY_CHECK(true); |
| 36 EXPECT_DEATH_IF_SUPPORTED(SECURITY_CHECK(false), ""); | 36 EXPECT_DEATH_IF_SUPPORTED(SECURITY_CHECK(false), ""); |
| 37 }; | 37 }; |
| 38 | 38 |
| 39 #if !LOG_DISABLED | 39 #if DCHECK_IS_ON() |
| 40 static const int kPrinterBufferSize = 256; | 40 static const int kPrinterBufferSize = 256; |
| 41 static char g_buffer[kPrinterBufferSize]; | 41 static char g_buffer[kPrinterBufferSize]; |
| 42 static StringBuilder g_builder; | 42 static StringBuilder g_builder; |
| 43 | 43 |
| 44 static void Vprint(const char* format, va_list args) { | 44 static void Vprint(const char* format, va_list args) { |
| 45 int written = vsnprintf(g_buffer, kPrinterBufferSize, format, args); | 45 int written = vsnprintf(g_buffer, kPrinterBufferSize, format, args); |
| 46 if (written > 0 && written < kPrinterBufferSize) | 46 if (written > 0 && written < kPrinterBufferSize) |
| 47 g_builder.Append(g_buffer); | 47 g_builder.Append(g_buffer); |
| 48 } | 48 } |
| 49 | 49 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 64 | 64 |
| 65 EXPECT_EQ( | 65 EXPECT_EQ( |
| 66 "( a1\n" | 66 "( a1\n" |
| 67 " ( c\n" | 67 " ( c\n" |
| 68 " ( d -1 hello )\n" | 68 " ( d -1 hello )\n" |
| 69 " )\n" | 69 " )\n" |
| 70 " a2 0.5\n" | 70 " a2 0.5\n" |
| 71 ")\n", | 71 ")\n", |
| 72 g_builder.ToString()); | 72 g_builder.ToString()); |
| 73 }; | 73 }; |
| 74 #endif // !LOG_DISABLED | 74 #endif // DCHECK_IS_ON() |
| 75 | 75 |
| 76 } // namespace WTF | 76 } // namespace WTF |
| OLD | NEW |