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

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

Issue 1942723002: CREDENTIAL: Tighten the behavior of 'requireUserMediation()' (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2704
Patch Set: Created 4 years, 8 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_require_user_mediation_task.h » ('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_dispatcher_unittest.cc
diff --git a/components/password_manager/content/browser/credential_manager_dispatcher_unittest.cc b/components/password_manager/content/browser/credential_manager_dispatcher_unittest.cc
index 75a26f189f38817f9b2c95ffd28fa9618d5dd60c..699aa0028b5817f678440d11bcbe1ce2e615ffff 100644
--- a/components/password_manager/content/browser/credential_manager_dispatcher_unittest.cc
+++ b/components/password_manager/content/browser/credential_manager_dispatcher_unittest.cc
@@ -238,6 +238,14 @@ class CredentialManagerDispatcherTest
origin_path_form_.scheme = autofill::PasswordForm::SCHEME_HTML;
origin_path_form_.skip_zero_click = false;
+ subdomain_form_.username_value = base::ASCIIToUTF16("Username 2");
+ subdomain_form_.display_name = base::ASCIIToUTF16("Display Name 2");
+ subdomain_form_.password_value = base::ASCIIToUTF16("Password 2");
+ subdomain_form_.origin = GURL("https://subdomain.example.com/path");
+ subdomain_form_.signon_realm = subdomain_form_.origin.spec();
+ subdomain_form_.scheme = autofill::PasswordForm::SCHEME_HTML;
+ subdomain_form_.skip_zero_click = false;
+
cross_origin_form_.username_value = base::ASCIIToUTF16("Username");
cross_origin_form_.display_name = base::ASCIIToUTF16("Display Name");
cross_origin_form_.password_value = base::ASCIIToUTF16("Password");
@@ -299,6 +307,7 @@ class CredentialManagerDispatcherTest
autofill::PasswordForm affiliated_form1_;
autofill::PasswordForm affiliated_form2_;
autofill::PasswordForm origin_path_form_;
+ autofill::PasswordForm subdomain_form_;
autofill::PasswordForm cross_origin_form_;
scoped_refptr<TestPasswordStore> store_;
std::unique_ptr<testing::NiceMock<MockPasswordManagerClient>> client_;
@@ -497,14 +506,17 @@ TEST_F(CredentialManagerDispatcherTest,
TEST_F(CredentialManagerDispatcherTest,
CredentialManagerOnRequireUserMediation) {
store_->AddLogin(form_);
+ store_->AddLogin(subdomain_form_);
store_->AddLogin(cross_origin_form_);
RunAllPendingTasks();
TestPasswordStore::PasswordMap passwords = store_->stored_passwords();
- EXPECT_EQ(2U, passwords.size());
+ EXPECT_EQ(3U, passwords.size());
EXPECT_EQ(1U, passwords[form_.signon_realm].size());
+ EXPECT_EQ(1U, passwords[subdomain_form_.signon_realm].size());
EXPECT_EQ(1U, passwords[cross_origin_form_.signon_realm].size());
EXPECT_FALSE(passwords[form_.signon_realm][0].skip_zero_click);
+ EXPECT_FALSE(passwords[subdomain_form_.signon_realm][0].skip_zero_click);
EXPECT_FALSE(passwords[cross_origin_form_.signon_realm][0].skip_zero_click);
dispatcher()->OnRequireUserMediation(kRequestId);
@@ -518,10 +530,12 @@ TEST_F(CredentialManagerDispatcherTest,
process()->sink().ClearMessages();
passwords = store_->stored_passwords();
- EXPECT_EQ(2U, passwords.size());
+ EXPECT_EQ(3U, passwords.size());
EXPECT_EQ(1U, passwords[form_.signon_realm].size());
+ EXPECT_EQ(1U, passwords[subdomain_form_.signon_realm].size());
EXPECT_EQ(1U, passwords[cross_origin_form_.signon_realm].size());
EXPECT_TRUE(passwords[form_.signon_realm][0].skip_zero_click);
+ EXPECT_TRUE(passwords[subdomain_form_.signon_realm][0].skip_zero_click);
EXPECT_FALSE(passwords[cross_origin_form_.signon_realm][0].skip_zero_click);
}
« no previous file with comments | « no previous file | components/password_manager/core/browser/credential_manager_pending_require_user_mediation_task.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698