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

Unified Diff: components/autofill/content/browser/autofill_driver_impl_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/content/browser/autofill_driver_impl_unittest.cc
diff --git a/components/autofill/content/browser/autofill_driver_impl_unittest.cc b/components/autofill/content/browser/autofill_driver_impl_unittest.cc
index 1e69b43f97ee2ae91bcb1535973a8e0c06fcf1aa..3177ec694ebfe39bef32dfdfa48a27cda2d67cde 100644
--- a/components/autofill/content/browser/autofill_driver_impl_unittest.cc
+++ b/components/autofill/content/browser/autofill_driver_impl_unittest.cc
@@ -17,6 +17,7 @@
#include "components/autofill/core/browser/test_autofill_manager_delegate.h"
#include "components/autofill/core/common/autofill_switches.h"
#include "components/autofill/core/common/form_data_predictions.h"
+#include "components/autofill/core/common/password_form.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/navigation_details.h"
#include "content/public/browser/web_contents.h"
@@ -148,6 +149,25 @@ class AutofillDriverImplTest : public ChromeRenderViewHostTestHarness {
return true;
}
+ // Searches for an |AutofillMsg_RemovePasswordSuggestion| message in the queue
+ // of sent IPC messages. If none is present, returns false. Otherwise,
+ // extracts the first |AutofillMsg_RemovePasswordSuggestion| message, fills
+ // the output parameters with the values of the message's parameter, and
+ // clears the queue of sent messages.
+ bool GetRemovePasswordSuggestionMessage(PasswordForm* results) {
+ const uint32 kMsgID = AutofillMsg_RemovePasswordSuggestion::ID;
+ const IPC::Message* message =
+ process()->sink().GetFirstMessageMatching(kMsgID);
+ if (!message)
+ return false;
+ Tuple1<PasswordForm> password_form;
+ AutofillMsg_RemovePasswordSuggestion::Read(message, &password_form);
+ if (results)
+ *results = password_form.a;
+ process()->sink().ClearMessages();
+ return true;
+ }
+
// Searches for a message matching |messageID| in the queue of sent IPC
// messages. If none is present, returns false. Otherwise, extracts the first
// matching message, fills the output parameter with the string16 from the
@@ -262,6 +282,19 @@ TEST_F(AutofillDriverImplTest, FormDataSentToRenderer_PreviewForm) {
EXPECT_EQ(input_form_data, output_form_data);
}
+TEST_F(AutofillDriverImplTest, RemovePasswordSuggestionSentToRenderer) {
+ PasswordForm input_password_form;
+ input_password_form.username_value = base::ASCIIToUTF16("username");
+ input_password_form.password_value = base::ASCIIToUTF16("password");
+
+ driver_->RemovePasswordAutofillSuggestion(input_password_form);
+
+ PasswordForm output_password_form;
+ EXPECT_TRUE(GetRemovePasswordSuggestionMessage(&output_password_form));
+
+ EXPECT_EQ(input_password_form, output_password_form);
+}
+
TEST_F(AutofillDriverImplTest, TypePredictionsNotSentToRendererWhenDisabled) {
FormData form;
test::CreateTestAddressFormData(&form);

Powered by Google App Engine
This is Rietveld 408576698