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

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: cleaning the code Created 6 years, 10 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 a4651e28958c3f2bf3d11d15e29f98806bb7adf5..2e14287cce76ce62c15afd5b4b90f642883ddcbe 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/common/autofill_messages.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"
@@ -125,6 +126,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
@@ -213,6 +233,19 @@ TEST_F(AutofillDriverImplTest, FormDataSentToRenderer) {
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