Commit bd97c207 authored by Bettina's avatar Bettina Committed by Commit Bot

Show interstitials only for Gsuite users.

Previously, showing interstitials depended on whether or not
the account is syncing. However, the policy should apply to
Gsuite account regardless of syncing or not. Follows cr/1693188.

Bug: 914410
Change-Id: Icd90c0c5b7d6491ff5ab72c8681c57251594ebc9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1710801
Commit-Queue: Bettina Dea <bdea@chromium.org>
Reviewed-by: default avatarVarun Khaneja <vakh@chromium.org>
Reviewed-by: default avatarNathan Parker <nparker@chromium.org>
Cr-Commit-Position: refs/heads/master@{#686234}
parent dbe50ca0
......@@ -1436,9 +1436,9 @@ bool ChromePasswordProtectionService::CanShowInterstitial(
const GURL& main_frame_url) {
// If it's not password alert mode, no need to log any metric.
if (reason != RequestOutcome::PASSWORD_ALERT_MODE ||
password_type.account_type() ==
ReusedPasswordAccountType::SAVED_PASSWORD ||
password_type.account_type() == ReusedPasswordAccountType::UNKNOWN) {
(password_type.account_type() != ReusedPasswordAccountType::GSUITE &&
password_type.account_type() !=
ReusedPasswordAccountType::NON_GAIA_ENTERPRISE)) {
return false;
}
......
......@@ -1138,6 +1138,7 @@ TEST_F(ChromePasswordProtectionServiceTest, VerifyGetWarningDetailTextGmail) {
}
TEST_F(ChromePasswordProtectionServiceTest, VerifyCanShowInterstitial) {
// Do not show interstitial if policy not set for password_alert.
ASSERT_FALSE(
profile()->GetPrefs()->HasPrefPath(prefs::kSafeBrowsingWhitelistDomains));
GURL trigger_url = GURL(kPhishingURL);
......@@ -1154,12 +1155,11 @@ TEST_F(ChromePasswordProtectionServiceTest, VerifyCanShowInterstitial) {
base::test::ScopedFeatureList feature_list;
feature_list.InitAndEnableFeature(
safe_browsing::kPasswordProtectionForSignedInUsers);
service_->SetAccountInfo(kUserName);
reused_password_type.set_is_account_syncing(false);
EXPECT_FALSE(service_->CanShowInterstitial(
RequestOutcome::TURNED_OFF_BY_ADMIN,
service_->GetPasswordProtectionReusedPasswordAccountType(
PasswordType::OTHER_GAIA_PASSWORD, "user@domain.com"),
trigger_url));
EXPECT_FALSE(
service_->CanShowInterstitial(RequestOutcome::TURNED_OFF_BY_ADMIN,
reused_password_type, trigger_url));
}
reused_password_type.set_account_type(
......@@ -1171,6 +1171,8 @@ TEST_F(ChromePasswordProtectionServiceTest, VerifyCanShowInterstitial) {
ReusedPasswordAccountType::SAVED_PASSWORD);
EXPECT_FALSE(service_->CanShowInterstitial(
RequestOutcome::PASSWORD_ALERT_MODE, reused_password_type, trigger_url));
// Show interstitial if user is a syncing GSuite user and the policy is set to
// password_alert.
reused_password_type.set_account_type(ReusedPasswordAccountType::GSUITE);
reused_password_type.set_is_account_syncing(true);
EXPECT_TRUE(service_->CanShowInterstitial(RequestOutcome::PASSWORD_ALERT_MODE,
......@@ -1179,14 +1181,15 @@ TEST_F(ChromePasswordProtectionServiceTest, VerifyCanShowInterstitial) {
base::test::ScopedFeatureList feature_list;
feature_list.InitAndEnableFeature(
safe_browsing::kPasswordProtectionForSignedInUsers);
service_->SetAccountInfo(kUserName);
reused_password_type.set_account_type(ReusedPasswordAccountType::GSUITE);
reused_password_type.set_is_account_syncing(false);
EXPECT_TRUE(
service_->CanShowInterstitial(RequestOutcome::PASSWORD_ALERT_MODE,
reused_password_type, trigger_url));
}
// Show interstitial if user is a Enterprise user and the policy is set to
// password_alert.
reused_password_type.set_account_type(
ReusedPasswordAccountType::NON_GAIA_ENTERPRISE);
reused_password_type.set_is_account_syncing(false);
......
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