Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7587)

Unified Diff: chrome/installer/util/installation_validator_unittest.cc

Issue 2034393004: Allow multiple logging::LogMessage{Handler,Listener}s Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: clean up, MockLog uses listener Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/installer/util/installation_validator_unittest.cc
diff --git a/chrome/installer/util/installation_validator_unittest.cc b/chrome/installer/util/installation_validator_unittest.cc
index c181aa05a526722c025874fbdea782ad265c90c8..5bff16e370304e1bc4645302c35fdb0c26aeb7ee 100644
--- a/chrome/installer/util/installation_validator_unittest.cc
+++ b/chrome/installer/util/installation_validator_unittest.cc
@@ -282,16 +282,11 @@ class InstallationValidatorTest
FakeInstallationState* state);
void TearDown() override;
- static logging::LogMessageHandlerFunction old_log_message_handler_;
static ValidationErrorRecipient* validation_error_recipient_;
static InstallationTypeToModifiers* type_to_modifiers_;
};
// static
-logging::LogMessageHandlerFunction
- InstallationValidatorTest::old_log_message_handler_ = NULL;
-
-// static
InstallationValidatorTest::ValidationErrorRecipient*
InstallationValidatorTest::validation_error_recipient_ = NULL;
@@ -311,8 +306,7 @@ int InstallationValidatorTest::GetChannelModifiers(
// static
void InstallationValidatorTest::SetUpTestCase() {
DCHECK(type_to_modifiers_ == NULL);
- old_log_message_handler_ = logging::GetLogMessageHandler();
- logging::SetLogMessageHandler(&HandleLogMessage);
+ logging::PushLogMessageHandler(HandleLogMessage);
type_to_modifiers_ = new InstallationTypeToModifiers();
InstallationTypeToModifiers& ttm = *type_to_modifiers_;
@@ -330,8 +324,7 @@ void InstallationValidatorTest::SetUpTestCase() {
// static
void InstallationValidatorTest::TearDownTestCase() {
- logging::SetLogMessageHandler(old_log_message_handler_);
- old_log_message_handler_ = NULL;
+ logging::PopLogMessageHandler(HandleLogMessage);
delete type_to_modifiers_;
type_to_modifiers_ = NULL;
@@ -360,9 +353,6 @@ bool InstallationValidatorTest::HandleLogMessage(int severity,
return true;
}
- if (old_log_message_handler_ != NULL)
- return (old_log_message_handler_)(severity, file, line, message_start, str);
-
return false;
}

Powered by Google App Engine
This is Rietveld 408576698