| Index: base/logging_unittest.cc
|
| diff --git a/base/logging_unittest.cc b/base/logging_unittest.cc
|
| index f41cce2f43b390fa9603a14f3f689fe87d0dcb33..797a372c634c84f295bf514f681a29b9fa99db77 100644
|
| --- a/base/logging_unittest.cc
|
| +++ b/base/logging_unittest.cc
|
| @@ -2,9 +2,12 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| +#include "base/bind.h"
|
| +#include "base/callback.h"
|
| #include "base/compiler_specific.h"
|
| #include "base/logging.h"
|
| #include "base/macros.h"
|
| +#include "base/test/logging_utils.h"
|
|
|
| #include "testing/gmock/include/gmock/gmock.h"
|
| #include "testing/gtest/include/gtest/gtest.h"
|
| @@ -19,7 +22,11 @@ using ::testing::Return;
|
| int log_sink_call_count = 0;
|
|
|
| #if !defined(OFFICIAL_BUILD) || defined(DCHECK_ALWAYS_ON) || !defined(NDEBUG)
|
| -void LogSink(const std::string& str) {
|
| +void LogSink(const char* file,
|
| + int line,
|
| + size_t message_start,
|
| + size_t stack_start,
|
| + const std::string& str) {
|
| ++log_sink_call_count;
|
| }
|
| #endif
|
| @@ -32,7 +39,6 @@ class LogStateSaver {
|
|
|
| ~LogStateSaver() {
|
| SetMinLogLevel(old_min_log_level_);
|
| - SetLogAssertHandler(NULL);
|
| log_sink_call_count = 0;
|
| }
|
|
|
| @@ -178,7 +184,7 @@ TEST_F(LoggingTest, CheckStreamsAreLazy) {
|
| WillRepeatedly(Return("check message"));
|
| EXPECT_CALL(uncalled_mock_log_source, Log()).Times(0);
|
|
|
| - SetLogAssertHandler(&LogSink);
|
| + ScopedLogAssertHandler scoped_assert_handler(base::Bind(LogSink));
|
|
|
| CHECK(mock_log_source.Log()) << uncalled_mock_log_source.Log();
|
| PCHECK(!mock_log_source.Log()) << mock_log_source.Log();
|
| @@ -232,12 +238,12 @@ TEST_F(LoggingTest, Dcheck) {
|
| EXPECT_FALSE(DLOG_IS_ON(DCHECK));
|
| #elif defined(NDEBUG) && defined(DCHECK_ALWAYS_ON)
|
| // Release build with real DCHECKS.
|
| - SetLogAssertHandler(&LogSink);
|
| + ScopedLogAssertHandler scoped_assert_handler(base::Bind(LogSink));
|
| EXPECT_TRUE(DCHECK_IS_ON());
|
| EXPECT_TRUE(DLOG_IS_ON(DCHECK));
|
| #else
|
| // Debug build.
|
| - SetLogAssertHandler(&LogSink);
|
| + ScopedLogAssertHandler scoped_assert_handler(base::Bind(LogSink));
|
| EXPECT_TRUE(DCHECK_IS_ON());
|
| EXPECT_TRUE(DLOG_IS_ON(DCHECK));
|
| #endif
|
|
|