Commit 018d4604 authored by Dominique Fauteux-Chapleau's avatar Dominique Fauteux-Chapleau Committed by Commit Bot

Rename UploadRealtimeReport to UploadSecurityEventReport

This is to better represent what the function actually does.
This is only a rename and doesn't change any existing behaviour.

Bug: 1098437
Change-Id: I06888a8e6994dcaf327c48e14681b953a8cd5dfe
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2510194
Commit-Queue: Dominique Fauteux-Chapleau <domfc@chromium.org>
Reviewed-by: default avatarDaniel Rubery <drubery@chromium.org>
Reviewed-by: default avatarJulian Pastarmov <pastarmovj@chromium.org>
Cr-Commit-Position: refs/heads/master@{#823185}
parent 47435535
......@@ -235,10 +235,6 @@ class ContentAnalysisDelegateBrowserTest
CallQuitClosure();
}
void ExpectNoReport() {
EXPECT_CALL(*client_, UploadRealtimeReport_(_, _)).Times(0);
}
policy::MockCloudPolicyClient* client() { return client_.get(); }
private:
......@@ -267,7 +263,8 @@ IN_PROC_BROWSER_TEST_F(ContentAnalysisDelegateBrowserTest, Unauthorized) {
enterprise_connectors::AnalysisConnector::FILE_ATTACHED));
// Nothing should be reported for unauthorized users.
ExpectNoReport();
safe_browsing::EventReportValidator validator(client());
validator.ExpectNoReport();
enterprise_connectors::ContentAnalysisDelegate::CreateForWebContents(
browser()->tab_strip_model()->GetActiveWebContents(), std::move(data),
......
......@@ -929,7 +929,7 @@ void SafeBrowsingPrivateEventRouter::ReportRealtimeEventCallback(
base::Value event_list(base::Value::Type::LIST);
event_list.Append(std::move(wrapper));
client_->UploadRealtimeReport(
client_->UploadSecurityEventReport(
policy::RealtimeReportingJobConfiguration::BuildReport(
std::move(event_list),
reporting::GetContext(Profile::FromBrowserContext(context_))),
......
......@@ -269,7 +269,7 @@ TEST_F(SafeBrowsingPrivateEventRouterTest, TestOnReuseDetected) {
event_router_->AddEventObserver(&event_observer);
base::Value report;
EXPECT_CALL(*client_, UploadRealtimeReport_(_, _))
EXPECT_CALL(*client_, UploadSecurityEventReport_(_, _))
.WillOnce(CaptureArg(&report));
TriggerOnPolicySpecifiedPasswordReuseDetectedEvent();
......@@ -305,7 +305,7 @@ TEST_F(SafeBrowsingPrivateEventRouterTest, TestOnPasswordChanged) {
event_router_->AddEventObserver(&event_observer);
base::Value report;
EXPECT_CALL(*client_, UploadRealtimeReport_(_, _))
EXPECT_CALL(*client_, UploadSecurityEventReport_(_, _))
.WillOnce(CaptureArg(&report));
TriggerOnPolicySpecifiedPasswordChangedEvent();
......@@ -338,7 +338,7 @@ TEST_F(SafeBrowsingPrivateEventRouterTest, TestOnDangerousDownloadOpened) {
event_router_->AddEventObserver(&event_observer);
base::Value report;
EXPECT_CALL(*client_, UploadRealtimeReport_(_, _))
EXPECT_CALL(*client_, UploadSecurityEventReport_(_, _))
.WillOnce(CaptureArg(&report));
TriggerOnDangerousDownloadOpenedEvent();
......@@ -388,7 +388,7 @@ TEST_F(SafeBrowsingPrivateEventRouterTest,
event_router_->AddEventObserver(&event_observer);
base::Value report;
EXPECT_CALL(*client_, UploadRealtimeReport_(_, _))
EXPECT_CALL(*client_, UploadSecurityEventReport_(_, _))
.WillOnce(CaptureArg(&report));
TriggerOnSecurityInterstitialProceededEvent();
......@@ -428,7 +428,7 @@ TEST_F(SafeBrowsingPrivateEventRouterTest, TestOnSecurityInterstitialShown) {
event_router_->AddEventObserver(&event_observer);
base::Value report;
EXPECT_CALL(*client_, UploadRealtimeReport_(_, _))
EXPECT_CALL(*client_, UploadSecurityEventReport_(_, _))
.WillOnce(CaptureArg(&report));
TriggerOnSecurityInterstitialShownEvent();
......@@ -468,7 +468,7 @@ TEST_F(SafeBrowsingPrivateEventRouterTest, TestOnDangerousDownloadWarning) {
event_router_->AddEventObserver(&event_observer);
base::Value report;
EXPECT_CALL(*client_, UploadRealtimeReport_(_, _))
EXPECT_CALL(*client_, UploadSecurityEventReport_(_, _))
.WillOnce(CaptureArg(&report));
TriggerOnDangerousDownloadEvent();
......@@ -510,7 +510,7 @@ TEST_F(SafeBrowsingPrivateEventRouterTest,
event_router_->AddEventObserver(&event_observer);
base::Value report;
EXPECT_CALL(*client_, UploadRealtimeReport_(_, _))
EXPECT_CALL(*client_, UploadSecurityEventReport_(_, _))
.WillOnce(CaptureArg(&report));
TriggerOnDangerousDownloadEventBypass();
......@@ -550,7 +550,7 @@ TEST_F(SafeBrowsingPrivateEventRouterTest, PolicyControlOnToOffIsDynamic) {
api::safe_browsing_private::OnSecurityInterstitialShown::kEventName);
event_router_->AddEventObserver(&event_observer);
EXPECT_CALL(*client_, UploadRealtimeReport_(_, _)).Times(1);
EXPECT_CALL(*client_, UploadSecurityEventReport_(_, _)).Times(1);
TriggerOnSecurityInterstitialShownEvent();
base::RunLoop().RunUntilIdle();
EXPECT_EQ(1u, event_observer.PassEventArgs().GetList().size());
......@@ -558,7 +558,7 @@ TEST_F(SafeBrowsingPrivateEventRouterTest, PolicyControlOnToOffIsDynamic) {
// Now turn off policy. This time no report should be generated.
SetReportingPolicy(false);
EXPECT_CALL(*client_, UploadRealtimeReport_(_, _)).Times(0);
EXPECT_CALL(*client_, UploadSecurityEventReport_(_, _)).Times(0);
TriggerOnSecurityInterstitialShownEvent();
base::RunLoop().RunUntilIdle();
EXPECT_EQ(1u, event_observer.PassEventArgs().GetList().size());
......@@ -577,7 +577,7 @@ TEST_F(SafeBrowsingPrivateEventRouterTest, PolicyControlOffToOnIsDynamic) {
// Now turn on policy.
SetReportingPolicy(true);
EXPECT_CALL(*client_, UploadRealtimeReport_(_, _)).Times(1);
EXPECT_CALL(*client_, UploadSecurityEventReport_(_, _)).Times(1);
TriggerOnSecurityInterstitialShownEvent();
base::RunLoop().RunUntilIdle();
EXPECT_EQ(1u, event_observer.PassEventArgs().GetList().size());
......@@ -592,7 +592,7 @@ TEST_F(SafeBrowsingPrivateEventRouterTest, TestUnauthorizedOnReuseDetected) {
event_router_->AddEventObserver(&event_observer);
base::Value report;
EXPECT_CALL(*client_, UploadRealtimeReport_(_, _)).Times(0);
EXPECT_CALL(*client_, UploadSecurityEventReport_(_, _)).Times(0);
TriggerOnPolicySpecifiedPasswordReuseDetectedEvent();
base::RunLoop().RunUntilIdle();
......@@ -608,7 +608,7 @@ TEST_F(SafeBrowsingPrivateEventRouterTest, TestUnauthorizedOnPasswordChanged) {
event_router_->AddEventObserver(&event_observer);
base::Value report;
EXPECT_CALL(*client_, UploadRealtimeReport_(_, _)).Times(0);
EXPECT_CALL(*client_, UploadSecurityEventReport_(_, _)).Times(0);
TriggerOnPolicySpecifiedPasswordChangedEvent();
base::RunLoop().RunUntilIdle();
......@@ -625,7 +625,7 @@ TEST_F(SafeBrowsingPrivateEventRouterTest,
event_router_->AddEventObserver(&event_observer);
base::Value report;
EXPECT_CALL(*client_, UploadRealtimeReport_(_, _)).Times(0);
EXPECT_CALL(*client_, UploadSecurityEventReport_(_, _)).Times(0);
TriggerOnDangerousDownloadOpenedEvent();
base::RunLoop().RunUntilIdle();
......@@ -642,7 +642,7 @@ TEST_F(SafeBrowsingPrivateEventRouterTest,
event_router_->AddEventObserver(&event_observer);
base::Value report;
EXPECT_CALL(*client_, UploadRealtimeReport_(_, _)).Times(0);
EXPECT_CALL(*client_, UploadSecurityEventReport_(_, _)).Times(0);
TriggerOnSecurityInterstitialProceededEvent();
base::RunLoop().RunUntilIdle();
......@@ -659,7 +659,7 @@ TEST_F(SafeBrowsingPrivateEventRouterTest,
event_router_->AddEventObserver(&event_observer);
base::Value report;
EXPECT_CALL(*client_, UploadRealtimeReport_(_, _)).Times(0);
EXPECT_CALL(*client_, UploadSecurityEventReport_(_, _)).Times(0);
TriggerOnSecurityInterstitialShownEvent();
base::RunLoop().RunUntilIdle();
......@@ -676,7 +676,7 @@ TEST_F(SafeBrowsingPrivateEventRouterTest,
event_router_->AddEventObserver(&event_observer);
base::Value report;
EXPECT_CALL(*client_, UploadRealtimeReport_(_, _)).Times(0);
EXPECT_CALL(*client_, UploadSecurityEventReport_(_, _)).Times(0);
TriggerOnDangerousDownloadEvent();
base::RunLoop().RunUntilIdle();
......@@ -693,7 +693,7 @@ TEST_F(SafeBrowsingPrivateEventRouterTest,
event_router_->AddEventObserver(&event_observer);
base::Value report;
EXPECT_CALL(*client_, UploadRealtimeReport_(_, _)).Times(0);
EXPECT_CALL(*client_, UploadSecurityEventReport_(_, _)).Times(0);
TriggerOnDangerousDownloadEventBypass();
base::RunLoop().RunUntilIdle();
......@@ -706,7 +706,7 @@ TEST_F(SafeBrowsingPrivateEventRouterTest, TestOnSensitiveDataEvent_Allowed) {
SetUpRouters(/*realtime_reporting_enable=*/true, /*authorized=*/true);
base::Value report;
EXPECT_CALL(*client_, UploadRealtimeReport_(_, _))
EXPECT_CALL(*client_, UploadSecurityEventReport_(_, _))
.WillOnce(CaptureArg(&report));
TriggerOnSensitiveDataEvent(safe_browsing::EventResult::ALLOWED);
......@@ -756,7 +756,7 @@ TEST_F(SafeBrowsingPrivateEventRouterTest, TestOnSensitiveDataEvent_Blocked) {
SetUpRouters(/*realtime_reporting_enable=*/true, /*authorized=*/true);
base::Value report;
EXPECT_CALL(*client_, UploadRealtimeReport_(_, _))
EXPECT_CALL(*client_, UploadSecurityEventReport_(_, _))
.WillOnce(CaptureArg(&report));
TriggerOnSensitiveDataEvent(safe_browsing::EventResult::BLOCKED);
......@@ -806,7 +806,7 @@ TEST_F(SafeBrowsingPrivateEventRouterTest, TestOnUnscannedFileEvent_Allowed) {
SetUpRouters(/*realtime_reporting_enable=*/true, /*authorized=*/true);
base::Value report;
EXPECT_CALL(*client_, UploadRealtimeReport_(_, _))
EXPECT_CALL(*client_, UploadSecurityEventReport_(_, _))
.WillOnce(CaptureArg(&report));
TriggerOnUnscannedFileEvent(safe_browsing::EventResult::ALLOWED);
......@@ -850,7 +850,7 @@ TEST_F(SafeBrowsingPrivateEventRouterTest, TestOnUnscannedFileEvent_Blocked) {
SetUpRouters(/*realtime_reporting_enable=*/true, /*authorized=*/true);
base::Value report;
EXPECT_CALL(*client_, UploadRealtimeReport_(_, _))
EXPECT_CALL(*client_, UploadSecurityEventReport_(_, _))
.WillOnce(CaptureArg(&report));
TriggerOnUnscannedFileEvent(safe_browsing::EventResult::BLOCKED);
......@@ -901,7 +901,8 @@ TEST_F(SafeBrowsingPrivateEventRouterTest, TestProfileUsername) {
->SetIdentityManagerForTesting(
identity_test_environment.identity_manager());
EXPECT_CALL(*client_, UploadRealtimeReport_(_, _)).WillRepeatedly(Return());
EXPECT_CALL(*client_, UploadSecurityEventReport_(_, _))
.WillRepeatedly(Return());
// With no primary account, we should not set the username.
TriggerOnSecurityInterstitialShownEvent();
......@@ -1065,13 +1066,13 @@ TEST_P(SafeBrowsingIsRealtimeReportingEnabledTest, CheckRealtimeReport) {
#endif
if (should_report) {
EXPECT_CALL(*client_, UploadRealtimeReport_(_, _)).Times(1);
EXPECT_CALL(*client_, UploadSecurityEventReport_(_, _)).Times(1);
} else if (client_) {
// Because the test will crate a |client_| object when the policy is
// set, even if the feature flag or other conditions indicate that
// reports should not be sent, it is possible that the pointer is not
// null. In this case, make sure UploadRealtimeReport() is not called.
EXPECT_CALL(*client_, UploadRealtimeReport_(_, _)).Times(0);
// null. In this case, make sure UploadSecurityEventReport() is not called.
EXPECT_CALL(*client_, UploadSecurityEventReport_(_, _)).Times(0);
}
TriggerOnPolicySpecifiedPasswordChangedEvent();
......@@ -1080,7 +1081,8 @@ TEST_P(SafeBrowsingIsRealtimeReportingEnabledTest, CheckRealtimeReport) {
// Asser the triggered actually did fire.
EXPECT_EQ(1u, event_observer.PassEventArgs().GetList().size());
// Make sure UploadRealtimeReport was called the expected number of times.
// Make sure UploadSecurityEventReport was called the expected number of
// times.
if (client_)
Mock::VerifyAndClearExpectations(client_.get());
}
......
......@@ -154,7 +154,7 @@ void EventReportValidator::ExpectUnscannedFileEvent(
content_size_ = expected_content_size;
result_ = expected_result;
username_ = expected_username;
EXPECT_CALL(*client_, UploadRealtimeReport_(_, _))
EXPECT_CALL(*client_, UploadSecurityEventReport_(_, _))
.WillOnce([this](base::Value& report,
base::OnceCallback<void(bool)>& callback) {
ValidateReport(&report);
......@@ -183,7 +183,7 @@ void EventReportValidator::ExpectDangerousDeepScanningResult(
content_size_ = expected_content_size;
result_ = expected_result;
username_ = expected_username;
EXPECT_CALL(*client_, UploadRealtimeReport_(_, _))
EXPECT_CALL(*client_, UploadSecurityEventReport_(_, _))
.WillOnce([this](base::Value& report,
base::OnceCallback<void(bool)>& callback) {
ValidateReport(&report);
......@@ -213,7 +213,7 @@ void EventReportValidator::ExpectSensitiveDataEvent(
content_size_ = expected_content_size;
result_ = expected_result;
username_ = expected_username;
EXPECT_CALL(*client_, UploadRealtimeReport_(_, _))
EXPECT_CALL(*client_, UploadSecurityEventReport_(_, _))
.WillOnce([this](base::Value& report,
base::OnceCallback<void(bool)>& callback) {
ValidateReport(&report);
......@@ -245,7 +245,7 @@ void EventReportValidator::
content_size_ = expected_content_size;
result_ = expected_result;
username_ = expected_username;
EXPECT_CALL(*client_, UploadRealtimeReport_(_, _))
EXPECT_CALL(*client_, UploadSecurityEventReport_(_, _))
.WillOnce([this](base::Value& report,
base::OnceCallback<void(bool)>& callback) {
ValidateReport(&report);
......@@ -285,7 +285,7 @@ void EventReportValidator::
result_ = expected_result;
dlp_verdict_ = expected_dlp_verdict;
username_ = expected_username;
EXPECT_CALL(*client_, UploadRealtimeReport_(_, _))
EXPECT_CALL(*client_, UploadSecurityEventReport_(_, _))
.WillOnce([this](base::Value& report,
base::OnceCallback<void(bool)>& callback) {
ValidateReport(&report);
......@@ -322,7 +322,7 @@ void EventReportValidator::ExpectDangerousDownloadEvent(
content_size_ = expected_content_size;
result_ = expected_result;
username_ = expected_username;
EXPECT_CALL(*client_, UploadRealtimeReport_(_, _))
EXPECT_CALL(*client_, UploadSecurityEventReport_(_, _))
.WillOnce([this](base::Value& report,
base::OnceCallback<void(bool)>& callback) {
ValidateReport(&report);
......@@ -434,7 +434,7 @@ void EventReportValidator::ValidateField(
}
void EventReportValidator::ExpectNoReport() {
EXPECT_CALL(*client_, UploadRealtimeReport_(_, _)).Times(0);
EXPECT_CALL(*client_, UploadSecurityEventReport_(_, _)).Times(0);
}
void EventReportValidator::SetDoneClosure(base::RepeatingClosure closure) {
......
......@@ -591,8 +591,8 @@ void CloudPolicyClient::UploadChromeOsUserReport(
request_jobs_.push_back(service_->CreateJob(std::move(config)));
}
void CloudPolicyClient::UploadRealtimeReport(base::Value report,
StatusCallback callback) {
void CloudPolicyClient::UploadSecurityEventReport(base::Value report,
StatusCallback callback) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
CHECK(is_registered());
CreateNewRealtimeReportingJob(
......
......@@ -305,9 +305,8 @@ class POLICY_EXPORT CloudPolicyClient {
// Uploads a report containing enterprise connectors real-time security
// events. As above, the client must be in a registered state. The |callback|
// will be called when the operation completes.
// TODO(crbug.com/1098437): Pick a more specific name.
virtual void UploadRealtimeReport(base::Value report,
StatusCallback callback);
virtual void UploadSecurityEventReport(base::Value report,
StatusCallback callback);
// Uploads a report on the status of app push-installs. The client must be in
// a registered state. The |callback| will be called when the operation
......
......@@ -1508,7 +1508,7 @@ TEST_F(CloudPolicyClientTest, UploadChromeOsUserReport) {
#if defined(OS_WIN) || defined(OS_APPLE) || defined(OS_LINUX) || \
defined(OS_CHROMEOS)
TEST_F(CloudPolicyClientTest, UploadRealtimeReport) {
TEST_F(CloudPolicyClientTest, UploadSecurityEventReport) {
RegisterClient();
ExpectRealtimeReport();
......@@ -1517,8 +1517,8 @@ TEST_F(CloudPolicyClientTest, UploadRealtimeReport) {
base::BindOnce(&MockStatusCallbackObserver::OnCallbackComplete,
base::Unretained(&callback_observer_));
client_->UploadRealtimeReport(MakeDefaultRealtimeReport(),
std::move(callback));
client_->UploadSecurityEventReport(MakeDefaultRealtimeReport(),
std::move(callback));
base::RunLoop().RunUntilIdle();
EXPECT_EQ(
DeviceManagementService::JobConfiguration::TYPE_UPLOAD_REAL_TIME_REPORT,
......
......@@ -99,11 +99,11 @@ class MockCloudPolicyClient : public CloudPolicyClient {
void(enterprise_management::ChromeOsUserReportRequest*,
StatusCallback&));
void UploadRealtimeReport(base::Value value,
StatusCallback callback) override {
UploadRealtimeReport_(value, callback);
void UploadSecurityEventReport(base::Value value,
StatusCallback callback) override {
UploadSecurityEventReport_(value, callback);
}
MOCK_METHOD2(UploadRealtimeReport_, void(base::Value&, StatusCallback&));
MOCK_METHOD2(UploadSecurityEventReport_, void(base::Value&, StatusCallback&));
void UploadAppInstallReport(base::Value value,
StatusCallback callback) override {
......
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