Commit 3ed14400 authored by Jan Wilken Dörrie's avatar Jan Wilken Dörrie Committed by Chromium LUCI CQ

[Passwords] Replace Blacklist with Blocklist in Credential Cache

This change replaces mentions of Blacklist with Blocklist in
CredentialCache and OriginCredentialStore.

Bug: 1147799
Change-Id: I3aa875d0bd6c2e54039202348435576da86af4f4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2579794Reviewed-by: default avatarFriedrich [CET] <fhorschig@chromium.org>
Commit-Queue: Jan Wilken Dörrie <jdoerrie@chromium.org>
Cr-Commit-Position: refs/heads/master@{#835210}
parent 69bb1374
...@@ -56,8 +56,8 @@ using autofill::mojom::FocusedFieldType; ...@@ -56,8 +56,8 @@ using autofill::mojom::FocusedFieldType;
using password_manager::CredentialCache; using password_manager::CredentialCache;
using password_manager::PasswordStore; using password_manager::PasswordStore;
using password_manager::UiCredential; using password_manager::UiCredential;
using BlacklistedStatus = using BlocklistedStatus =
password_manager::OriginCredentialStore::BlacklistedStatus; password_manager::OriginCredentialStore::BlocklistedStatus;
using FillingSource = ManualFillingController::FillingSource; using FillingSource = ManualFillingController::FillingSource;
using IsPslMatch = autofill::UserInfo::IsPslMatch; using IsPslMatch = autofill::UserInfo::IsPslMatch;
...@@ -315,11 +315,11 @@ void PasswordAccessoryControllerImpl::RefreshSuggestionsForField( ...@@ -315,11 +315,11 @@ void PasswordAccessoryControllerImpl::RefreshSuggestionsForField(
std::move(info_to_add), std::move(footer_commands_to_add)); std::move(info_to_add), std::move(footer_commands_to_add));
if (ShouldShowRecoveryToggle(origin)) { if (ShouldShowRecoveryToggle(origin)) {
BlacklistedStatus blacklisted_status = BlocklistedStatus blocklisted_status =
credential_cache_->GetCredentialStore(origin).GetBlacklistedStatus(); credential_cache_->GetCredentialStore(origin).GetBlocklistedStatus();
if (blacklisted_status == BlacklistedStatus::kWasBlacklisted || if (blocklisted_status == BlocklistedStatus::kWasBlocklisted ||
blacklisted_status == BlacklistedStatus::kIsBlacklisted) { blocklisted_status == BlocklistedStatus::kIsBlocklisted) {
bool enabled = (blacklisted_status == BlacklistedStatus::kWasBlacklisted); bool enabled = (blocklisted_status == BlocklistedStatus::kWasBlocklisted);
if (!enabled) { if (!enabled) {
UMA_HISTOGRAM_BOOLEAN( UMA_HISTOGRAM_BOOLEAN(
"KeyboardAccessory.DisabledSavingAccessoryImpressions", true); "KeyboardAccessory.DisabledSavingAccessoryImpressions", true);
......
...@@ -542,10 +542,10 @@ void ChromePasswordManagerClient::NotifyStorePasswordCalled() { ...@@ -542,10 +542,10 @@ void ChromePasswordManagerClient::NotifyStorePasswordCalled() {
void ChromePasswordManagerClient::UpdateCredentialCache( void ChromePasswordManagerClient::UpdateCredentialCache(
const url::Origin& origin, const url::Origin& origin,
const std::vector<const PasswordForm*>& best_matches, const std::vector<const PasswordForm*>& best_matches,
bool is_blacklisted) { bool is_blocklisted) {
#if defined(OS_ANDROID) #if defined(OS_ANDROID)
credential_cache_.SaveCredentialsAndBlacklistedForOrigin( credential_cache_.SaveCredentialsAndBlocklistedForOrigin(
best_matches, CredentialCache::IsOriginBlacklisted(is_blacklisted), best_matches, CredentialCache::IsOriginBlocklisted(is_blocklisted),
origin); origin);
#endif #endif
...@@ -1257,7 +1257,7 @@ void ChromePasswordManagerClient::DidFinishNavigation( ...@@ -1257,7 +1257,7 @@ void ChromePasswordManagerClient::DidFinishNavigation(
AddToWidgetInputEventObservers( AddToWidgetInputEventObservers(
web_contents()->GetMainFrame()->GetRenderViewHost()->GetWidget(), this); web_contents()->GetMainFrame()->GetRenderViewHost()->GetWidget(), this);
#if defined(OS_ANDROID) #if defined(OS_ANDROID)
// This unblacklisted info is only used after form submission to determine // This unblocklisted info is only used after form submission to determine
// whether to record PasswordManager.SaveUIDismissalReasonAfterUnblacklisting. // whether to record PasswordManager.SaveUIDismissalReasonAfterUnblacklisting.
// Therefore it is sufficient to save it only once on navigation and not // Therefore it is sufficient to save it only once on navigation and not
// every time the user changes the UI toggle. // every time the user changes the UI toggle.
......
...@@ -139,7 +139,7 @@ class ChromePasswordManagerClient ...@@ -139,7 +139,7 @@ class ChromePasswordManagerClient
void UpdateCredentialCache( void UpdateCredentialCache(
const url::Origin& origin, const url::Origin& origin,
const std::vector<const password_manager::PasswordForm*>& best_matches, const std::vector<const password_manager::PasswordForm*>& best_matches,
bool is_blacklisted) override; bool is_blocklisted) override;
void AutomaticPasswordSave( void AutomaticPasswordSave(
std::unique_ptr<password_manager::PasswordFormManagerForUI> std::unique_ptr<password_manager::PasswordFormManagerForUI>
saved_form_manager) override; saved_form_manager) override;
......
...@@ -964,8 +964,8 @@ TEST_F(ChromePasswordManagerClientAndroidTest, ...@@ -964,8 +964,8 @@ TEST_F(ChromePasswordManagerClientAndroidTest,
form.password_value = base::ASCIIToUTF16("S3cr3t"); form.password_value = base::ASCIIToUTF16("S3cr3t");
GetClient() GetClient()
->GetCredentialCacheForTesting() ->GetCredentialCacheForTesting()
->SaveCredentialsAndBlacklistedForOrigin( ->SaveCredentialsAndBlocklistedForOrigin(
{&form}, CredentialCache::IsOriginBlacklisted(false), origin); {&form}, CredentialCache::IsOriginBlocklisted(false), origin);
// Check that a navigation within the same document does not clear the cache. // Check that a navigation within the same document does not clear the cache.
content::MockNavigationHandle handle(web_contents()); content::MockNavigationHandle handle(web_contents());
......
...@@ -214,7 +214,7 @@ void JNI_ManualFillingComponentBridge_CachePasswordSheetDataForTesting( ...@@ -214,7 +214,7 @@ void JNI_ManualFillingComponentBridge_CachePasswordSheetDataForTesting(
const base::android::JavaParamRef<jobject>& j_web_contents, const base::android::JavaParamRef<jobject>& j_web_contents,
const base::android::JavaParamRef<jobjectArray>& j_usernames, const base::android::JavaParamRef<jobjectArray>& j_usernames,
const base::android::JavaParamRef<jobjectArray>& j_passwords, const base::android::JavaParamRef<jobjectArray>& j_passwords,
jboolean j_blacklisted) { jboolean j_blocklisted) {
content::WebContents* web_contents = content::WebContents* web_contents =
content::WebContents::FromJavaWebContents(j_web_contents); content::WebContents::FromJavaWebContents(j_web_contents);
...@@ -235,9 +235,9 @@ void JNI_ManualFillingComponentBridge_CachePasswordSheetDataForTesting( ...@@ -235,9 +235,9 @@ void JNI_ManualFillingComponentBridge_CachePasswordSheetDataForTesting(
} }
return ChromePasswordManagerClient::FromWebContents(web_contents) return ChromePasswordManagerClient::FromWebContents(web_contents)
->GetCredentialCacheForTesting() ->GetCredentialCacheForTesting()
->SaveCredentialsAndBlacklistedForOrigin( ->SaveCredentialsAndBlocklistedForOrigin(
credentials, credentials,
password_manager::CredentialCache::IsOriginBlacklisted(j_blacklisted), password_manager::CredentialCache::IsOriginBlocklisted(j_blocklisted),
origin); origin);
} }
......
...@@ -20,9 +20,9 @@ namespace password_manager { ...@@ -20,9 +20,9 @@ namespace password_manager {
CredentialCache::CredentialCache() = default; CredentialCache::CredentialCache() = default;
CredentialCache::~CredentialCache() = default; CredentialCache::~CredentialCache() = default;
void CredentialCache::SaveCredentialsAndBlacklistedForOrigin( void CredentialCache::SaveCredentialsAndBlocklistedForOrigin(
const std::vector<const PasswordForm*>& best_matches, const std::vector<const PasswordForm*>& best_matches,
IsOriginBlacklisted is_blacklisted, IsOriginBlocklisted is_blocklisted,
const url::Origin& origin) { const url::Origin& origin) {
std::vector<UiCredential> credentials; std::vector<UiCredential> credentials;
credentials.reserve(best_matches.size()); credentials.reserve(best_matches.size());
...@@ -41,8 +41,8 @@ void CredentialCache::SaveCredentialsAndBlacklistedForOrigin( ...@@ -41,8 +41,8 @@ void CredentialCache::SaveCredentialsAndBlacklistedForOrigin(
return credential.origin() == origin; return credential.origin() == origin;
}); });
GetOrCreateCredentialStore(origin).SaveCredentials(std::move(credentials)); GetOrCreateCredentialStore(origin).SaveCredentials(std::move(credentials));
GetOrCreateCredentialStore(origin).SetBlacklistedStatus( GetOrCreateCredentialStore(origin).SetBlocklistedStatus(
is_blacklisted.value()); is_blocklisted.value());
} }
const OriginCredentialStore& CredentialCache::GetCredentialStore( const OriginCredentialStore& CredentialCache::GetCredentialStore(
......
...@@ -21,18 +21,18 @@ class CredentialCache { ...@@ -21,18 +21,18 @@ class CredentialCache {
public: public:
// TODO(crbug.com/1051553): Consider reusing this alias for other password // TODO(crbug.com/1051553): Consider reusing this alias for other password
// manager code as well. // manager code as well.
using IsOriginBlacklisted = using IsOriginBlocklisted =
base::StrongAlias<class IsOriginBlacklistedTag, bool>; base::StrongAlias<class IsOriginBlocklistedTag, bool>;
CredentialCache(); CredentialCache();
CredentialCache(const CredentialCache&) = delete; CredentialCache(const CredentialCache&) = delete;
CredentialCache& operator=(const CredentialCache&) = delete; CredentialCache& operator=(const CredentialCache&) = delete;
~CredentialCache(); ~CredentialCache();
// Saves credentials and blacklisted status for an origin so that they can be // Saves credentials and blocklisted status for an origin so that they can be
// used in the sheet. // used in the sheet.
void SaveCredentialsAndBlacklistedForOrigin( void SaveCredentialsAndBlocklistedForOrigin(
const std::vector<const PasswordForm*>& matches, const std::vector<const PasswordForm*>& matches,
IsOriginBlacklisted is_blacklisted, IsOriginBlocklisted is_blocklisted,
const url::Origin& origin); const url::Origin& origin);
// Returns the credential store for a given origin. If it does not exist, an // Returns the credential store for a given origin. If it does not exist, an
......
...@@ -23,7 +23,7 @@ using url::Origin; ...@@ -23,7 +23,7 @@ using url::Origin;
using IsPublicSuffixMatch = UiCredential::IsPublicSuffixMatch; using IsPublicSuffixMatch = UiCredential::IsPublicSuffixMatch;
using IsAffiliationBasedMatch = UiCredential::IsAffiliationBasedMatch; using IsAffiliationBasedMatch = UiCredential::IsAffiliationBasedMatch;
using IsOriginBlacklisted = CredentialCache::IsOriginBlacklisted; using IsOriginBlocklisted = CredentialCache::IsOriginBlocklisted;
constexpr char kExampleSite[] = "https://example.com/"; constexpr char kExampleSite[] = "https://example.com/";
constexpr char kExampleSite2[] = "https://example.two.com/"; constexpr char kExampleSite2[] = "https://example.two.com/";
...@@ -62,7 +62,7 @@ TEST_F(CredentialCacheTest, ReturnsSameStoreForSameOriginOnly) { ...@@ -62,7 +62,7 @@ TEST_F(CredentialCacheTest, ReturnsSameStoreForSameOriginOnly) {
TEST_F(CredentialCacheTest, StoresCredentialsSortedByAplhabetAndOrigins) { TEST_F(CredentialCacheTest, StoresCredentialsSortedByAplhabetAndOrigins) {
Origin origin = Origin::Create(GURL(kExampleSite)); Origin origin = Origin::Create(GURL(kExampleSite));
cache()->SaveCredentialsAndBlacklistedForOrigin( cache()->SaveCredentialsAndBlocklistedForOrigin(
{CreateEntry("Berta", "30948", GURL(kExampleSite), false, false).get(), {CreateEntry("Berta", "30948", GURL(kExampleSite), false, false).get(),
CreateEntry("Adam", "Pas83B", GURL(kExampleSite), false, false).get(), CreateEntry("Adam", "Pas83B", GURL(kExampleSite), false, false).get(),
CreateEntry("Dora", "PakudC", GURL(kExampleSite), false, false).get(), CreateEntry("Dora", "PakudC", GURL(kExampleSite), false, false).get(),
...@@ -77,7 +77,7 @@ TEST_F(CredentialCacheTest, StoresCredentialsSortedByAplhabetAndOrigins) { ...@@ -77,7 +77,7 @@ TEST_F(CredentialCacheTest, StoresCredentialsSortedByAplhabetAndOrigins) {
.get(), .get(),
CreateEntry("Alf", "R4nd50m", GURL(kExampleSiteMobile), true, false) CreateEntry("Alf", "R4nd50m", GURL(kExampleSiteMobile), true, false)
.get()}, .get()},
IsOriginBlacklisted(false), origin); IsOriginBlocklisted(false), origin);
EXPECT_THAT( EXPECT_THAT(
cache()->GetCredentialStore(origin).GetCredentials(), cache()->GetCredentialStore(origin).GetCredentials(),
...@@ -111,12 +111,12 @@ TEST_F(CredentialCacheTest, StoredCredentialsForIndependentOrigins) { ...@@ -111,12 +111,12 @@ TEST_F(CredentialCacheTest, StoredCredentialsForIndependentOrigins) {
Origin origin = Origin::Create(GURL(kExampleSite)); Origin origin = Origin::Create(GURL(kExampleSite));
Origin origin2 = Origin::Create(GURL(kExampleSite2)); Origin origin2 = Origin::Create(GURL(kExampleSite2));
cache()->SaveCredentialsAndBlacklistedForOrigin( cache()->SaveCredentialsAndBlocklistedForOrigin(
{CreateEntry("Ben", "S3cur3", GURL(kExampleSite), false, false).get()}, {CreateEntry("Ben", "S3cur3", GURL(kExampleSite), false, false).get()},
IsOriginBlacklisted(false), origin); IsOriginBlocklisted(false), origin);
cache()->SaveCredentialsAndBlacklistedForOrigin( cache()->SaveCredentialsAndBlocklistedForOrigin(
{CreateEntry("Abe", "B4dPW", GURL(kExampleSite2), false, false).get()}, {CreateEntry("Abe", "B4dPW", GURL(kExampleSite2), false, false).get()},
IsOriginBlacklisted(false), origin2); IsOriginBlocklisted(false), origin2);
EXPECT_THAT(cache()->GetCredentialStore(origin).GetCredentials(), EXPECT_THAT(cache()->GetCredentialStore(origin).GetCredentials(),
testing::ElementsAre(MakeUiCredential("Ben", "S3cur3"))); testing::ElementsAre(MakeUiCredential("Ben", "S3cur3")));
...@@ -127,9 +127,9 @@ TEST_F(CredentialCacheTest, StoredCredentialsForIndependentOrigins) { ...@@ -127,9 +127,9 @@ TEST_F(CredentialCacheTest, StoredCredentialsForIndependentOrigins) {
TEST_F(CredentialCacheTest, ClearsCredentials) { TEST_F(CredentialCacheTest, ClearsCredentials) {
Origin origin = Origin::Create(GURL(kExampleSite)); Origin origin = Origin::Create(GURL(kExampleSite));
cache()->SaveCredentialsAndBlacklistedForOrigin( cache()->SaveCredentialsAndBlocklistedForOrigin(
{CreateEntry("Ben", "S3cur3", GURL(kExampleSite), false, false).get()}, {CreateEntry("Ben", "S3cur3", GURL(kExampleSite), false, false).get()},
IsOriginBlacklisted(false), Origin::Create(GURL(kExampleSite))); IsOriginBlocklisted(false), Origin::Create(GURL(kExampleSite)));
ASSERT_THAT(cache()->GetCredentialStore(origin).GetCredentials(), ASSERT_THAT(cache()->GetCredentialStore(origin).GetCredentials(),
testing::ElementsAre(MakeUiCredential("Ben", "S3cur3"))); testing::ElementsAre(MakeUiCredential("Ben", "S3cur3")));
...@@ -137,13 +137,13 @@ TEST_F(CredentialCacheTest, ClearsCredentials) { ...@@ -137,13 +137,13 @@ TEST_F(CredentialCacheTest, ClearsCredentials) {
EXPECT_EQ(cache()->GetCredentialStore(origin).GetCredentials().size(), 0u); EXPECT_EQ(cache()->GetCredentialStore(origin).GetCredentials().size(), 0u);
} }
TEST_F(CredentialCacheTest, StoresBlacklistedWithCredentials) { TEST_F(CredentialCacheTest, StoresBlocklistedWithCredentials) {
Origin origin = Origin::Create(GURL(kExampleSite)); Origin origin = Origin::Create(GURL(kExampleSite));
cache()->SaveCredentialsAndBlacklistedForOrigin( cache()->SaveCredentialsAndBlocklistedForOrigin(
{CreateEntry("Ben", "S3cur3", GURL(kExampleSite), false, false).get()}, {CreateEntry("Ben", "S3cur3", GURL(kExampleSite), false, false).get()},
IsOriginBlacklisted(true), Origin::Create(GURL(kExampleSite))); IsOriginBlocklisted(true), Origin::Create(GURL(kExampleSite)));
EXPECT_EQ(OriginCredentialStore::BlacklistedStatus::kIsBlacklisted, EXPECT_EQ(OriginCredentialStore::BlocklistedStatus::kIsBlocklisted,
cache()->GetCredentialStore(origin).GetBlacklistedStatus()); cache()->GetCredentialStore(origin).GetBlocklistedStatus());
} }
} // namespace password_manager } // namespace password_manager
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
namespace password_manager { namespace password_manager {
using BlacklistedStatus = OriginCredentialStore::BlacklistedStatus; using BlocklistedStatus = OriginCredentialStore::BlocklistedStatus;
UiCredential::UiCredential(base::string16 username, UiCredential::UiCredential(base::string16 username,
base::string16 password, base::string16 password,
...@@ -78,19 +78,19 @@ base::span<const UiCredential> OriginCredentialStore::GetCredentials() const { ...@@ -78,19 +78,19 @@ base::span<const UiCredential> OriginCredentialStore::GetCredentials() const {
return credentials_; return credentials_;
} }
void OriginCredentialStore::SetBlacklistedStatus(bool is_blacklisted) { void OriginCredentialStore::SetBlocklistedStatus(bool is_blocklisted) {
if (is_blacklisted) { if (is_blocklisted) {
blacklisted_status_ = BlacklistedStatus::kIsBlacklisted; blocklisted_status_ = BlocklistedStatus::kIsBlocklisted;
return; return;
} }
if (blacklisted_status_ == BlacklistedStatus::kIsBlacklisted) { if (blocklisted_status_ == BlocklistedStatus::kIsBlocklisted) {
blacklisted_status_ = BlacklistedStatus::kWasBlacklisted; blocklisted_status_ = BlocklistedStatus::kWasBlocklisted;
} }
} }
BlacklistedStatus OriginCredentialStore::GetBlacklistedStatus() const { BlocklistedStatus OriginCredentialStore::GetBlocklistedStatus() const {
return blacklisted_status_; return blocklisted_status_;
} }
void OriginCredentialStore::ClearCredentials() { void OriginCredentialStore::ClearCredentials() {
......
...@@ -69,14 +69,14 @@ std::ostream& operator<<(std::ostream& os, const UiCredential& credential); ...@@ -69,14 +69,14 @@ std::ostream& operator<<(std::ostream& os, const UiCredential& credential);
// credentials without creating unnecessary copies. // credentials without creating unnecessary copies.
class OriginCredentialStore { class OriginCredentialStore {
public: public:
enum class BlacklistedStatus { enum class BlocklistedStatus {
// The origin was not blacklisted at the moment this store was initialized. // The origin was not blocklisted at the moment this store was initialized.
kNeverBlacklisted, kNeverBlocklisted,
// The origin was blacklisted when the store was initialized, but it isn't // The origin was blocklisted when the store was initialized, but it isn't
// currently blacklisted. // currently blocklisted.
kWasBlacklisted, kWasBlocklisted,
// The origin is currently blacklisted. // The origin is currently blocklisted.
kIsBlacklisted kIsBlocklisted
}; };
explicit OriginCredentialStore(url::Origin origin); explicit OriginCredentialStore(url::Origin origin);
...@@ -90,15 +90,15 @@ class OriginCredentialStore { ...@@ -90,15 +90,15 @@ class OriginCredentialStore {
// Returns references to the held credentials (or an empty set if aren't any). // Returns references to the held credentials (or an empty set if aren't any).
base::span<const UiCredential> GetCredentials() const; base::span<const UiCredential> GetCredentials() const;
// Sets the blacklisted status. The possible transitions are: // Sets the blocklisted status. The possible transitions are:
// (*, is_blacklisted = true) -> kIsBlacklisted // (*, is_blocklisted = true) -> kIsBlocklisted
// ((kIsBlacklisted|kWasBlacklisted), is_blacklisted = false) // ((kIsBlocklisted|kWasBlocklisted), is_blocklisted = false)
// -> kWasBlacklisted // -> kWasBlocklisted
// (kNeverBlacklisted, is_blacklisted = false) -> kNeverBlacklisted // (kNeverBlocklisted, is_blocklisted = false) -> kNeverBlocklisted
void SetBlacklistedStatus(bool is_blacklisted); void SetBlocklistedStatus(bool is_blocklisted);
// Returns the blacklsited status for |origin_|. // Returns the blacklsited status for |origin_|.
BlacklistedStatus GetBlacklistedStatus() const; BlocklistedStatus GetBlocklistedStatus() const;
// Removes all credentials from the store. // Removes all credentials from the store.
void ClearCredentials(); void ClearCredentials();
...@@ -110,10 +110,10 @@ class OriginCredentialStore { ...@@ -110,10 +110,10 @@ class OriginCredentialStore {
// Contains all previously stored of credentials. // Contains all previously stored of credentials.
std::vector<UiCredential> credentials_; std::vector<UiCredential> credentials_;
// The blacklisted status for |origin_|. // The blocklisted status for |origin_|.
// Used to know whether unblacklisting UI needs to be displayed and what // Used to know whether unblocklisting UI needs to be displayed and what
// state it should display; // state it should display;
BlacklistedStatus blacklisted_status_ = BlacklistedStatus::kNeverBlacklisted; BlocklistedStatus blocklisted_status_ = BlocklistedStatus::kNeverBlocklisted;
// The origin which all stored passwords are related to. // The origin which all stored passwords are related to.
const url::Origin origin_; const url::Origin origin_;
......
...@@ -20,7 +20,7 @@ namespace { ...@@ -20,7 +20,7 @@ namespace {
using base::ASCIIToUTF16; using base::ASCIIToUTF16;
using testing::ElementsAre; using testing::ElementsAre;
using BlacklistedStatus = OriginCredentialStore::BlacklistedStatus; using BlocklistedStatus = OriginCredentialStore::BlocklistedStatus;
using IsPublicSuffixMatch = UiCredential::IsPublicSuffixMatch; using IsPublicSuffixMatch = UiCredential::IsPublicSuffixMatch;
using IsAffiliationBasedMatch = UiCredential::IsAffiliationBasedMatch; using IsAffiliationBasedMatch = UiCredential::IsAffiliationBasedMatch;
...@@ -102,45 +102,45 @@ TEST_F(OriginCredentialStoreTest, ClearsCredentials) { ...@@ -102,45 +102,45 @@ TEST_F(OriginCredentialStoreTest, ClearsCredentials) {
EXPECT_EQ(store()->GetCredentials().size(), 0u); EXPECT_EQ(store()->GetCredentials().size(), 0u);
} }
TEST_F(OriginCredentialStoreTest, SetBlacklistedAfterNeverBlacklisted) { TEST_F(OriginCredentialStoreTest, SetBlocklistedAfterNeverBlocklisted) {
store()->SetBlacklistedStatus(true); store()->SetBlocklistedStatus(true);
EXPECT_EQ(BlacklistedStatus::kIsBlacklisted, store()->GetBlacklistedStatus()); EXPECT_EQ(BlocklistedStatus::kIsBlocklisted, store()->GetBlocklistedStatus());
} }
TEST_F(OriginCredentialStoreTest, CorrectlyUpdatesBlacklistedStatus) { TEST_F(OriginCredentialStoreTest, CorrectlyUpdatesBlocklistedStatus) {
store()->SetBlacklistedStatus(true); store()->SetBlocklistedStatus(true);
ASSERT_EQ(BlacklistedStatus::kIsBlacklisted, store()->GetBlacklistedStatus()); ASSERT_EQ(BlocklistedStatus::kIsBlocklisted, store()->GetBlocklistedStatus());
store()->SetBlacklistedStatus(false); store()->SetBlocklistedStatus(false);
EXPECT_EQ(BlacklistedStatus::kWasBlacklisted, EXPECT_EQ(BlocklistedStatus::kWasBlocklisted,
store()->GetBlacklistedStatus()); store()->GetBlocklistedStatus());
store()->SetBlacklistedStatus(true); store()->SetBlocklistedStatus(true);
EXPECT_EQ(BlacklistedStatus::kIsBlacklisted, store()->GetBlacklistedStatus()); EXPECT_EQ(BlocklistedStatus::kIsBlocklisted, store()->GetBlocklistedStatus());
} }
TEST_F(OriginCredentialStoreTest, WasBlacklistedStaysTheSame) { TEST_F(OriginCredentialStoreTest, WasBlocklistedStaysTheSame) {
store()->SetBlacklistedStatus(true); store()->SetBlocklistedStatus(true);
ASSERT_EQ(BlacklistedStatus::kIsBlacklisted, store()->GetBlacklistedStatus()); ASSERT_EQ(BlocklistedStatus::kIsBlocklisted, store()->GetBlocklistedStatus());
store()->SetBlacklistedStatus(false); store()->SetBlocklistedStatus(false);
ASSERT_EQ(BlacklistedStatus::kWasBlacklisted, ASSERT_EQ(BlocklistedStatus::kWasBlocklisted,
store()->GetBlacklistedStatus()); store()->GetBlocklistedStatus());
// If unblacklisting is communicated twice in a row, the status shouldn't // If unblocklisting is communicated twice in a row, the status shouldn't
// change. // change.
store()->SetBlacklistedStatus(false); store()->SetBlocklistedStatus(false);
EXPECT_EQ(BlacklistedStatus::kWasBlacklisted, EXPECT_EQ(BlocklistedStatus::kWasBlocklisted,
store()->GetBlacklistedStatus()); store()->GetBlocklistedStatus());
} }
TEST_F(OriginCredentialStoreTest, NeverBlacklistedStaysTheSame) { TEST_F(OriginCredentialStoreTest, NeverBlocklistedStaysTheSame) {
ASSERT_EQ(BlacklistedStatus::kNeverBlacklisted, ASSERT_EQ(BlocklistedStatus::kNeverBlocklisted,
store()->GetBlacklistedStatus()); store()->GetBlocklistedStatus());
store()->SetBlacklistedStatus(false); store()->SetBlocklistedStatus(false);
EXPECT_EQ(BlacklistedStatus::kNeverBlacklisted, EXPECT_EQ(BlocklistedStatus::kNeverBlocklisted,
store()->GetBlacklistedStatus()); store()->GetBlocklistedStatus());
} }
} // namespace password_manager } // namespace password_manager
...@@ -64,8 +64,8 @@ using autofill::UNKNOWN_TYPE; ...@@ -64,8 +64,8 @@ using autofill::UNKNOWN_TYPE;
using autofill::USERNAME; using autofill::USERNAME;
using autofill::mojom::SubmissionIndicatorEvent; using autofill::mojom::SubmissionIndicatorEvent;
using base::NumberToString; using base::NumberToString;
using BlacklistedStatus = using BlocklistedStatus =
password_manager::OriginCredentialStore::BlacklistedStatus; password_manager::OriginCredentialStore::BlocklistedStatus;
using password_manager::metrics_util::GaiaPasswordHashChange; using password_manager::metrics_util::GaiaPasswordHashChange;
namespace password_manager { namespace password_manager {
...@@ -317,8 +317,8 @@ void PasswordManager::MarkWasUnblacklistedInFormManagers( ...@@ -317,8 +317,8 @@ void PasswordManager::MarkWasUnblacklistedInFormManagers(
const OriginCredentialStore& credential_store = const OriginCredentialStore& credential_store =
credential_cache->GetCredentialStore( credential_cache->GetCredentialStore(
url::Origin::Create(owned_submitted_form_manager_->GetURL())); url::Origin::Create(owned_submitted_form_manager_->GetURL()));
if (credential_store.GetBlacklistedStatus() == if (credential_store.GetBlocklistedStatus() ==
BlacklistedStatus::kWasBlacklisted) { BlocklistedStatus::kWasBlocklisted) {
owned_submitted_form_manager_->MarkWasUnblacklisted(); owned_submitted_form_manager_->MarkWasUnblacklisted();
} }
} }
...@@ -327,8 +327,8 @@ void PasswordManager::MarkWasUnblacklistedInFormManagers( ...@@ -327,8 +327,8 @@ void PasswordManager::MarkWasUnblacklistedInFormManagers(
const OriginCredentialStore& credential_store = const OriginCredentialStore& credential_store =
credential_cache->GetCredentialStore( credential_cache->GetCredentialStore(
url::Origin::Create(form_manager->GetURL())); url::Origin::Create(form_manager->GetURL()));
if (credential_store.GetBlacklistedStatus() == if (credential_store.GetBlocklistedStatus() ==
BlacklistedStatus::kWasBlacklisted) { BlocklistedStatus::kWasBlocklisted) {
form_manager->MarkWasUnblacklisted(); form_manager->MarkWasUnblacklisted();
} }
} }
......
...@@ -44,7 +44,7 @@ void PasswordManagerClient::GeneratePassword( ...@@ -44,7 +44,7 @@ void PasswordManagerClient::GeneratePassword(
void PasswordManagerClient::UpdateCredentialCache( void PasswordManagerClient::UpdateCredentialCache(
const url::Origin& origin, const url::Origin& origin,
const std::vector<const PasswordForm*>& best_matches, const std::vector<const PasswordForm*>& best_matches,
bool is_blacklisted) {} bool is_blocklisted) {}
void PasswordManagerClient::PasswordWasAutofilled( void PasswordManagerClient::PasswordWasAutofilled(
const std::vector<const PasswordForm*>& best_matches, const std::vector<const PasswordForm*>& best_matches,
......
...@@ -214,7 +214,7 @@ class PasswordManagerClient { ...@@ -214,7 +214,7 @@ class PasswordManagerClient {
virtual void UpdateCredentialCache( virtual void UpdateCredentialCache(
const url::Origin& origin, const url::Origin& origin,
const std::vector<const PasswordForm*>& best_matches, const std::vector<const PasswordForm*>& best_matches,
bool is_blacklisted); bool is_blocklisted);
// Called when a password is saved in an automated fashion. Embedder may // Called when a password is saved in an automated fashion. Embedder may
// inform the user that this save has occurred. // inform the user that this save has occurred.
......
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