| Index: base/logging_unittest.cc
|
| diff --git a/base/logging_unittest.cc b/base/logging_unittest.cc
|
| index f41cce2f43b390fa9603a14f3f689fe87d0dcb33..8a8339a745f90a8931c7e2ec6b1e973f6273d963 100644
|
| --- a/base/logging_unittest.cc
|
| +++ b/base/logging_unittest.cc
|
| @@ -52,6 +52,20 @@ class MockLogSource {
|
| MOCK_METHOD0(Log, const char*());
|
| };
|
|
|
| +// Scoped object to temporary clear any log message handlers for testing
|
| +// DCHECK/CHECK functionality.
|
| +class MockLogMessageHandler {
|
| + public:
|
| + MockLogMessageHandler() : saved_handler_(GetLogMessageHandler()) {
|
| + SetLogMessageHandler(nullptr);
|
| + }
|
| +
|
| + ~MockLogMessageHandler() { SetLogMessageHandler(saved_handler_); }
|
| +
|
| + private:
|
| + LogMessageHandlerFunction saved_handler_;
|
| +};
|
| +
|
| TEST_F(LoggingTest, BasicLogging) {
|
| MockLogSource mock_log_source;
|
| EXPECT_CALL(mock_log_source, Log()).Times(DEBUG_MODE ? 16 : 8).
|
| @@ -152,6 +166,7 @@ TEST_F(LoggingTest, LoggingIsLazyBySeverity) {
|
| }
|
|
|
| TEST_F(LoggingTest, LoggingIsLazyByDestination) {
|
| + MockLogMessageHandler mock_handler;
|
| MockLogSource mock_log_source;
|
| MockLogSource mock_log_source_error;
|
| EXPECT_CALL(mock_log_source, Log()).Times(0);
|
|
|