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..de2a02d3afa2dbc43d2bd29d30a6b9dcf724bf63 100644 |
--- a/components/autofill/core/browser/password_autofill_manager_unittest.cc |
+++ b/components/autofill/core/browser/password_autofill_manager_unittest.cc |
@@ -23,6 +23,7 @@ namespace { |
class MockAutofillDriver : public autofill::TestAutofillDriver { |
public: |
MockAutofillDriver() {} |
+ MOCK_METHOD1(RemovePasswordAutofillSuggestion, void(const base::string16&)); |
MOCK_METHOD1(RendererShouldAcceptPasswordAutofillSuggestion, |
void(const base::string16&)); |
}; |
@@ -99,4 +100,25 @@ TEST_F(PasswordAutofillManagerTest, DidAcceptAutofillSuggestion) { |
username_field(), base::ASCIIToUTF16(kAliceUsername))); |
} |
+TEST_F(PasswordAutofillManagerTest, RemovePasswordSuggestion) { |
+ base::string16 username_to_remove; |
+ EXPECT_CALL(*autofill_driver(), |
+ RemovePasswordAutofillSuggestion(username_to_remove)); |
+ EXPECT_TRUE(password_autofill_manager()->RemovePasswordSuggestion( |
+ username_field(), username_to_remove)); |
+ |
+ EXPECT_CALL(*autofill_driver(), |
+ RemovePasswordAutofillSuggestion(username_to_remove)).Times(0); |
+ |
+ FormFieldData invalid_username_field; |
+ invalid_username_field.name = base::ASCIIToUTF16(kInvalidUsername); |
+ |
+ EXPECT_FALSE(password_autofill_manager()->RemovePasswordSuggestion( |
+ username_field(), username_to_remove)); |
+ |
+ password_autofill_manager()->Reset(); |
+ EXPECT_FALSE(password_autofill_manager()->RemovePasswordSuggestion( |
+ username_field(), username_to_remove)); |
+} |
+ |
} // namespace autofill |