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

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

Issue 802303002: Credential Manager: Switch 'request()' to GetAutofillableLogins(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Feedback. Created 6 years 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/content_credential_manager_dispatcher_unittest.cc
diff --git a/components/password_manager/content/browser/content_credential_manager_dispatcher_unittest.cc b/components/password_manager/content/browser/content_credential_manager_dispatcher_unittest.cc
index 1800c322175987280c8c8a3f17fb13af1349ac29..4e86291dd1a90e31708f0bf87f05966d9beada99 100644
--- a/components/password_manager/content/browser/content_credential_manager_dispatcher_unittest.cc
+++ b/components/password_manager/content/browser/content_credential_manager_dispatcher_unittest.cc
@@ -138,6 +138,13 @@ class ContentCredentialManagerDispatcherTest
form_.signon_realm = form_.origin.spec();
form_.scheme = autofill::PasswordForm::SCHEME_HTML;
+ 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");
+ cross_origin_form_.origin = GURL("https://example.net/");
+ cross_origin_form_.signon_realm = cross_origin_form_.origin.spec();
+ cross_origin_form_.scheme = autofill::PasswordForm::SCHEME_HTML;
+
store_->Clear();
EXPECT_TRUE(store_->IsEmpty());
}
@@ -151,6 +158,7 @@ class ContentCredentialManagerDispatcherTest
protected:
autofill::PasswordForm form_;
+ autofill::PasswordForm cross_origin_form_;
scoped_refptr<TestPasswordStore> store_;
scoped_ptr<ContentCredentialManagerDispatcher> dispatcher_;
scoped_ptr<TestPasswordManagerClient> client_;
@@ -228,6 +236,26 @@ TEST_F(ContentCredentialManagerDispatcherTest,
}
TEST_F(ContentCredentialManagerDispatcherTest,
+ CredentialManagerOnRequestCredentialWithCrossOriginPasswordStore) {
+ store_->AddLogin(cross_origin_form_);
+
+ std::vector<GURL> federations;
+ dispatcher()->OnRequestCredential(kRequestId, false, federations);
+
+ RunAllPendingTasks();
+
+ const uint32 kMsgID = CredentialManagerMsg_SendCredential::ID;
+ const IPC::Message* message =
+ process()->sink().GetFirstMessageMatching(kMsgID);
+ EXPECT_TRUE(message);
+ CredentialManagerMsg_SendCredential::Param param;
+ CredentialManagerMsg_SendCredential::Read(message, &param);
+ EXPECT_EQ(CREDENTIAL_TYPE_EMPTY, param.b.type);
+ process()->sink().ClearMessages();
+ EXPECT_FALSE(client_->did_prompt_user_to_choose());
+}
+
+TEST_F(ContentCredentialManagerDispatcherTest,
CredentialManagerOnRequestCredentialWithFullPasswordStore) {
store_->AddLogin(form_);

Powered by Google App Engine
This is Rietveld 408576698