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 <vector> | 5 #include <vector> |
6 | 6 |
7 #include "base/format_macros.h" | 7 #include "base/format_macros.h" |
8 #include "base/metrics/field_trial.h" | 8 #include "base/metrics/field_trial.h" |
9 #include "base/strings/string16.h" | 9 #include "base/strings/string16.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 using blink::WebVector; | 44 using blink::WebVector; |
45 | 45 |
46 namespace { | 46 namespace { |
47 | 47 |
48 struct AutofillFieldCase { | 48 struct AutofillFieldCase { |
49 const char* const form_control_type; | 49 const char* const form_control_type; |
50 const char* const name; | 50 const char* const name; |
51 const char* const initial_value; | 51 const char* const initial_value; |
52 const char* const autocomplete_attribute; // The autocomplete attribute of | 52 const char* const autocomplete_attribute; // The autocomplete attribute of |
53 // the element. | 53 // the element. |
54 bool should_be_autofilled; // Whether the filed should be autofilled. | 54 bool is_autofilled; // Whether the FormFieldData field is autofilled. |
| 55 bool should_be_autofilled; // Whether the filed should be autofilled. |
55 const char* const autofill_value; // The value being used to fill the field. | 56 const char* const autofill_value; // The value being used to fill the field. |
56 const char* const expected_value; // The expected value after Autofill | 57 const char* const expected_value; // The expected value after Autofill |
57 // or Preview. | 58 // or Preview. |
58 }; | 59 }; |
59 | 60 |
60 static const char kFormHtml[] = | 61 static const char kFormHtml[] = |
61 "<FORM name=\"TestForm\" action=\"http://buh.com\" method=\"post\">" | 62 "<FORM name=\"TestForm\" action=\"http://buh.com\" method=\"post\">" |
62 " <INPUT type=\"text\" id=\"firstname\"/>" | 63 " <INPUT type=\"text\" id=\"firstname\"/>" |
63 " <INPUT type=\"text\" id=\"lastname\"/>" | 64 " <INPUT type=\"text\" id=\"lastname\"/>" |
64 " <INPUT type=\"hidden\" id=\"imhidden\"/>" | 65 " <INPUT type=\"hidden\" id=\"imhidden\"/>" |
65 " <INPUT type=\"text\" id=\"notempty\" value=\"Hi\"/>" | 66 " <INPUT type=\"text\" id=\"notempty\" value=\"Hi\"/>" |
66 " <INPUT type=\"text\" autocomplete=\"off\" id=\"noautocomplete\"/>" | 67 " <INPUT type=\"text\" autocomplete=\"off\" id=\"noautocomplete\"/>" |
67 " <INPUT type=\"text\" disabled=\"disabled\" id=\"notenabled\"/>" | 68 " <INPUT type=\"text\" disabled=\"disabled\" id=\"notenabled\"/>" |
68 " <INPUT type=\"text\" readonly id=\"readonly\"/>" | 69 " <INPUT type=\"text\" readonly id=\"readonly\"/>" |
69 " <INPUT type=\"text\" style=\"visibility: hidden\"" | 70 " <INPUT type=\"text\" style=\"visibility: hidden\"" |
70 " id=\"invisible\"/>" | 71 " id=\"invisible\"/>" |
71 " <INPUT type=\"text\" style=\"display: none\" id=\"displaynone\"/>" | 72 " <INPUT type=\"text\" style=\"display: none\" id=\"displaynone\"/>" |
72 " <INPUT type=\"month\" id=\"month\"/>" | 73 " <INPUT type=\"month\" id=\"month\"/>" |
73 " <INPUT type=\"month\" id=\"month-nonempty\" value=\"2011-12\"/>" | 74 " <INPUT type=\"month\" id=\"month-nonempty\" value=\"2011-12\"/>" |
74 " <SELECT id=\"select\">" | 75 " <SELECT id=\"select\">" |
75 " <OPTION></OPTION>" | 76 " <OPTION></OPTION>" |
76 " <OPTION value=\"CA\">California</OPTION>" | 77 " <OPTION value=\"CA\">California</OPTION>" |
77 " <OPTION value=\"TX\">Texas</OPTION>" | 78 " <OPTION value=\"TX\">Texas</OPTION>" |
78 " </SELECT>" | 79 " </SELECT>" |
79 " <SELECT id=\"select-nonempty\">" | 80 " <SELECT id=\"select-nonempty\">" |
80 " <OPTION value=\"CA\" selected>California</OPTION>" | 81 " <OPTION value=\"CA\" selected>California</OPTION>" |
81 " <OPTION value=\"TX\">Texas</OPTION>" | 82 " <OPTION value=\"TX\">Texas</OPTION>" |
82 " </SELECT>" | 83 " </SELECT>" |
| 84 " <SELECT id=\"select-nonewsuggestion\">" |
| 85 " <OPTION value=\"CA\" selected>California</OPTION>" |
| 86 " <OPTION value=\"TX\">Texas</OPTION>" |
| 87 " </SELECT>" |
83 " <TEXTAREA id=\"textarea\"></TEXTAREA>" | 88 " <TEXTAREA id=\"textarea\"></TEXTAREA>" |
84 " <TEXTAREA id=\"textarea-nonempty\">Go away!</TEXTAREA>" | 89 " <TEXTAREA id=\"textarea-nonempty\">Go away!</TEXTAREA>" |
85 " <INPUT type=\"submit\" name=\"reply-send\" value=\"Send\"/>" | 90 " <INPUT type=\"submit\" name=\"reply-send\" value=\"Send\"/>" |
86 "</FORM>"; | 91 "</FORM>"; |
87 | 92 |
88 } // namespace | 93 } // namespace |
89 | 94 |
90 namespace autofill { | 95 namespace autofill { |
91 | 96 |
92 class FormAutofillTest : public ChromeRenderViewTest { | 97 class FormAutofillTest : public ChromeRenderViewTest { |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 expected.form_control_type = field_cases[i].form_control_type; | 213 expected.form_control_type = field_cases[i].form_control_type; |
209 expected.max_length = | 214 expected.max_length = |
210 expected.form_control_type == "text" ? | 215 expected.form_control_type == "text" ? |
211 WebInputElement::defaultMaxLength() : 0; | 216 WebInputElement::defaultMaxLength() : 0; |
212 expected.name = ASCIIToUTF16(field_cases[i].name); | 217 expected.name = ASCIIToUTF16(field_cases[i].name); |
213 expected.value = ASCIIToUTF16(field_cases[i].initial_value); | 218 expected.value = ASCIIToUTF16(field_cases[i].initial_value); |
214 expected.autocomplete_attribute = field_cases[i].autocomplete_attribute; | 219 expected.autocomplete_attribute = field_cases[i].autocomplete_attribute; |
215 EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields[i]); | 220 EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields[i]); |
216 // Fill the form_data for the field. | 221 // Fill the form_data for the field. |
217 form_data.fields[i].value = ASCIIToUTF16(field_cases[i].autofill_value); | 222 form_data.fields[i].value = ASCIIToUTF16(field_cases[i].autofill_value); |
| 223 // Set the is_autofilled property for "select-one" field. |
| 224 std::string form_control_type = field_cases[i].form_control_type; |
| 225 if (form_control_type == "select-one") |
| 226 form_data.fields[i].is_autofilled = field_cases[i].is_autofilled; |
218 } | 227 } |
219 | 228 |
220 // Autofill the form using the given fill form function. | 229 // Autofill the form using the given fill form function. |
221 fill_form_function(form_data, input_element); | 230 fill_form_function(form_data, input_element); |
222 | 231 |
223 // Validate Autofill or Preview results. | 232 // Validate Autofill or Preview results. |
224 for (size_t i = 0; i < number_of_field_cases; ++i) { | 233 for (size_t i = 0; i < number_of_field_cases; ++i) { |
225 ValidteFilledField(field_cases[i], get_value_function); | 234 ValidteFilledField(field_cases[i], get_value_function); |
226 } | 235 } |
227 } | 236 } |
(...skipping 1093 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1321 EXPECT_FORM_FIELD_DATA_EQUALS(expected, field); | 1330 EXPECT_FORM_FIELD_DATA_EQUALS(expected, field); |
1322 } | 1331 } |
1323 | 1332 |
1324 // Test regular FillForm function. | 1333 // Test regular FillForm function. |
1325 TEST_F(FormAutofillTest, FillForm) { | 1334 TEST_F(FormAutofillTest, FillForm) { |
1326 static const AutofillFieldCase field_cases[] = { | 1335 static const AutofillFieldCase field_cases[] = { |
1327 // fields: form_control_type, name, initial_value, autocomplete_attribute, | 1336 // fields: form_control_type, name, initial_value, autocomplete_attribute, |
1328 // should_be_autofilled, autofill_value, expected_value | 1337 // should_be_autofilled, autofill_value, expected_value |
1329 | 1338 |
1330 // Regular empty fields (firstname & lastname) should be autofilled. | 1339 // Regular empty fields (firstname & lastname) should be autofilled. |
1331 {"text", "firstname", "", "", true, "filled firstname", | 1340 {"text", "firstname", "", "", false, true, "filled firstname", |
1332 "filled firstname"}, | 1341 "filled firstname"}, |
1333 {"text", "lastname", "", "", true, "filled lastname", "filled lastname"}, | 1342 {"text", "lastname", "", "", false, true, "filled lastname", |
| 1343 "filled lastname"}, |
1334 // hidden fields should not be extracted to form_data. | 1344 // hidden fields should not be extracted to form_data. |
1335 // Non empty fields should not be autofilled. | 1345 // Non empty fields should not be autofilled. |
1336 {"text", "notempty", "Hi", "", false, "filled notempty", "Hi"}, | 1346 {"text", "notempty", "Hi", "", false, false, "filled notempty", "Hi"}, |
1337 // "noautocomplete" should not be extracted to form_data. | 1347 // "noautocomplete" should not be extracted to form_data. |
1338 // Disabled fields should not be autofilled. | 1348 // Disabled fields should not be autofilled. |
1339 {"text", "notenabled", "", "", false, "filled notenabled", ""}, | 1349 {"text", "notenabled", "", "", false, false, "filled notenabled", ""}, |
1340 // Readonly fields should not be autofilled. | 1350 // Readonly fields should not be autofilled. |
1341 {"text", "readonly", "", "", false, "filled readonly", ""}, | 1351 {"text", "readonly", "", "", false, false, "filled readonly", ""}, |
1342 // Fields with "visibility: hidden" should not be autofilled. | 1352 // Fields with "visibility: hidden" should not be autofilled. |
1343 {"text", "invisible", "", "", false, "filled invisible", ""}, | 1353 {"text", "invisible", "", "", false, false, "filled invisible", ""}, |
1344 // Fields with "display:none" should not be autofilled. | 1354 // Fields with "display:none" should not be autofilled. |
1345 {"text", "displaynone", "", "", false, "filled displaynone", ""}, | 1355 {"text", "displaynone", "", "", false, false, "filled displaynone", ""}, |
1346 // Regular <input type="month"> should be autofilled. | 1356 // Regular <input type="month"> should be autofilled. |
1347 {"month", "month", "", "", true, "2017-11", "2017-11"}, | 1357 {"month", "month", "", "", false, true, "2017-11", "2017-11"}, |
1348 // Non-empty <input type="month"> should not be autofilled. | 1358 // Non-empty <input type="month"> should not be autofilled. |
1349 {"month", "month-nonempty", "2011-12", "", false, "2017-11", "2011-12"}, | 1359 {"month", "month-nonempty", "2011-12", "", false, false, "2017-11", |
| 1360 "2011-12"}, |
1350 // Regular select fields should be autofilled. | 1361 // Regular select fields should be autofilled. |
1351 {"select-one", "select", "", "", true, "TX", "TX"}, | 1362 {"select-one", "select", "", "", true, true, "TX", "TX"}, |
1352 // Select fields should be autofilled even if they already have a | 1363 // Select fields should be autofilled even if they already have a |
1353 // non-empty value. | 1364 // non-empty value. |
1354 {"select-one", "select-nonempty", "CA", "", true, "TX", "TX"}, | 1365 {"select-one", "select-nonempty", "CA", "", true, true, "TX", "TX"}, |
| 1366 // Select fields should be autofilled with the existing value if |
| 1367 // no new value is passed from autofill profile. |
| 1368 {"select-one", "select-nonewsuggestion", "CA", "", false, true, "CA", |
| 1369 "CA"}, |
1355 // Regular textarea elements should be autofilled. | 1370 // Regular textarea elements should be autofilled. |
1356 {"textarea", "textarea", "", "", true, "some multi-\nline value", | 1371 {"textarea", "textarea", "", "", false, true, "some multi-\nline value", |
1357 "some multi-\nline value"}, | 1372 "some multi-\nline value"}, |
1358 // Non-empty textarea elements should not be autofilled. | 1373 // Non-empty textarea elements should not be autofilled. |
1359 {"textarea", "textarea-nonempty", "Go\naway!", "", false, | 1374 {"textarea", "textarea-nonempty", "Go\naway!", "", false, false, |
1360 "some multi-\nline value", "Go\naway!"}, | 1375 "some multi-\nline value", "Go\naway!"}, |
1361 }; | 1376 }; |
1362 TestFormFillFunctions(kFormHtml, field_cases, arraysize(field_cases), | 1377 TestFormFillFunctions(kFormHtml, field_cases, arraysize(field_cases), |
1363 FillForm, &GetValueWrapper); | 1378 FillForm, &GetValueWrapper); |
1364 // Verify preview selection. | 1379 // Verify preview selection. |
1365 WebInputElement firstname = GetMainFrame()->document(). | 1380 WebInputElement firstname = GetMainFrame()->document(). |
1366 getElementById("firstname").to<WebInputElement>(); | 1381 getElementById("firstname").to<WebInputElement>(); |
1367 EXPECT_EQ(16, firstname.selectionStart()); | 1382 EXPECT_EQ(16, firstname.selectionStart()); |
1368 EXPECT_EQ(16, firstname.selectionEnd()); | 1383 EXPECT_EQ(16, firstname.selectionEnd()); |
1369 } | 1384 } |
1370 | 1385 |
1371 TEST_F(FormAutofillTest, FillFormIncludingNonFocusableElements) { | 1386 TEST_F(FormAutofillTest, FillFormIncludingNonFocusableElements) { |
1372 static const AutofillFieldCase field_cases[] = { | 1387 static const AutofillFieldCase field_cases[] = { |
1373 // fields: form_control_type, name, initial_value, autocomplete_attribute, | 1388 // fields: form_control_type, name, initial_value, autocomplete_attribute, |
1374 // should_be_autofilled, autofill_value, expected_value | 1389 // should_be_autofilled, autofill_value, expected_value |
1375 | 1390 |
1376 // Regular empty fields (firstname & lastname) should be autofilled. | 1391 // Regular empty fields (firstname & lastname) should be autofilled. |
1377 {"text", "firstname", "", "", true, "filled firstname", | 1392 {"text", "firstname", "", "", false, true, "filled firstname", |
1378 "filled firstname"}, | 1393 "filled firstname"}, |
1379 {"text", "lastname", "", "", true, "filled lastname", "filled lastname"}, | 1394 {"text", "lastname", "", "", false, true, "filled lastname", |
| 1395 "filled lastname"}, |
1380 // hidden fields should not be extracted to form_data. | 1396 // hidden fields should not be extracted to form_data. |
1381 // Non empty fields should be overriden. | 1397 // Non empty fields should be overriden. |
1382 {"text", "notempty", "Hi", "", true, "filled notempty", | 1398 {"text", "notempty", "Hi", "", false, true, "filled notempty", |
1383 "filled notempty"}, | 1399 "filled notempty"}, |
1384 // "noautocomplete" should not be extracted to form_data. | 1400 // "noautocomplete" should not be extracted to form_data. |
1385 // Disabled fields should not be autofilled. | 1401 // Disabled fields should not be autofilled. |
1386 {"text", "notenabled", "", "", false, "filled notenabled", ""}, | 1402 {"text", "notenabled", "", "", false, false, "filled notenabled", ""}, |
1387 // Readonly fields should not be autofilled. | 1403 // Readonly fields should not be autofilled. |
1388 {"text", "readonly", "", "", false, "filled readonly", ""}, | 1404 {"text", "readonly", "", "", false, false, "filled readonly", ""}, |
1389 // Fields with "visibility: hidden" should also be autofilled. | 1405 // Fields with "visibility: hidden" should also be autofilled. |
1390 {"text", "invisible", "", "", true, "filled invisible", | 1406 {"text", "invisible", "", "", false, true, "filled invisible", |
1391 "filled invisible"}, | 1407 "filled invisible"}, |
1392 // Fields with "display:none" should also be autofilled. | 1408 // Fields with "display:none" should also be autofilled. |
1393 {"text", "displaynone", "", "", true, "filled displaynone", | 1409 {"text", "displaynone", "", "", false, true, "filled displaynone", |
1394 "filled displaynone"}, | 1410 "filled displaynone"}, |
1395 // Regular <input type="month"> should be autofilled. | 1411 // Regular <input type="month"> should be autofilled. |
1396 {"month", "month", "", "", true, "2017-11", "2017-11"}, | 1412 {"month", "month", "", "", false, true, "2017-11", "2017-11"}, |
1397 // Non-empty <input type="month"> should be overridden. | 1413 // Non-empty <input type="month"> should be overridden. |
1398 {"month", "month-nonempty", "2011-12", "", true, "2017-11", "2017-11"}, | 1414 {"month", "month-nonempty", "2011-12", "", false, true, "2017-11", |
| 1415 "2017-11"}, |
1399 // Regular select fields should be autofilled. | 1416 // Regular select fields should be autofilled. |
1400 {"select-one", "select", "", "", true, "TX", "TX"}, | 1417 {"select-one", "select", "", "", true, true, "TX", "TX"}, |
1401 // Select fields should be autofilled even if they already have a | 1418 // Select fields should be autofilled even if they already have a |
1402 // non-empty value. | 1419 // non-empty value. |
1403 {"select-one", "select-nonempty", "CA", "", true, "TX", "TX"}, | 1420 {"select-one", "select-nonempty", "CA", "", true, true, "TX", "TX"}, |
| 1421 // Select fields should be autofilled with the existing value if |
| 1422 // no new value is passed from autofill profile. |
| 1423 {"select-one", "select-nonewsuggestion", "CA", "", false, true, "CA", |
| 1424 "CA"}, |
1404 // Regular textarea elements should be autofilled. | 1425 // Regular textarea elements should be autofilled. |
1405 {"textarea", "textarea", "", "", true, "some multi-\nline value", | 1426 {"textarea", "textarea", "", "", false, true, "some multi-\nline value", |
1406 "some multi-\nline value"}, | 1427 "some multi-\nline value"}, |
1407 // Nonempty textarea elements should be overridden. | 1428 // Nonempty textarea elements should be overridden. |
1408 {"textarea", "textarea-nonempty", "Go\naway!", "", true, | 1429 {"textarea", "textarea-nonempty", "Go\naway!", "", false, true, |
1409 "some multi-\nline value", "some multi-\nline value"}, | 1430 "some multi-\nline value", "some multi-\nline value"}, |
1410 }; | 1431 }; |
1411 TestFormFillFunctions(kFormHtml, field_cases, arraysize(field_cases), | 1432 TestFormFillFunctions(kFormHtml, field_cases, arraysize(field_cases), |
1412 &FillFormIncludingNonFocusableElementsWrapper, | 1433 &FillFormIncludingNonFocusableElementsWrapper, |
1413 &GetValueWrapper); | 1434 &GetValueWrapper); |
1414 } | 1435 } |
1415 | 1436 |
1416 TEST_F(FormAutofillTest, PreviewForm) { | 1437 TEST_F(FormAutofillTest, PreviewForm) { |
1417 static const AutofillFieldCase field_cases[] = { | 1438 static const AutofillFieldCase field_cases[] = { |
1418 // Normal empty fields should be previewed. | 1439 // Normal empty fields should be previewed. |
1419 {"text", "firstname", "", "", true, "suggested firstname", | 1440 {"text", "firstname", "", "", false, true, "suggested firstname", |
1420 "suggested firstname"}, | 1441 "suggested firstname"}, |
1421 {"text", "lastname", "", "", true, "suggested lastname", | 1442 {"text", "lastname", "", "", false, true, "suggested lastname", |
1422 "suggested lastname"}, | 1443 "suggested lastname"}, |
1423 // Hidden fields should not be extracted to form_data. | 1444 // Hidden fields should not be extracted to form_data. |
1424 // Non empty fields should not be previewed. | 1445 // Non empty fields should not be previewed. |
1425 {"text", "notempty", "Hi", "", false, "suggested notempty", ""}, | 1446 {"text", "notempty", "Hi", "", false, false, "suggested notempty", ""}, |
1426 // "noautocomplete" should not be extracted to form_data. | 1447 // "noautocomplete" should not be extracted to form_data. |
1427 // Disabled fields should not be previewed. | 1448 // Disabled fields should not be previewed. |
1428 {"text", "notenabled", "", "", false, "suggested notenabled", ""}, | 1449 {"text", "notenabled", "", "", false, false, "suggested notenabled", ""}, |
1429 // Readonly fields should not be previewed. | 1450 // Readonly fields should not be previewed. |
1430 {"text", "readonly", "", "", false, "suggested readonly", ""}, | 1451 {"text", "readonly", "", "", false, false, "suggested readonly", ""}, |
1431 // Fields with "visibility: hidden" should not be previewed. | 1452 // Fields with "visibility: hidden" should not be previewed. |
1432 {"text", "invisible", "", "", false, "suggested invisible", | 1453 {"text", "invisible", "", "", false, false, "suggested invisible", |
1433 ""}, | 1454 ""}, |
1434 // Fields with "display:none" should not previewed. | 1455 // Fields with "display:none" should not previewed. |
1435 {"text", "displaynone", "", "", false, "suggested displaynone", | 1456 {"text", "displaynone", "", "", false, false, "suggested displaynone", |
1436 ""}, | 1457 ""}, |
1437 // Regular <input type="month"> should be previewed. | 1458 // Regular <input type="month"> should be previewed. |
1438 {"month", "month", "", "", true, "2017-11", "2017-11"}, | 1459 {"month", "month", "", "", false, true, "2017-11", "2017-11"}, |
1439 // Non-empty <input type="month"> should not be previewed. | 1460 // Non-empty <input type="month"> should not be previewed. |
1440 {"month", "month-nonempty", "2011-12", "", false, "2017-11", ""}, | 1461 {"month", "month-nonempty", "2011-12", "", false, false, "2017-11", ""}, |
1441 // Regular select fields should be previewed. | 1462 // Regular select fields should be previewed. |
1442 {"select-one", "select", "", "", true, "TX", "TX"}, | 1463 {"select-one", "select", "", "", true, true, "TX", "TX"}, |
1443 // Select fields should be previewed even if they already have a | 1464 // Select fields should be previewed even if they already have a |
1444 // non-empty value. | 1465 // non-empty value. |
1445 {"select-one", "select-nonempty", "CA", "", true, "TX", "TX"}, | 1466 {"select-one", "select-nonempty", "CA", "", true, true, "TX", "TX"}, |
| 1467 // Select fields autofilled property should be set as false when |
| 1468 // no value is suggested from autofill profile. |
| 1469 {"select-one", "select-nonewsuggestion", "CA", "", false, false, "CA", |
| 1470 "CA"}, |
1446 // Normal textarea elements should be previewed. | 1471 // Normal textarea elements should be previewed. |
1447 {"textarea", "textarea", "", "", true, "suggested multi-\nline value", | 1472 {"textarea", "textarea", "", "", false, true, |
1448 "suggested multi-\nline value"}, | 1473 "suggested multi-\nline value", "suggested multi-\nline value"}, |
1449 // Nonempty textarea elements should not be previewed. | 1474 // Nonempty textarea elements should not be previewed. |
1450 {"textarea", "textarea-nonempty", "Go\naway!", "", false, | 1475 {"textarea", "textarea-nonempty", "Go\naway!", "", false, false, |
1451 "suggested multi-\nline value", ""}, | 1476 "suggested multi-\nline value", ""}, |
1452 }; | 1477 }; |
1453 TestFormFillFunctions(kFormHtml, field_cases, arraysize(field_cases), | 1478 TestFormFillFunctions(kFormHtml, field_cases, arraysize(field_cases), |
1454 &PreviewForm, &GetSuggestedValueWrapper); | 1479 &PreviewForm, &GetSuggestedValueWrapper); |
1455 | 1480 |
1456 // Verify preview selection. | 1481 // Verify preview selection. |
1457 WebInputElement firstname = GetMainFrame()->document(). | 1482 WebInputElement firstname = GetMainFrame()->document(). |
1458 getElementById("firstname").to<WebInputElement>(); | 1483 getElementById("firstname").to<WebInputElement>(); |
1459 EXPECT_EQ(0, firstname.selectionStart()); | 1484 EXPECT_EQ(0, firstname.selectionStart()); |
1460 EXPECT_EQ(19, firstname.selectionEnd()); | 1485 EXPECT_EQ(19, firstname.selectionEnd()); |
(...skipping 2011 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3472 EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields[1]); | 3497 EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields[1]); |
3473 | 3498 |
3474 expected.name = ASCIIToUTF16("country"); | 3499 expected.name = ASCIIToUTF16("country"); |
3475 expected.value = ASCIIToUTF16("AL"); | 3500 expected.value = ASCIIToUTF16("AL"); |
3476 expected.form_control_type = "select-one"; | 3501 expected.form_control_type = "select-one"; |
3477 expected.max_length = 0; | 3502 expected.max_length = 0; |
3478 EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields[2]); | 3503 EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields[2]); |
3479 } | 3504 } |
3480 | 3505 |
3481 } // namespace autofill | 3506 } // namespace autofill |
OLD | NEW |