Commit 709fe623 authored by Xinghui Lu's avatar Xinghui Lu Committed by Commit Bot

Set reason for saved password pings if SBER is disabled

In UMA metrics PasswordProtection.RequestOutcome.AnyPasswordEntry, the
Unknown bucket is abnormally high. The reason is that "reason" is not set
when saved password is reused and SBER is disabled.

Bug: 1016540
Change-Id: I382e516f664cbd7b514c0005f4f90e6df607da45
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1888724Reviewed-by: default avatarDaniel Rubery <drubery@chromium.org>
Commit-Queue: Xinghui Lu <xinghuilu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#710858}
parent 13dbde4f
...@@ -1317,12 +1317,17 @@ bool ChromePasswordProtectionService::IsPingingEnabled( ...@@ -1317,12 +1317,17 @@ bool ChromePasswordProtectionService::IsPingingEnabled(
*reason = RequestOutcome::SAFE_BROWSING_DISABLED; *reason = RequestOutcome::SAFE_BROWSING_DISABLED;
return false; return false;
} }
bool extended_reporting_enabled = IsExtendedReporting();
if (trigger_type == LoginReputationClientRequest::PASSWORD_REUSE_EVENT) { if (trigger_type == LoginReputationClientRequest::PASSWORD_REUSE_EVENT) {
if (password_type.account_type() == if (password_type.account_type() ==
ReusedPasswordAccountType::SAVED_PASSWORD) ReusedPasswordAccountType::SAVED_PASSWORD) {
return IsExtendedReporting() || bool enabled = extended_reporting_enabled ||
base::FeatureList::IsEnabled( base::FeatureList::IsEnabled(
safe_browsing::kPasswordProtectionForSavedPasswords); safe_browsing::kPasswordProtectionForSavedPasswords);
if (!enabled)
*reason = RequestOutcome::DISABLED_DUE_TO_USER_POPULATION;
return enabled;
}
PasswordProtectionTrigger trigger_level = PasswordProtectionTrigger trigger_level =
GetPasswordProtectionWarningTriggerPref(password_type); GetPasswordProtectionWarningTriggerPref(password_type);
...@@ -1340,7 +1345,7 @@ bool ChromePasswordProtectionService::IsPingingEnabled( ...@@ -1340,7 +1345,7 @@ bool ChromePasswordProtectionService::IsPingingEnabled(
*reason = RequestOutcome::DISABLED_DUE_TO_INCOGNITO; *reason = RequestOutcome::DISABLED_DUE_TO_INCOGNITO;
return false; return false;
} }
if (!IsExtendedReporting()) { if (!extended_reporting_enabled) {
*reason = RequestOutcome::DISABLED_DUE_TO_USER_POPULATION; *reason = RequestOutcome::DISABLED_DUE_TO_USER_POPULATION;
return false; return false;
} }
......
...@@ -418,6 +418,7 @@ TEST_F(ChromePasswordProtectionServiceTest, ...@@ -418,6 +418,7 @@ TEST_F(ChromePasswordProtectionServiceTest,
EXPECT_FALSE(service_->IsPingingEnabled( EXPECT_FALSE(service_->IsPingingEnabled(
LoginReputationClientRequest::PASSWORD_REUSE_EVENT, reused_password_type, LoginReputationClientRequest::PASSWORD_REUSE_EVENT, reused_password_type,
&reason)); &reason));
EXPECT_EQ(RequestOutcome::DISABLED_DUE_TO_USER_POPULATION, reason);
service_->ConfigService(false /*incognito*/, true /*SBER*/); service_->ConfigService(false /*incognito*/, true /*SBER*/);
EXPECT_TRUE(service_->IsPingingEnabled( EXPECT_TRUE(service_->IsPingingEnabled(
......
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