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

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

Issue 223133003: Allow deleting autofill password suggestions on Shift+Delete (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixed problems in previous patch Created 6 years, 8 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..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
« no previous file with comments | « components/autofill/core/browser/password_autofill_manager.cc ('k') | components/autofill/core/browser/test_autofill_driver.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698