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/strings/utf_string_conversions.h" | 5 #include "base/strings/utf_string_conversions.h" |
6 #include "chrome/test/base/chrome_render_view_test.h" | 6 #include "chrome/test/base/chrome_render_view_test.h" |
7 #include "components/autofill/content/common/autofill_messages.h" | 7 #include "components/autofill/content/common/autofill_messages.h" |
8 #include "components/autofill/content/renderer/autofill_agent.h" | 8 #include "components/autofill/content/renderer/autofill_agent.h" |
9 #include "components/autofill/core/common/form_data.h" | 9 #include "components/autofill/core/common/form_data.h" |
10 #include "components/autofill/core/common/form_field_data.h" | 10 #include "components/autofill/core/common/form_field_data.h" |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 WebFrame* web_frame = GetMainFrame(); | 174 WebFrame* web_frame = GetMainFrame(); |
175 WebDocument document = web_frame->document(); | 175 WebDocument document = web_frame->document(); |
176 WebInputElement firstname = | 176 WebInputElement firstname = |
177 document.getElementById("firstname").to<WebInputElement>(); | 177 document.getElementById("firstname").to<WebInputElement>(); |
178 WebInputElement middlename = | 178 WebInputElement middlename = |
179 document.getElementById("middlename").to<WebInputElement>(); | 179 document.getElementById("middlename").to<WebInputElement>(); |
180 | 180 |
181 // Simulate attempting to Autofill the form from the first element, which | 181 // Simulate attempting to Autofill the form from the first element, which |
182 // specifies autocomplete="off". This should still trigger an IPC which | 182 // specifies autocomplete="off". This should still trigger an IPC which |
183 // shouldn't display warnings. | 183 // shouldn't display warnings. |
184 autofill_agent_->InputElementClicked(firstname, true, true); | 184 autofill_agent_->FormControlElementClicked(firstname, true, true); |
185 const IPC::Message* message1 = render_thread_->sink().GetFirstMessageMatching( | 185 const IPC::Message* message1 = render_thread_->sink().GetFirstMessageMatching( |
186 AutofillHostMsg_QueryFormFieldAutofill::ID); | 186 AutofillHostMsg_QueryFormFieldAutofill::ID); |
187 EXPECT_NE(static_cast<IPC::Message*>(NULL), message1); | 187 EXPECT_NE(static_cast<IPC::Message*>(NULL), message1); |
188 | 188 |
189 AutofillQueryParam query_param; | 189 AutofillQueryParam query_param; |
190 AutofillHostMsg_QueryFormFieldAutofill::Read(message1, &query_param); | 190 AutofillHostMsg_QueryFormFieldAutofill::Read(message1, &query_param); |
191 EXPECT_FALSE(query_param.e); | 191 EXPECT_FALSE(query_param.e); |
192 render_thread_->sink().ClearMessages(); | 192 render_thread_->sink().ClearMessages(); |
193 | 193 |
194 // Simulate attempting to Autofill the form from the second element, which | 194 // Simulate attempting to Autofill the form from the second element, which |
195 // does not specify autocomplete="off". This should trigger an IPC that will | 195 // does not specify autocomplete="off". This should trigger an IPC that will |
196 // show warnings, as we *do* show warnings for elements that don't themselves | 196 // show warnings, as we *do* show warnings for elements that don't themselves |
197 // set autocomplete="off", but for which the form does. | 197 // set autocomplete="off", but for which the form does. |
198 autofill_agent_->InputElementClicked(middlename, true, true); | 198 autofill_agent_->FormControlElementClicked(middlename, true, true); |
199 const IPC::Message* message2 = render_thread_->sink().GetFirstMessageMatching( | 199 const IPC::Message* message2 = render_thread_->sink().GetFirstMessageMatching( |
200 AutofillHostMsg_QueryFormFieldAutofill::ID); | 200 AutofillHostMsg_QueryFormFieldAutofill::ID); |
201 ASSERT_NE(static_cast<IPC::Message*>(NULL), message2); | 201 ASSERT_NE(static_cast<IPC::Message*>(NULL), message2); |
202 | 202 |
203 AutofillHostMsg_QueryFormFieldAutofill::Read(message2, &query_param); | 203 AutofillHostMsg_QueryFormFieldAutofill::Read(message2, &query_param); |
204 EXPECT_TRUE(query_param.e); | 204 EXPECT_TRUE(query_param.e); |
205 } | 205 } |
206 | 206 |
207 } // namespace autofill | 207 } // namespace autofill |
OLD | NEW |