Commit 72b61e44 authored by Rainhard Findling's avatar Rainhard Findling Committed by Commit Bot

Safety check Chrome cleaner: sent parent updates only on SC run

This CL prevents the safety check Chrome cleaner child from sending
additional SC parent completion events to the UI when the Chrome cleaner
status changes in the backend.

Bug: 1087263
Change-Id: I80c8c2549053460e20fadd03d91deab97f4cda6c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2527381Reviewed-by: default avatarEsmael Elmoslimany <aee@chromium.org>
Commit-Queue: Rainhard Findling <rainhard@chromium.org>
Cr-Commit-Position: refs/heads/master@{#825487}
parent b82950bc
......@@ -479,6 +479,7 @@ void SafetyCheckHandler::CheckChromeCleaner() {
base::UmaHistogramEnumeration("Settings.SafetyCheck.ChromeCleanerResult",
chrome_cleaner_status_);
}
CompleteParentIfChildrenCompleted();
}
#endif
......@@ -557,7 +558,6 @@ void SafetyCheckHandler::OnChromeCleanerCheckResult(
timestamp_delegate_->GetSystemTime()));
FireWebUIListener(kChromeCleanerEvent, event);
chrome_cleaner_status_ = result.status;
CompleteParentIfChildrenCompleted();
}
#endif
......
......@@ -1742,4 +1742,22 @@ TEST_F(SafetyCheckHandlerTest, CheckSafetyCheckCompletedWebUiEvents) {
ASSERT_TRUE(event_parent);
VerifyDisplayString(event_parent,
base::UTF8ToUTF16("Safety check ran a moment ago"));
#if defined(OS_WIN) && BUILDFLAG(GOOGLE_CHROME_BRANDING)
// Subsequent Chrome cleaner status updates without the user running safety
// check again should not trigger further parent element completion events.
safety_check_->OnIdle(safe_browsing::ChromeCleanerController::IdleReason::
kReporterFoundNothing);
safety_check_->OnReporterRunning();
safety_check_->OnScanning();
safety_check_->OnRebootRequired();
safety_check_->OnRebootFailed();
#endif
// Check that there is no new parent completion event.
const base::DictionaryValue* event_parent2 =
GetSafetyCheckStatusChangedWithDataIfExists(
kParent, static_cast<int>(SafetyCheckHandler::ParentStatus::kAfter));
ASSERT_TRUE(event_parent2);
ASSERT_TRUE(event_parent == event_parent2);
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment