| Index: base/logging_unittest.cc
|
| diff --git a/base/logging_unittest.cc b/base/logging_unittest.cc
|
| index 04f349cab63913d9fcb7f9c1a0c1643ad248488f..32bd7da0d22e8b978d920005332d0d7c6aa76fc9 100644
|
| --- a/base/logging_unittest.cc
|
| +++ b/base/logging_unittest.cc
|
| @@ -2,8 +2,10 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#include "base/compiler_specific.h"
|
| #include "base/logging.h"
|
| +#include "base/bind.h"
|
| +#include "base/callback.h"
|
| +#include "base/compiler_specific.h"
|
| #include "base/macros.h"
|
|
|
| #include "testing/gmock/include/gmock/gmock.h"
|
| @@ -34,7 +36,10 @@ 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,
|
| + const base::StringPiece& message,
|
| + const base::StringPiece& stack_trace) {
|
| ++log_sink_call_count;
|
| }
|
| #endif
|
| @@ -47,7 +52,6 @@ class LogStateSaver {
|
|
|
| ~LogStateSaver() {
|
| SetMinLogLevel(old_min_log_level_);
|
| - SetLogAssertHandler(NULL);
|
| log_sink_call_count = 0;
|
| }
|
|
|
| @@ -191,7 +195,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();
|
| @@ -393,12 +397,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
|
|
|