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..32d4533ef36472609f74575e5e2eece03e8f2d91 100644 |
--- a/chrome/installer/util/installation_validator_unittest.cc |
+++ b/chrome/installer/util/installation_validator_unittest.cc |
@@ -230,7 +230,8 @@ void FakeProductState::AddOsUpgradeCommand(BrowserDistribution::Type dist_type, |
// validator are sent to an optional mock recipient (see |
// set_validation_error_recipient) upon which expectations can be placed. |
class InstallationValidatorTest |
- : public testing::TestWithParam<InstallationValidator::InstallationType> { |
+ : public testing::TestWithParam<InstallationValidator::InstallationType>, |
+ logging::LogMessageHandler { |
public: |
// These shouldn't need to be public, but there seems to be some interaction |
@@ -260,11 +261,12 @@ class InstallationValidatorTest |
}; |
protected: |
- static bool HandleLogMessage(int severity, |
- const char* file, |
- int line, |
- size_t message_start, |
- const std::string& str); |
+ // logging::LogMessageHandler |
+ bool OnMessage(int severity, |
+ const char* file, |
+ int line, |
+ size_t message_start, |
+ const std::string& str) override; |
static void set_validation_error_recipient( |
ValidationErrorRecipient* recipient); |
static void MakeProductState( |
@@ -282,16 +284,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 +308,6 @@ int InstallationValidatorTest::GetChannelModifiers( |
// static |
void InstallationValidatorTest::SetUpTestCase() { |
DCHECK(type_to_modifiers_ == NULL); |
- old_log_message_handler_ = logging::GetLogMessageHandler(); |
- logging::SetLogMessageHandler(&HandleLogMessage); |
type_to_modifiers_ = new InstallationTypeToModifiers(); |
InstallationTypeToModifiers& ttm = *type_to_modifiers_; |
@@ -330,19 +325,15 @@ void InstallationValidatorTest::SetUpTestCase() { |
// static |
void InstallationValidatorTest::TearDownTestCase() { |
- logging::SetLogMessageHandler(old_log_message_handler_); |
- old_log_message_handler_ = NULL; |
- |
delete type_to_modifiers_; |
type_to_modifiers_ = NULL; |
} |
-// static |
-bool InstallationValidatorTest::HandleLogMessage(int severity, |
- const char* file, |
- int line, |
- size_t message_start, |
- const std::string& str) { |
+bool InstallationValidatorTest::OnMessage(int severity, |
+ const char* file, |
+ int line, |
+ size_t message_start, |
+ const std::string& str) { |
// All validation failures result in LOG(ERROR) |
if (severity == logging::LOG_ERROR && !str.empty()) { |
// Remove the trailing newline, if present. |
@@ -360,9 +351,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; |
} |