Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(636)

Unified Diff: components/password_manager/content/browser/credential_manager_impl_unittest.cc

Issue 2110993003: Filter out empty usernames while handling get() in the Credential Manager API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | components/password_manager/core/browser/credential_manager_pending_request_task.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/password_manager/content/browser/credential_manager_impl_unittest.cc
diff --git a/components/password_manager/content/browser/credential_manager_impl_unittest.cc b/components/password_manager/content/browser/credential_manager_impl_unittest.cc
index 53e78b8118de70238f8d8ae1f3d7939e652da822..60448a4999bbaaedc39881c76bafa2f66d0c0220 100644
--- a/components/password_manager/content/browser/credential_manager_impl_unittest.cc
+++ b/components/password_manager/content/browser/credential_manager_impl_unittest.cc
@@ -692,6 +692,30 @@ TEST_F(CredentialManagerImplTest,
}
TEST_F(CredentialManagerImplTest,
+ CredentialManagerOnRequestCredentialWithEmptyUsernames) {
+ form_.username_value.clear();
+ store_->AddLogin(form_);
+ EXPECT_CALL(*client_, PromptUserToChooseCredentialsPtr(_, _, _, _))
+ .Times(testing::Exactly(0));
+ EXPECT_CALL(*client_, NotifyUserAutoSigninPtr(_)).Times(testing::Exactly(0));
+
+ std::vector<GURL> federations;
+ ExpectCredentialType(false, true, federations, mojom::CredentialType::EMPTY);
+}
+
+TEST_F(CredentialManagerImplTest,
+ CredentialManagerOnRequestCredentialWithEmptyAndNonUsernames) {
+ store_->AddLogin(form_);
+ autofill::PasswordForm empty = form_;
+ empty.username_value.clear();
+ store_->AddLogin(empty);
+
+ std::vector<GURL> federations;
+ ExpectZeroClickSignInSuccess(false, true, federations,
+ mojom::CredentialType::PASSWORD);
+}
+
+TEST_F(CredentialManagerImplTest,
CredentialManagerOnRequestCredentialWithCrossOriginPasswordStore) {
store_->AddLogin(cross_origin_form_);
« no previous file with comments | « no previous file | components/password_manager/core/browser/credential_manager_pending_request_task.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698