Chromium Code Reviews| 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 b313211ba58af6e21423fd5c1799bb6e1697ff42..02c7fc9eaa57c89b0fedfd038930cf770d51e4e5 100644 |
| --- a/components/autofill/content/browser/autofill_driver_impl_unittest.cc |
| +++ b/components/autofill/content/browser/autofill_driver_impl_unittest.cc |
| @@ -124,39 +124,12 @@ class AutofillDriverImplTest : public ChromeRenderViewHostTestHarness { |
| return true; |
| } |
| - // Searches for an |AutofillMsg_SetAutofillActionPreview| message in the |
| - // queue of sent IPC messages. If none is present, returns false. Otherwise, |
| - // clears the queue of sent messages and returns true. |
| - bool GetSetAutofillActionPreviewMessage() { |
| - const uint32 kMsgID = AutofillMsg_SetAutofillActionPreview::ID; |
| - const IPC::Message* message = |
| - process()->sink().GetFirstMessageMatching(kMsgID); |
| - if (!message) |
| - return false; |
| - process()->sink().ClearMessages(); |
| - return true; |
| - } |
| - |
| - // Searches for an |AutofillMsg_SetAutofillActionFill| message in the |
| - // queue of sent IPC messages. If none is present, returns false. Otherwise, |
| - // clears the queue of sent messages and returns true. |
| - bool GetSetAutofillActionFillMessage() { |
| - const uint32 kMsgID = AutofillMsg_SetAutofillActionFill::ID; |
| - const IPC::Message* message = |
| - process()->sink().GetFirstMessageMatching(kMsgID); |
| - if (!message) |
| - return false; |
| - process()->sink().ClearMessages(); |
| - return true; |
| - } |
| - |
| - // Searches for an |AutofillMsg_ClearForm| message in the queue of sent IPC |
| + // Searches for a message matching |messageID| in the queue of sent IPC |
| // messages. If none is present, returns false. Otherwise, clears the queue |
| // of sent messages and returns true. |
| - bool GetClearFormMessage() { |
| - const uint32 kMsgID = AutofillMsg_ClearForm::ID; |
| + bool GetMessageMatchingID(const uint32 messageID) { |
|
Ilya Sherman
2013/07/09 22:45:36
nit: Perhaps name this "HasMessageMatchingID" rath
Ilya Sherman
2013/07/09 22:45:36
nit: For whatever reason, the common style is to n
blundell
2013/07/10 08:35:20
Done.
blundell
2013/07/10 08:35:20
Done.
|
| const IPC::Message* message = |
| - process()->sink().GetFirstMessageMatching(kMsgID); |
| + process()->sink().GetFirstMessageMatching(messageID); |
| if (!message) |
| return false; |
| process()->sink().ClearMessages(); |
| @@ -229,18 +202,23 @@ TEST_F(AutofillDriverImplTest, TypePredictionsSentToRendererWhenEnabled) { |
| TEST_F(AutofillDriverImplTest, PreviewActionSentToRenderer) { |
| driver_->SetRendererActionOnFormDataReception( |
| AutofillDriver::FORM_DATA_ACTION_PREVIEW); |
| - EXPECT_TRUE(GetSetAutofillActionPreviewMessage()); |
| + EXPECT_TRUE(GetMessageMatchingID(AutofillMsg_SetAutofillActionPreview::ID)); |
| } |
| TEST_F(AutofillDriverImplTest, FillActionSentToRenderer) { |
| driver_->SetRendererActionOnFormDataReception( |
| AutofillDriver::FORM_DATA_ACTION_FILL); |
| - EXPECT_TRUE(GetSetAutofillActionFillMessage()); |
| + EXPECT_TRUE(GetMessageMatchingID(AutofillMsg_SetAutofillActionFill::ID)); |
| +} |
| + |
| +TEST_F(AutofillDriverImplTest, ClearFilledFormSentToRenderer) { |
| + driver_->RendererShouldClearFilledForm(); |
| + EXPECT_TRUE(GetMessageMatchingID(AutofillMsg_ClearForm::ID)); |
| } |
| -TEST_F(AutofillDriverImplTest, ClearFormSentToRenderer) { |
| - driver_->RendererShouldClearForm(); |
| - EXPECT_TRUE(GetClearFormMessage()); |
| +TEST_F(AutofillDriverImplTest, ClearPreviewedFormSentToRenderer) { |
| + driver_->RendererShouldClearPreviewedForm(); |
| + EXPECT_TRUE(GetMessageMatchingID(AutofillMsg_ClearPreviewedForm::ID)); |
| } |
| } // namespace autofill |