| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/strings/stringprintf.h" | 6 #include "base/strings/stringprintf.h" |
| 7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "chrome/test/base/chrome_render_view_test.h" | 8 #include "chrome/test/base/chrome_render_view_test.h" |
| 9 #include "components/autofill/content/common/autofill_messages.h" | 9 #include "components/autofill/content/common/autofill_messages.h" |
| 10 #include "components/autofill/content/renderer/autofill_agent.h" | 10 #include "components/autofill/content/renderer/autofill_agent.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 // Don't want any delay for form state sync changes. This will still post a | 51 // Don't want any delay for form state sync changes. This will still post a |
| 52 // message so updates will get coalesced, but as soon as we spin the message | 52 // message so updates will get coalesced, but as soon as we spin the message |
| 53 // loop, it will generate an update. | 53 // loop, it will generate an update. |
| 54 SendContentStateImmediately(); | 54 SendContentStateImmediately(); |
| 55 } | 55 } |
| 56 | 56 |
| 57 void SimulateRequestAutocompleteResult( | 57 void SimulateRequestAutocompleteResult( |
| 58 const blink::WebFormElement::AutocompleteResult& result, | 58 const blink::WebFormElement::AutocompleteResult& result, |
| 59 const base::string16& message) { | 59 const base::string16& message) { |
| 60 AutofillMsg_RequestAutocompleteResult msg(0, result, message, FormData()); | 60 AutofillMsg_RequestAutocompleteResult msg(0, result, message, FormData()); |
| 61 static_cast<content::RenderViewObserver*>(autofill_agent_) | 61 static_cast<content::RenderFrameObserver*>(autofill_agent_) |
| 62 ->OnMessageReceived(msg); | 62 ->OnMessageReceived(msg); |
| 63 } | 63 } |
| 64 | 64 |
| 65 private: | 65 private: |
| 66 DISALLOW_COPY_AND_ASSIGN(AutofillRendererTest); | 66 DISALLOW_COPY_AND_ASSIGN(AutofillRendererTest); |
| 67 }; | 67 }; |
| 68 | 68 |
| 69 TEST_F(AutofillRendererTest, SendForms) { | 69 TEST_F(AutofillRendererTest, SendForms) { |
| 70 LoadHTML("<form method='POST'>" | 70 LoadHTML("<form method='POST'>" |
| 71 " <input type='text' id='firstname'/>" | 71 " <input type='text' id='firstname'/>" |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 | 364 |
| 365 TEST_F(RequestAutocompleteRendererTest, InvokingTwiceOnlyShowsOnce) { | 365 TEST_F(RequestAutocompleteRendererTest, InvokingTwiceOnlyShowsOnce) { |
| 366 // Attempting to show the requestAutocomplete dialog again should be ignored. | 366 // Attempting to show the requestAutocomplete dialog again should be ignored. |
| 367 static_cast<blink::WebAutofillClient*>(autofill_agent_) | 367 static_cast<blink::WebAutofillClient*>(autofill_agent_) |
| 368 ->didRequestAutocomplete(invoking_form()); | 368 ->didRequestAutocomplete(invoking_form()); |
| 369 EXPECT_FALSE(render_thread_->sink().GetFirstMessageMatching( | 369 EXPECT_FALSE(render_thread_->sink().GetFirstMessageMatching( |
| 370 AutofillHostMsg_RequestAutocomplete::ID)); | 370 AutofillHostMsg_RequestAutocomplete::ID)); |
| 371 } | 371 } |
| 372 | 372 |
| 373 } // namespace autofill | 373 } // namespace autofill |
| OLD | NEW |