| Index: base/logging_unittest.cc
|
| diff --git a/base/logging_unittest.cc b/base/logging_unittest.cc
|
| index f41cce2f43b390fa9603a14f3f689fe87d0dcb33..1814065567104e2374b5f1620ba298c14f8349cd 100644
|
| --- a/base/logging_unittest.cc
|
| +++ b/base/logging_unittest.cc
|
| @@ -3,6 +3,7 @@
|
| // found in the LICENSE file.
|
|
|
| #include "base/compiler_specific.h"
|
| +#include "base/debug/dump_without_crashing.h"
|
| #include "base/logging.h"
|
| #include "base/macros.h"
|
|
|
| @@ -191,7 +192,7 @@ TEST_F(LoggingTest, CheckStreamsAreLazy) {
|
| #endif
|
|
|
| TEST_F(LoggingTest, DebugLoggingReleaseBehavior) {
|
| -#if !defined(NDEBUG) || defined(DCHECK_ALWAYS_ON)
|
| +#if DCHECK_IS_ON()
|
| int debug_only_variable = 1;
|
| #endif
|
| // These should avoid emitting references to |debug_only_variable|
|
| @@ -326,6 +327,29 @@ TEST_F(LoggingTest, CheckEqStatements) {
|
| CHECK_EQ(false, true); // Unreached.
|
| }
|
|
|
| +namespace {
|
| +
|
| +int fake_dump_without_crashing_count = 0;
|
| +void FakeDumpWithoutCrashing() {
|
| + fake_dump_without_crashing_count++;
|
| +}
|
| +
|
| +} // namespace
|
| +
|
| +TEST_F(LoggingTest, LogMessageDump) {
|
| + // Replace the dump-without-crashing function, to test.
|
| + base::debug::SetDumpWithoutCrashingFunction(&FakeDumpWithoutCrashing);
|
| +
|
| + // LOG_DUMP is an internal severity level for use by dump-on-DCHECK, so
|
| + // we must call LogMessage() directly, rather than using LOG(DUMP).
|
| + LogMessage(__FILE__, __LINE__, LOG_DUMP, new std::string);
|
| + EXPECT_EQ(1, fake_dump_without_crashing_count);
|
| + LogMessage(__FILE__, __LINE__, LOG_DUMP, new std::string);
|
| + EXPECT_EQ(1, fake_dump_without_crashing_count);
|
| +
|
| + base::debug::SetDumpWithoutCrashingFunction(nullptr);
|
| +}
|
| +
|
| // Test that defining an operator<< for a type in a namespace doesn't prevent
|
| // other code in that namespace from calling the operator<<(ostream, wstring)
|
| // defined by logging.h. This can fail if operator<<(ostream, wstring) can't be
|
|
|