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

Unified Diff: components/autofill/core/browser/password_autofill_manager_unittest.cc

Issue 208453002: Add "previewing on hover" support for password field. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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/autofill/core/browser/password_autofill_manager_unittest.cc
diff --git a/components/autofill/core/browser/password_autofill_manager_unittest.cc b/components/autofill/core/browser/password_autofill_manager_unittest.cc
index 73241a5ff73007612dcde40a1cd0f59a91653428..45bcfb8d677e1c1ca5eeff9fc3d47b21645967c8 100644
--- a/components/autofill/core/browser/password_autofill_manager_unittest.cc
+++ b/components/autofill/core/browser/password_autofill_manager_unittest.cc
@@ -25,6 +25,7 @@ class MockAutofillDriver : public autofill::TestAutofillDriver {
MockAutofillDriver() {}
MOCK_METHOD1(RendererShouldAcceptPasswordAutofillSuggestion,
void(const base::string16&));
+ MOCK_METHOD1(RendererShouldPreviewPassword, void(const base::string16&));
};
} // namespace
@@ -99,4 +100,28 @@ TEST_F(PasswordAutofillManagerTest, DidAcceptAutofillSuggestion) {
username_field(), base::ASCIIToUTF16(kAliceUsername)));
}
+TEST_F(PasswordAutofillManagerTest, DidSelectAutofillSuggestion) {
+ EXPECT_CALL(*autofill_driver(),
+ RendererShouldPreviewPassword(
+ base::ASCIIToUTF16(kAliceUsername)));
+ EXPECT_TRUE(password_autofill_manager()->DidSelectAutofillSuggestion(
+ username_field(), base::ASCIIToUTF16(kAliceUsername)));
+
+ EXPECT_CALL(*autofill_driver(),
+ RendererShouldPreviewPassword(
+ base::ASCIIToUTF16(kInvalidUsername))).Times(0);
+ EXPECT_FALSE(password_autofill_manager()->DidSelectAutofillSuggestion(
+ username_field(), base::ASCIIToUTF16(kInvalidUsername)));
+
+ FormFieldData invalid_username_field;
+ invalid_username_field.name = base::ASCIIToUTF16(kInvalidUsername);
+
+ EXPECT_FALSE(password_autofill_manager()->DidSelectAutofillSuggestion(
+ invalid_username_field, base::ASCIIToUTF16(kAliceUsername)));
+
+ password_autofill_manager()->Reset();
+ EXPECT_FALSE(password_autofill_manager()->DidSelectAutofillSuggestion(
+ username_field(), base::ASCIIToUTF16(kAliceUsername)));
+}
+
} // namespace autofill

Powered by Google App Engine
This is Rietveld 408576698