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

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

Issue 133893004: Allow deleting autofill password suggestions on Shift+Delete (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ToT 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..1a40ad2d393c959a885d731f21e464b44fcdc48e 100644
--- a/components/autofill/core/browser/password_autofill_manager_unittest.cc
+++ b/components/autofill/core/browser/password_autofill_manager_unittest.cc
@@ -23,6 +23,8 @@ namespace {
class MockAutofillDriver : public autofill::TestAutofillDriver {
public:
MockAutofillDriver() {}
+ MOCK_METHOD1(RemovePasswordAutofillSuggestion,
+ void(const autofill::PasswordForm&));
MOCK_METHOD1(RendererShouldAcceptPasswordAutofillSuggestion,
void(const base::string16&));
};
@@ -99,4 +101,25 @@ TEST_F(PasswordAutofillManagerTest, DidAcceptAutofillSuggestion) {
username_field(), base::ASCIIToUTF16(kAliceUsername)));
}
+TEST_F(PasswordAutofillManagerTest, RemovePasswordSuggestion) {
+ PasswordForm password_form;
+ EXPECT_CALL(*autofill_driver(),
+ RemovePasswordAutofillSuggestion(password_form));
+ EXPECT_TRUE(password_autofill_manager()->RemovePasswordSuggestion(
+ username_field(), password_form));
+
+ EXPECT_CALL(*autofill_driver(),
+ RemovePasswordAutofillSuggestion(password_form)).Times(0);
+
+ FormFieldData invalid_username_field;
+ invalid_username_field.name = base::ASCIIToUTF16(kInvalidUsername);
+
+ EXPECT_FALSE(password_autofill_manager()->RemovePasswordSuggestion(
+ username_field(), password_form));
+
+ password_autofill_manager()->Reset();
+ EXPECT_FALSE(password_autofill_manager()->RemovePasswordSuggestion(
+ username_field(), password_form));
+}
+
} // namespace autofill

Powered by Google App Engine
This is Rietveld 408576698