Index: base/logging_unittest.cc |
diff --git a/base/logging_unittest.cc b/base/logging_unittest.cc |
index e0619425f7542804b0c4604aba51603f619ef3b8..6953107132894595e8b37136ad4a00c2e5f75a9a 100644 |
--- a/base/logging_unittest.cc |
+++ b/base/logging_unittest.cc |
@@ -122,7 +122,7 @@ TEST_F(LoggingTest, LogIsOn) { |
EXPECT_TRUE(kDfatalIsFatal == LOG_IS_ON(DFATAL)); |
} |
-TEST_F(LoggingTest, LoggingIsLazy) { |
+TEST_F(LoggingTest, LoggingIsLazyBySeverity) { |
MockLogSource mock_log_source; |
EXPECT_CALL(mock_log_source, Log()).Times(0); |
@@ -151,6 +151,24 @@ TEST_F(LoggingTest, LoggingIsLazy) { |
DVPLOG_IF(1, true) << mock_log_source.Log(); |
} |
+TEST_F(LoggingTest, LoggingIsLazyByDestination) { |
+ MockLogSource mock_log_source; |
+ MockLogSource mock_log_source_error; |
+ EXPECT_CALL(mock_log_source, Log()).Times(0); |
+ |
+ // Severity >= ERROR is always printed to stderr. |
+ EXPECT_CALL(mock_log_source_error, Log()).Times(1). |
+ WillRepeatedly(Return("log message")); |
+ |
+ LoggingSettings settings; |
+ settings.logging_dest = LOG_NONE; |
+ InitLogging(settings); |
+ |
+ LOG(INFO) << mock_log_source.Log(); |
+ LOG(WARNING) << mock_log_source.Log(); |
+ LOG(ERROR) << mock_log_source_error.Log(); |
+} |
+ |
// Official builds have CHECKs directly call BreakDebugger. |
#if !defined(OFFICIAL_BUILD) |