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

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

Issue 2055693002: Add delay to didAssociateFormControlsTimer so it doesn't fire too frequently (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: changed to protected Created 4 years, 6 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/password_generation_agent_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 <tuple> 5 #include <tuple>
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/files/file_util.h" 8 #include "base/files/file_util.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 "var newEmail=document.createElement('input');" 129 "var newEmail=document.createElement('input');"
130 "newEmail.setAttribute('type', 'text');" 130 "newEmail.setAttribute('type', 'text');"
131 "newEmail.setAttribute('id', 'second_email');" 131 "newEmail.setAttribute('id', 'second_email');"
132 "newEmail.value = 'bobhope@example.com';" 132 "newEmail.value = 'bobhope@example.com';"
133 "newForm.appendChild(newFirstname);" 133 "newForm.appendChild(newFirstname);"
134 "newForm.appendChild(newLastname);" 134 "newForm.appendChild(newLastname);"
135 "newForm.appendChild(newEmail);" 135 "newForm.appendChild(newEmail);"
136 "document.body.appendChild(newForm);"); 136 "document.body.appendChild(newForm);");
137 msg_loop_.RunUntilIdle(); 137 msg_loop_.RunUntilIdle();
138 138
139 WaitForAutofillDidAssociateFormControl();
Paweł Hajdan Jr. 2016/06/24 09:13:55 Isn't this very similar to RunUntilIdle? I'm wond
keishi 2016/06/24 11:35:46 RunUntilIdle isn't working because it quits before
Paweł Hajdan Jr. 2016/06/27 18:01:34 Is it correct to keep RunUntilIdle calls then? I'm
keishi 2016/06/28 02:09:18 Removed RunUntilIdle.
139 message = render_thread_->sink().GetFirstMessageMatching( 140 message = render_thread_->sink().GetFirstMessageMatching(
140 AutofillHostMsg_FormsSeen::ID); 141 AutofillHostMsg_FormsSeen::ID);
141 ASSERT_NE(nullptr, message); 142 ASSERT_NE(nullptr, message);
142 AutofillHostMsg_FormsSeen::Read(message, &params); 143 AutofillHostMsg_FormsSeen::Read(message, &params);
143 forms = std::get<0>(params); 144 forms = std::get<0>(params);
144 ASSERT_EQ(1UL, forms.size()); 145 ASSERT_EQ(1UL, forms.size());
145 ASSERT_EQ(3UL, forms[0].fields.size()); 146 ASSERT_EQ(3UL, forms[0].fields.size());
146 147
147 expected.form_control_type = "text"; 148 expected.form_control_type = "text";
148 expected.max_length = WebInputElement::defaultMaxLength(); 149 expected.max_length = WebInputElement::defaultMaxLength();
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 AutofillHostMsg_FormsSeen::Read(message, &params); 208 AutofillHostMsg_FormsSeen::Read(message, &params);
208 std::vector<FormData> forms = std::get<0>(params); 209 std::vector<FormData> forms = std::get<0>(params);
209 ASSERT_EQ(1UL, forms.size()); 210 ASSERT_EQ(1UL, forms.size());
210 ASSERT_EQ(7UL, forms[0].fields.size()); 211 ASSERT_EQ(7UL, forms[0].fields.size());
211 212
212 render_thread_->sink().ClearMessages(); 213 render_thread_->sink().ClearMessages();
213 214
214 ExecuteJavaScriptForTests("AddFields()"); 215 ExecuteJavaScriptForTests("AddFields()");
215 msg_loop_.RunUntilIdle(); 216 msg_loop_.RunUntilIdle();
216 217
218 WaitForAutofillDidAssociateFormControl();
217 message = render_thread_->sink().GetFirstMessageMatching( 219 message = render_thread_->sink().GetFirstMessageMatching(
218 AutofillHostMsg_FormsSeen::ID); 220 AutofillHostMsg_FormsSeen::ID);
221
219 ASSERT_NE(nullptr, message); 222 ASSERT_NE(nullptr, message);
220 AutofillHostMsg_FormsSeen::Read(message, &params); 223 AutofillHostMsg_FormsSeen::Read(message, &params);
221 forms = std::get<0>(params); 224 forms = std::get<0>(params);
222 ASSERT_EQ(1UL, forms.size()); 225 ASSERT_EQ(1UL, forms.size());
223 ASSERT_EQ(9UL, forms[0].fields.size()); 226 ASSERT_EQ(9UL, forms[0].fields.size());
224 227
225 FormFieldData expected; 228 FormFieldData expected;
226 229
227 expected.name = ASCIIToUTF16("EMAIL_ADDRESS"); 230 expected.name = ASCIIToUTF16("EMAIL_ADDRESS");
228 expected.value.clear(); 231 expected.value.clear();
(...skipping 28 matching lines...) Expand all
257 AutofillHostMsg_TextFieldDidChange::ID)); 260 AutofillHostMsg_TextFieldDidChange::ID));
258 261
259 // A user gesture will send a message to the browser. 262 // A user gesture will send a message to the browser.
260 EnableUserGestureSimulationForAutofill(); 263 EnableUserGestureSimulationForAutofill();
261 SimulateUserInputChangeForElement(&full_name, "Alice"); 264 SimulateUserInputChangeForElement(&full_name, "Alice");
262 ASSERT_NE(nullptr, render_thread_->sink().GetFirstMessageMatching( 265 ASSERT_NE(nullptr, render_thread_->sink().GetFirstMessageMatching(
263 AutofillHostMsg_TextFieldDidChange::ID)); 266 AutofillHostMsg_TextFieldDidChange::ID));
264 } 267 }
265 268
266 } // namespace autofill 269 } // namespace autofill
OLDNEW
« no previous file with comments | « no previous file | chrome/renderer/autofill/password_generation_agent_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698