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

Side by Side Diff: chrome/renderer/autofill/autofill_renderer_browsertest.cc

Issue 204343004: Add supports that allow Autofill to be initiated from textarea field (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Correct the returned value expectations for OnSuggestionReturned() Created 6 years, 9 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/renderer/autofill/form_autofill_browsertest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 WebFrame* web_frame = GetMainFrame(); 141 WebFrame* web_frame = GetMainFrame();
142 WebDocument document = web_frame->document(); 142 WebDocument document = web_frame->document();
143 WebInputElement firstname = 143 WebInputElement firstname =
144 document.getElementById("firstname").to<WebInputElement>(); 144 document.getElementById("firstname").to<WebInputElement>();
145 WebInputElement middlename = 145 WebInputElement middlename =
146 document.getElementById("middlename").to<WebInputElement>(); 146 document.getElementById("middlename").to<WebInputElement>();
147 147
148 // Simulate attempting to Autofill the form from the first element, which 148 // Simulate attempting to Autofill the form from the first element, which
149 // specifies autocomplete="off". This should still trigger an IPC which 149 // specifies autocomplete="off". This should still trigger an IPC which
150 // shouldn't display warnings. 150 // shouldn't display warnings.
151 autofill_agent_->InputElementClicked(firstname, true, true); 151 autofill_agent_->FormControlElementClicked(firstname, true);
152 const IPC::Message* message1 = render_thread_->sink().GetFirstMessageMatching( 152 const IPC::Message* message1 = render_thread_->sink().GetFirstMessageMatching(
153 AutofillHostMsg_QueryFormFieldAutofill::ID); 153 AutofillHostMsg_QueryFormFieldAutofill::ID);
154 EXPECT_NE(static_cast<IPC::Message*>(NULL), message1); 154 EXPECT_NE(static_cast<IPC::Message*>(NULL), message1);
155 155
156 AutofillQueryParam query_param; 156 AutofillQueryParam query_param;
157 AutofillHostMsg_QueryFormFieldAutofill::Read(message1, &query_param); 157 AutofillHostMsg_QueryFormFieldAutofill::Read(message1, &query_param);
158 EXPECT_FALSE(query_param.e); 158 EXPECT_FALSE(query_param.e);
159 render_thread_->sink().ClearMessages(); 159 render_thread_->sink().ClearMessages();
160 160
161 // Simulate attempting to Autofill the form from the second element, which 161 // Simulate attempting to Autofill the form from the second element, which
162 // does not specify autocomplete="off". This should trigger an IPC that will 162 // does not specify autocomplete="off". This should trigger an IPC that will
163 // show warnings, as we *do* show warnings for elements that don't themselves 163 // show warnings, as we *do* show warnings for elements that don't themselves
164 // set autocomplete="off", but for which the form does. 164 // set autocomplete="off", but for which the form does.
165 autofill_agent_->InputElementClicked(middlename, true, true); 165 autofill_agent_->FormControlElementClicked(middlename, true);
166 const IPC::Message* message2 = render_thread_->sink().GetFirstMessageMatching( 166 const IPC::Message* message2 = render_thread_->sink().GetFirstMessageMatching(
167 AutofillHostMsg_QueryFormFieldAutofill::ID); 167 AutofillHostMsg_QueryFormFieldAutofill::ID);
168 ASSERT_NE(static_cast<IPC::Message*>(NULL), message2); 168 ASSERT_NE(static_cast<IPC::Message*>(NULL), message2);
169 169
170 AutofillHostMsg_QueryFormFieldAutofill::Read(message2, &query_param); 170 AutofillHostMsg_QueryFormFieldAutofill::Read(message2, &query_param);
171 EXPECT_TRUE(query_param.e); 171 EXPECT_TRUE(query_param.e);
172 } 172 }
173 173
174 // Regression test for [ http://crbug.com/346010 ]. 174 // Regression test for [ http://crbug.com/346010 ].
175 TEST_F(AutofillRendererTest, DontCrashWhileAssociatingForms) { 175 TEST_F(AutofillRendererTest, DontCrashWhileAssociatingForms) {
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 } 299 }
300 300
301 TEST_F(RequestAutocompleteRendererTest, InvokingTwiceOnlyShowsOnce) { 301 TEST_F(RequestAutocompleteRendererTest, InvokingTwiceOnlyShowsOnce) {
302 // Attempting to show the requestAutocomplete dialog again should be ignored. 302 // Attempting to show the requestAutocomplete dialog again should be ignored.
303 autofill_agent_->didRequestAutocomplete(invoking_frame(), invoking_form()); 303 autofill_agent_->didRequestAutocomplete(invoking_frame(), invoking_form());
304 EXPECT_FALSE(render_thread_->sink().GetFirstMessageMatching( 304 EXPECT_FALSE(render_thread_->sink().GetFirstMessageMatching(
305 AutofillHostMsg_RequestAutocomplete::ID)); 305 AutofillHostMsg_RequestAutocomplete::ID));
306 } 306 }
307 307
308 } // namespace autofill 308 } // namespace autofill
OLDNEW
« no previous file with comments | « no previous file | chrome/renderer/autofill/form_autofill_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698