| 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);
|
|
|