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

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

Issue 1785273002: CREDENTIAL: Persist PasswordForm's primary key through CredentialInfo. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: another test Created 4 years, 9 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
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 897c4848344ba48cf09011bbd78a8a931b2733ae..7065745bf0a93eeef852e80dab495c82d3bc304b 100644
--- a/components/password_manager/content/browser/credential_manager_dispatcher_unittest.cc
+++ b/components/password_manager/content/browser/credential_manager_dispatcher_unittest.cc
@@ -412,6 +412,38 @@ TEST_F(CredentialManagerDispatcherTest,
}
TEST_F(CredentialManagerDispatcherTest,
+ CredentialManagerGetOverwriteZeroClick) {
+ // Set the global zero click flag on, and populate the PasswordStore with a
+ // form that's set to skip zero click and has a primary key that won't match
+ // credentials initially created via `store()`.
+ client_->set_zero_click_enabled(true);
+ form_.skip_zero_click = true;
+ form_.username_element = base::ASCIIToUTF16("username-element");
+ form_.password_element = base::ASCIIToUTF16("password-element");
+ form_.signon_realm = "this is a realm";
vasilii 2016/03/11 14:29:48 I want another origin_url too. It's a part of the
+ store_->AddLogin(form_);
+ RunAllPendingTasks();
+
+ std::vector<GURL> federations;
+ EXPECT_CALL(*client_, PromptUserToChooseCredentialsPtr(_, _, _, _))
+ .Times(testing::Exactly(1));
+ EXPECT_CALL(*client_, NotifyUserAutoSigninPtr(_)).Times(testing::Exactly(0));
+
+ dispatcher()->OnRequestCredential(kRequestId, false, true, federations);
+
+ RunAllPendingTasks();
+
+ const uint32_t kMsgID = CredentialManagerMsg_SendCredential::ID;
+ const IPC::Message* message =
+ process()->sink().GetFirstMessageMatching(kMsgID);
+ EXPECT_TRUE(message);
+
+ // Verify that the update toggled the skip_zero_click flag.
+ TestPasswordStore::PasswordMap passwords = store_->stored_passwords();
+ EXPECT_FALSE(passwords[form_.signon_realm][0].skip_zero_click);
+}
+
+TEST_F(CredentialManagerDispatcherTest,
CredentialManagerSignInWithSavingDisabledForCurrentPage) {
CredentialInfo info(form_, CredentialType::CREDENTIAL_TYPE_PASSWORD);
EXPECT_CALL(*client_, IsSavingAndFillingEnabledForCurrentPage())

Powered by Google App Engine
This is Rietveld 408576698