| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/memory/scoped_ptr.h" | 5 #include "base/memory/scoped_ptr.h" |
| 6 #include "base/string_util.h" | 6 #include "base/string_util.h" |
| 7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 8 #include "chrome/browser/autofill/form_structure.h" | 8 #include "chrome/browser/autofill/form_structure.h" |
| 9 #include "googleurl/src/gurl.h" | 9 #include "googleurl/src/gurl.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| (...skipping 1366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1377 0, | 1377 0, |
| 1378 false)); | 1378 false)); |
| 1379 possible_field_types.push_back(FieldTypeSet()); | 1379 possible_field_types.push_back(FieldTypeSet()); |
| 1380 possible_field_types.back().insert(PHONE_FAX_WHOLE_NUMBER); | 1380 possible_field_types.back().insert(PHONE_FAX_WHOLE_NUMBER); |
| 1381 form_structure.reset(new FormStructure(form)); | 1381 form_structure.reset(new FormStructure(form)); |
| 1382 | 1382 |
| 1383 ASSERT_EQ(form_structure->field_count(), possible_field_types.size()); | 1383 ASSERT_EQ(form_structure->field_count(), possible_field_types.size()); |
| 1384 for (size_t i = 0; i < form_structure->field_count(); ++i) | 1384 for (size_t i = 0; i < form_structure->field_count(); ++i) |
| 1385 form_structure->set_possible_types(i, possible_field_types[i]); | 1385 form_structure->set_possible_types(i, possible_field_types[i]); |
| 1386 | 1386 |
| 1387 FieldTypeSet available_field_types; |
| 1388 available_field_types.insert(NAME_FIRST); |
| 1389 available_field_types.insert(NAME_LAST); |
| 1390 available_field_types.insert(ADDRESS_HOME_LINE1); |
| 1391 available_field_types.insert(ADDRESS_HOME_LINE2); |
| 1392 available_field_types.insert(ADDRESS_HOME_COUNTRY); |
| 1393 available_field_types.insert(ADDRESS_BILLING_LINE1); |
| 1394 available_field_types.insert(ADDRESS_BILLING_LINE2); |
| 1395 available_field_types.insert(EMAIL_ADDRESS); |
| 1396 available_field_types.insert(PHONE_HOME_WHOLE_NUMBER); |
| 1397 available_field_types.insert(PHONE_FAX_WHOLE_NUMBER); |
| 1398 |
| 1387 std::string encoded_xml; | 1399 std::string encoded_xml; |
| 1388 EXPECT_TRUE(form_structure->EncodeUploadRequest(false, &encoded_xml)); | 1400 EXPECT_TRUE(form_structure->EncodeUploadRequest(available_field_types, false, |
| 1401 &encoded_xml)); |
| 1389 EXPECT_EQ("<\?xml version=\"1.0\" encoding=\"UTF-8\"\?>" | 1402 EXPECT_EQ("<\?xml version=\"1.0\" encoding=\"UTF-8\"\?>" |
| 1390 "<autofillupload clientversion=\"6.1.1715.1442/en (GGLL)\" " | 1403 "<autofillupload clientversion=\"6.1.1715.1442/en (GGLL)\" " |
| 1391 "formsignature=\"7641728017676399335\" autofillused=\"false\" " | 1404 "formsignature=\"7641728017676399335\" autofillused=\"false\" " |
| 1392 "datapresent=\"1442008008\">" | 1405 "datapresent=\"144200830e\">" |
| 1393 "<field signature=\"3763331450\" autofilltype=\"3\"/>" | 1406 "<field signature=\"3763331450\" autofilltype=\"3\"/>" |
| 1394 "<field signature=\"3494530716\" autofilltype=\"5\"/>" | 1407 "<field signature=\"3494530716\" autofilltype=\"5\"/>" |
| 1395 "<field signature=\"1029417091\" autofilltype=\"9\"/>" | 1408 "<field signature=\"1029417091\" autofilltype=\"9\"/>" |
| 1396 "<field signature=\"466116101\" autofilltype=\"14\"/>" | 1409 "<field signature=\"466116101\" autofilltype=\"14\"/>" |
| 1397 "<field signature=\"2799270304\" autofilltype=\"36\"/>" | 1410 "<field signature=\"2799270304\" autofilltype=\"36\"/>" |
| 1398 "<field signature=\"1876771436\" autofilltype=\"24\"/>" | 1411 "<field signature=\"1876771436\" autofilltype=\"24\"/>" |
| 1399 "</autofillupload>", | 1412 "</autofillupload>", |
| 1400 encoded_xml); | 1413 encoded_xml); |
| 1401 EXPECT_TRUE(form_structure->EncodeUploadRequest(true, &encoded_xml)); | 1414 EXPECT_TRUE(form_structure->EncodeUploadRequest(available_field_types, true, |
| 1415 &encoded_xml)); |
| 1402 EXPECT_EQ("<\?xml version=\"1.0\" encoding=\"UTF-8\"\?>" | 1416 EXPECT_EQ("<\?xml version=\"1.0\" encoding=\"UTF-8\"\?>" |
| 1403 "<autofillupload clientversion=\"6.1.1715.1442/en (GGLL)\" " | 1417 "<autofillupload clientversion=\"6.1.1715.1442/en (GGLL)\" " |
| 1404 "formsignature=\"7641728017676399335\" autofillused=\"true\" " | 1418 "formsignature=\"7641728017676399335\" autofillused=\"true\" " |
| 1405 "datapresent=\"1442008008\">" | 1419 "datapresent=\"144200830e\">" |
| 1406 "<field signature=\"3763331450\" autofilltype=\"3\"/>" | 1420 "<field signature=\"3763331450\" autofilltype=\"3\"/>" |
| 1407 "<field signature=\"3494530716\" autofilltype=\"5\"/>" | 1421 "<field signature=\"3494530716\" autofilltype=\"5\"/>" |
| 1408 "<field signature=\"1029417091\" autofilltype=\"9\"/>" | 1422 "<field signature=\"1029417091\" autofilltype=\"9\"/>" |
| 1409 "<field signature=\"466116101\" autofilltype=\"14\"/>" | 1423 "<field signature=\"466116101\" autofilltype=\"14\"/>" |
| 1410 "<field signature=\"2799270304\" autofilltype=\"36\"/>" | 1424 "<field signature=\"2799270304\" autofilltype=\"36\"/>" |
| 1411 "<field signature=\"1876771436\" autofilltype=\"24\"/>" | 1425 "<field signature=\"1876771436\" autofilltype=\"24\"/>" |
| 1412 "</autofillupload>", | 1426 "</autofillupload>", |
| 1413 encoded_xml); | 1427 encoded_xml); |
| 1414 | 1428 |
| 1415 // Add 2 address fields - this should be still a valid form. | 1429 // Add 2 address fields - this should be still a valid form. |
| 1416 for (size_t i = 0; i < 2; ++i) { | 1430 for (size_t i = 0; i < 2; ++i) { |
| 1417 form.fields.push_back(webkit_glue::FormField(ASCIIToUTF16("Address"), | 1431 form.fields.push_back(webkit_glue::FormField(ASCIIToUTF16("Address"), |
| 1418 ASCIIToUTF16("address"), | 1432 ASCIIToUTF16("address"), |
| 1419 string16(), | 1433 string16(), |
| 1420 ASCIIToUTF16("text"), | 1434 ASCIIToUTF16("text"), |
| 1421 0, | 1435 0, |
| 1422 false)); | 1436 false)); |
| 1423 possible_field_types.push_back(FieldTypeSet()); | 1437 possible_field_types.push_back(FieldTypeSet()); |
| 1424 possible_field_types.back().insert(ADDRESS_HOME_LINE1); | 1438 possible_field_types.back().insert(ADDRESS_HOME_LINE1); |
| 1425 possible_field_types.back().insert(ADDRESS_HOME_LINE2); | 1439 possible_field_types.back().insert(ADDRESS_HOME_LINE2); |
| 1426 possible_field_types.back().insert(ADDRESS_BILLING_LINE1); | 1440 possible_field_types.back().insert(ADDRESS_BILLING_LINE1); |
| 1427 possible_field_types.back().insert(ADDRESS_BILLING_LINE2); | 1441 possible_field_types.back().insert(ADDRESS_BILLING_LINE2); |
| 1428 } | 1442 } |
| 1443 |
| 1429 form_structure.reset(new FormStructure(form)); | 1444 form_structure.reset(new FormStructure(form)); |
| 1430 ASSERT_EQ(form_structure->field_count(), possible_field_types.size()); | 1445 ASSERT_EQ(form_structure->field_count(), possible_field_types.size()); |
| 1431 for (size_t i = 0; i < form_structure->field_count(); ++i) | 1446 for (size_t i = 0; i < form_structure->field_count(); ++i) |
| 1432 form_structure->set_possible_types(i, possible_field_types[i]); | 1447 form_structure->set_possible_types(i, possible_field_types[i]); |
| 1433 EXPECT_TRUE(form_structure->EncodeUploadRequest(false, &encoded_xml)); | 1448 |
| 1449 EXPECT_TRUE(form_structure->EncodeUploadRequest(available_field_types, false, |
| 1450 &encoded_xml)); |
| 1434 EXPECT_EQ("<\?xml version=\"1.0\" encoding=\"UTF-8\"\?>" | 1451 EXPECT_EQ("<\?xml version=\"1.0\" encoding=\"UTF-8\"\?>" |
| 1435 "<autofillupload clientversion=\"6.1.1715.1442/en (GGLL)\" " | 1452 "<autofillupload clientversion=\"6.1.1715.1442/en (GGLL)\" " |
| 1436 "formsignature=\"12226592129574322128\" autofillused=\"false\" " | 1453 "formsignature=\"12226592129574322128\" autofillused=\"false\" " |
| 1437 "datapresent=\"144200830e\">" | 1454 "datapresent=\"144200830e\">" |
| 1438 "<field signature=\"3763331450\" autofilltype=\"3\"/>" | 1455 "<field signature=\"3763331450\" autofilltype=\"3\"/>" |
| 1439 "<field signature=\"3494530716\" autofilltype=\"5\"/>" | 1456 "<field signature=\"3494530716\" autofilltype=\"5\"/>" |
| 1440 "<field signature=\"1029417091\" autofilltype=\"9\"/>" | 1457 "<field signature=\"1029417091\" autofilltype=\"9\"/>" |
| 1441 "<field signature=\"466116101\" autofilltype=\"14\"/>" | 1458 "<field signature=\"466116101\" autofilltype=\"14\"/>" |
| 1442 "<field signature=\"2799270304\" autofilltype=\"36\"/>" | 1459 "<field signature=\"2799270304\" autofilltype=\"36\"/>" |
| 1443 "<field signature=\"1876771436\" autofilltype=\"24\"/>" | 1460 "<field signature=\"1876771436\" autofilltype=\"24\"/>" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1463 possible_field_types.push_back(FieldTypeSet()); | 1480 possible_field_types.push_back(FieldTypeSet()); |
| 1464 possible_field_types.back().insert(ADDRESS_HOME_LINE1); | 1481 possible_field_types.back().insert(ADDRESS_HOME_LINE1); |
| 1465 possible_field_types.back().insert(ADDRESS_HOME_LINE2); | 1482 possible_field_types.back().insert(ADDRESS_HOME_LINE2); |
| 1466 possible_field_types.back().insert(ADDRESS_BILLING_LINE1); | 1483 possible_field_types.back().insert(ADDRESS_BILLING_LINE1); |
| 1467 possible_field_types.back().insert(ADDRESS_BILLING_LINE2); | 1484 possible_field_types.back().insert(ADDRESS_BILLING_LINE2); |
| 1468 } | 1485 } |
| 1469 form_structure.reset(new FormStructure(form)); | 1486 form_structure.reset(new FormStructure(form)); |
| 1470 ASSERT_EQ(form_structure->field_count(), possible_field_types.size()); | 1487 ASSERT_EQ(form_structure->field_count(), possible_field_types.size()); |
| 1471 for (size_t i = 0; i < form_structure->field_count(); ++i) | 1488 for (size_t i = 0; i < form_structure->field_count(); ++i) |
| 1472 form_structure->set_possible_types(i, possible_field_types[i]); | 1489 form_structure->set_possible_types(i, possible_field_types[i]); |
| 1473 EXPECT_FALSE(form_structure->EncodeUploadRequest(false, &encoded_xml)); | 1490 EXPECT_FALSE(form_structure->EncodeUploadRequest(available_field_types, false, |
| 1474 EXPECT_EQ("", encoded_xml); | 1491 &encoded_xml)); |
| 1475 } | 1492 } |
| 1476 | 1493 |
| 1494 // Check that we compute the "datapresent" string correctly for the given |
| 1495 // |available_types|. |
| 1477 TEST(FormStructureTest, CheckDataPresence) { | 1496 TEST(FormStructureTest, CheckDataPresence) { |
| 1478 // Checks bits set in the datapresence field: for each type in the form | |
| 1479 // relevant bit in datapresence has to be set. | |
| 1480 scoped_ptr<FormStructure> form_structure; | |
| 1481 std::vector<FieldTypeSet> possible_field_types; | |
| 1482 FormData form; | 1497 FormData form; |
| 1483 form.method = ASCIIToUTF16("post"); | 1498 form.method = ASCIIToUTF16("post"); |
| 1484 form.fields.push_back(webkit_glue::FormField(ASCIIToUTF16("First Name"), | 1499 form.fields.push_back(webkit_glue::FormField(ASCIIToUTF16("First Name"), |
| 1485 ASCIIToUTF16("first"), | 1500 ASCIIToUTF16("first"), |
| 1486 string16(), | 1501 string16(), |
| 1487 ASCIIToUTF16("text"), | 1502 ASCIIToUTF16("text"), |
| 1488 0, | 1503 0, |
| 1489 false)); | 1504 false)); |
| 1490 possible_field_types.push_back(FieldTypeSet()); | |
| 1491 possible_field_types.back().insert(NAME_FIRST); | |
| 1492 form.fields.push_back(webkit_glue::FormField(ASCIIToUTF16("Last Name"), | 1505 form.fields.push_back(webkit_glue::FormField(ASCIIToUTF16("Last Name"), |
| 1493 ASCIIToUTF16("last"), | 1506 ASCIIToUTF16("last"), |
| 1494 string16(), | 1507 string16(), |
| 1495 ASCIIToUTF16("text"), | 1508 ASCIIToUTF16("text"), |
| 1496 0, | 1509 0, |
| 1497 false)); | 1510 false)); |
| 1498 possible_field_types.push_back(FieldTypeSet()); | |
| 1499 possible_field_types.back().insert(NAME_LAST); | |
| 1500 form.fields.push_back(webkit_glue::FormField(ASCIIToUTF16("email"), | 1511 form.fields.push_back(webkit_glue::FormField(ASCIIToUTF16("email"), |
| 1501 ASCIIToUTF16("email"), | 1512 ASCIIToUTF16("email"), |
| 1502 string16(), | 1513 string16(), |
| 1503 ASCIIToUTF16("text"), | 1514 ASCIIToUTF16("text"), |
| 1504 0, | 1515 0, |
| 1505 false)); | 1516 false)); |
| 1506 possible_field_types.push_back(FieldTypeSet()); | 1517 |
| 1507 possible_field_types.back().insert(EMAIL_ADDRESS); | 1518 FormStructure form_structure(form); |
| 1508 form_structure.reset(new FormStructure(form)); | 1519 |
| 1509 for (size_t i = 0; i < form_structure->field_count(); ++i) | 1520 FieldTypeSet unknown_type; |
| 1510 form_structure->set_possible_types(i, possible_field_types[i]); | 1521 unknown_type.insert(UNKNOWN_TYPE); |
| 1522 for (size_t i = 0; i < form_structure.field_count(); ++i) |
| 1523 form_structure.set_possible_types(i, unknown_type); |
| 1524 |
| 1525 // No available types. |
| 1526 // datapresent should be "" == trimmmed(0x0000000000000000) == |
| 1527 // 0b0000000000000000000000000000000000000000000000000000000000000000 |
| 1528 FieldTypeSet available_field_types; |
| 1529 |
| 1511 std::string encoded_xml; | 1530 std::string encoded_xml; |
| 1512 EXPECT_TRUE(form_structure->EncodeUploadRequest(false, &encoded_xml)); | 1531 EXPECT_TRUE(form_structure.EncodeUploadRequest(available_field_types, false, |
| 1513 EXPECT_EQ("<\?xml version=\"1.0\" encoding=\"UTF-8\"\?><autofillupload " | 1532 &encoded_xml)); |
| 1514 "clientversion=\"6.1.1715.1442/en (GGLL)\" formsignature=\"" | 1533 EXPECT_EQ("<\?xml version=\"1.0\" encoding=\"UTF-8\"\?>" |
| 1515 "6402244543831589061\" autofillused=\"false\" " | 1534 "<autofillupload clientversion=\"6.1.1715.1442/en (GGLL)\"" |
| 1516 "datapresent=\"1440\"><field signature=\"1089846351\" ", | 1535 " formsignature=\"6402244543831589061\" autofillused=\"false\"" |
| 1517 encoded_xml.substr(0, 200)); | 1536 " datapresent=\"\">" |
| 1518 | 1537 "<field signature=\"1089846351\" autofilltype=\"1\"/>" |
| 1519 form.fields.push_back(webkit_glue::FormField(ASCIIToUTF16("Address"), | 1538 "<field signature=\"2404144663\" autofilltype=\"1\"/>" |
| 1520 ASCIIToUTF16("address"), | 1539 "<field signature=\"420638584\" autofilltype=\"1\"/>" |
| 1521 string16(), | 1540 "</autofillupload>", |
| 1522 ASCIIToUTF16("text"), | 1541 encoded_xml); |
| 1523 0, | 1542 |
| 1524 false)); | 1543 // Only a few types available. |
| 1525 possible_field_types.push_back(FieldTypeSet()); | 1544 // datapresent should be "1540000240" == trimmmed(0x1540000240000000) == |
| 1526 possible_field_types.back().insert(ADDRESS_HOME_LINE1); | 1545 // 0b0001010101000000000000000000001001000000000000000000000000000000 |
| 1527 form_structure.reset(new FormStructure(form)); | 1546 // The set bits are: |
| 1528 for (size_t i = 0; i < form_structure->field_count(); ++i) | 1547 // 3 == NAME_FIRST |
| 1529 form_structure->set_possible_types(i, possible_field_types[i]); | 1548 // 5 == NAME_LAST |
| 1530 EXPECT_TRUE(form_structure->EncodeUploadRequest(false, &encoded_xml)); | 1549 // 7 == NAME_FULL |
| 1531 EXPECT_EQ("<\?xml version=\"1.0\" encoding=\"UTF-8\"\?><autofillupload " | 1550 // 9 == EMAIL_ADDRESS |
| 1532 "clientversion=\"6.1.1715.1442/en (GGLL)\" formsignature=\"" | 1551 // 30 == ADDRESS_HOME_LINE1 |
| 1533 "11817937699000629499\" autofillused=\"false\" " | 1552 // 33 == ADDRESS_HOME_CITY |
| 1534 "datapresent=\"14400002\"><field signature=\"1089846", | 1553 available_field_types.clear(); |
| 1535 encoded_xml.substr(0, 200)); | 1554 available_field_types.insert(NAME_FIRST); |
| 1536 | 1555 available_field_types.insert(NAME_LAST); |
| 1537 form.fields.push_back(webkit_glue::FormField(ASCIIToUTF16("F4"), | 1556 available_field_types.insert(NAME_FULL); |
| 1538 ASCIIToUTF16("f4"), | 1557 available_field_types.insert(EMAIL_ADDRESS); |
| 1539 string16(), | 1558 available_field_types.insert(ADDRESS_HOME_LINE1); |
| 1540 ASCIIToUTF16("text"), | 1559 available_field_types.insert(ADDRESS_HOME_CITY); |
| 1541 0, | 1560 |
| 1542 false)); | 1561 EXPECT_TRUE(form_structure.EncodeUploadRequest(available_field_types, false, |
| 1543 possible_field_types.push_back(FieldTypeSet()); | 1562 &encoded_xml)); |
| 1544 possible_field_types.back().insert(CREDIT_CARD_TYPE); | 1563 EXPECT_EQ("<\?xml version=\"1.0\" encoding=\"UTF-8\"\?>" |
| 1545 form_structure.reset(new FormStructure(form)); | 1564 "<autofillupload clientversion=\"6.1.1715.1442/en (GGLL)\"" |
| 1546 for (size_t i = 0; i < form_structure->field_count(); ++i) | 1565 " formsignature=\"6402244543831589061\" autofillused=\"false\"" |
| 1547 form_structure->set_possible_types(i, possible_field_types[i]); | 1566 " datapresent=\"1540000240\">" |
| 1548 EXPECT_TRUE(form_structure->EncodeUploadRequest(false, &encoded_xml)); | 1567 "<field signature=\"1089846351\" autofilltype=\"1\"/>" |
| 1549 EXPECT_EQ("<\?xml version=\"1.0\" encoding=\"UTF-8\"\?><autofillupload " | 1568 "<field signature=\"2404144663\" autofilltype=\"1\"/>" |
| 1550 "clientversion=\"6.1.1715.1442/en (GGLL)\" formsignature=\"" | 1569 "<field signature=\"420638584\" autofilltype=\"1\"/>" |
| 1551 "15126663683491865216\" autofillused=\"false\" " | 1570 "</autofillupload>", |
| 1552 "datapresent=\"1440000200000020\"><field signature=", | 1571 encoded_xml); |
| 1553 encoded_xml.substr(0, 200)); | 1572 |
| 1573 // All supported non-credit card types available. |
| 1574 // datapresent should be "1f7e0f8378000008" == trimmmed(0x1f7e0f8378000008) == |
| 1575 // 0b0001111101111110000011111000001101111000000000000000000000001000 |
| 1576 // The set bits are: |
| 1577 // 3 == NAME_FIRST |
| 1578 // 4 == NAME_MIDDLE |
| 1579 // 5 == NAME_LAST |
| 1580 // 6 == NAME_MIDDLE_INITIAL |
| 1581 // 7 == NAME_FULL |
| 1582 // 9 == EMAIL_ADDRESS |
| 1583 // 10 == PHONE_HOME_NUMBER, |
| 1584 // 11 == PHONE_HOME_CITY_CODE, |
| 1585 // 12 == PHONE_HOME_COUNTRY_CODE, |
| 1586 // 13 == PHONE_HOME_CITY_AND_NUMBER, |
| 1587 // 14 == PHONE_HOME_WHOLE_NUMBER, |
| 1588 // 20 == PHONE_FAX_NUMBER, |
| 1589 // 21 == PHONE_FAX_CITY_CODE, |
| 1590 // 22 == PHONE_FAX_COUNTRY_CODE, |
| 1591 // 23 == PHONE_FAX_CITY_AND_NUMBER, |
| 1592 // 24 == PHONE_FAX_WHOLE_NUMBER, |
| 1593 // 30 == ADDRESS_HOME_LINE1 |
| 1594 // 31 == ADDRESS_HOME_LINE2 |
| 1595 // 33 == ADDRESS_HOME_CITY |
| 1596 // 34 == ADDRESS_HOME_STATE |
| 1597 // 35 == ADDRESS_HOME_ZIP |
| 1598 // 36 == ADDRESS_HOME_COUNTRY |
| 1599 // 60 == COMPANY_NAME |
| 1600 available_field_types.clear(); |
| 1601 available_field_types.insert(NAME_FIRST); |
| 1602 available_field_types.insert(NAME_MIDDLE); |
| 1603 available_field_types.insert(NAME_LAST); |
| 1604 available_field_types.insert(NAME_MIDDLE_INITIAL); |
| 1605 available_field_types.insert(NAME_FULL); |
| 1606 available_field_types.insert(EMAIL_ADDRESS); |
| 1607 available_field_types.insert(PHONE_HOME_NUMBER); |
| 1608 available_field_types.insert(PHONE_HOME_CITY_CODE); |
| 1609 available_field_types.insert(PHONE_HOME_COUNTRY_CODE); |
| 1610 available_field_types.insert(PHONE_HOME_CITY_AND_NUMBER); |
| 1611 available_field_types.insert(PHONE_HOME_WHOLE_NUMBER); |
| 1612 available_field_types.insert(PHONE_FAX_NUMBER); |
| 1613 available_field_types.insert(PHONE_FAX_CITY_CODE); |
| 1614 available_field_types.insert(PHONE_FAX_COUNTRY_CODE); |
| 1615 available_field_types.insert(PHONE_FAX_CITY_AND_NUMBER); |
| 1616 available_field_types.insert(PHONE_FAX_WHOLE_NUMBER); |
| 1617 available_field_types.insert(ADDRESS_HOME_LINE1); |
| 1618 available_field_types.insert(ADDRESS_HOME_LINE2); |
| 1619 available_field_types.insert(ADDRESS_HOME_CITY); |
| 1620 available_field_types.insert(ADDRESS_HOME_STATE); |
| 1621 available_field_types.insert(ADDRESS_HOME_ZIP); |
| 1622 available_field_types.insert(ADDRESS_HOME_COUNTRY); |
| 1623 available_field_types.insert(COMPANY_NAME); |
| 1624 |
| 1625 EXPECT_TRUE(form_structure.EncodeUploadRequest(available_field_types, false, |
| 1626 &encoded_xml)); |
| 1627 EXPECT_EQ("<\?xml version=\"1.0\" encoding=\"UTF-8\"\?>" |
| 1628 "<autofillupload clientversion=\"6.1.1715.1442/en (GGLL)\"" |
| 1629 " formsignature=\"6402244543831589061\" autofillused=\"false\"" |
| 1630 " datapresent=\"1f7e0f8378000008\">" |
| 1631 "<field signature=\"1089846351\" autofilltype=\"1\"/>" |
| 1632 "<field signature=\"2404144663\" autofilltype=\"1\"/>" |
| 1633 "<field signature=\"420638584\" autofilltype=\"1\"/>" |
| 1634 "</autofillupload>", |
| 1635 encoded_xml); |
| 1636 |
| 1637 // All supported credit card types available. |
| 1638 // datapresent should be "0000000000001fc0" == trimmmed(0x0000000000001fc0) == |
| 1639 // 0b0000000000000000000000000000000000000000000000000001111111000000 |
| 1640 // The set bits are: |
| 1641 // 51 == CREDIT_CARD_NAME |
| 1642 // 52 == CREDIT_CARD_NUMBER |
| 1643 // 53 == CREDIT_CARD_EXP_MONTH |
| 1644 // 54 == CREDIT_CARD_EXP_2_DIGIT_YEAR |
| 1645 // 55 == CREDIT_CARD_EXP_4_DIGIT_YEAR |
| 1646 // 56 == CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR |
| 1647 // 57 == CREDIT_CARD_EXP_DATE_4_DIGIT_YEAR |
| 1648 available_field_types.clear(); |
| 1649 available_field_types.insert(CREDIT_CARD_NAME); |
| 1650 available_field_types.insert(CREDIT_CARD_NUMBER); |
| 1651 available_field_types.insert(CREDIT_CARD_EXP_MONTH); |
| 1652 available_field_types.insert(CREDIT_CARD_EXP_2_DIGIT_YEAR); |
| 1653 available_field_types.insert(CREDIT_CARD_EXP_4_DIGIT_YEAR); |
| 1654 available_field_types.insert(CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR); |
| 1655 available_field_types.insert(CREDIT_CARD_EXP_DATE_4_DIGIT_YEAR); |
| 1656 |
| 1657 EXPECT_TRUE(form_structure.EncodeUploadRequest(available_field_types, false, |
| 1658 &encoded_xml)); |
| 1659 EXPECT_EQ("<\?xml version=\"1.0\" encoding=\"UTF-8\"\?>" |
| 1660 "<autofillupload clientversion=\"6.1.1715.1442/en (GGLL)\"" |
| 1661 " formsignature=\"6402244543831589061\" autofillused=\"false\"" |
| 1662 " datapresent=\"0000000000001fc0\">" |
| 1663 "<field signature=\"1089846351\" autofilltype=\"1\"/>" |
| 1664 "<field signature=\"2404144663\" autofilltype=\"1\"/>" |
| 1665 "<field signature=\"420638584\" autofilltype=\"1\"/>" |
| 1666 "</autofillupload>", |
| 1667 encoded_xml); |
| 1668 |
| 1669 // All supported types available. |
| 1670 // datapresent should be "1f7e0f8378001fc8" == trimmmed(0x1f7e0f8378001fc8) == |
| 1671 // 0b0001111101111110000011111000001101111000000000000001111111001000 |
| 1672 // The set bits are: |
| 1673 // 3 == NAME_FIRST |
| 1674 // 4 == NAME_MIDDLE |
| 1675 // 5 == NAME_LAST |
| 1676 // 6 == NAME_MIDDLE_INITIAL |
| 1677 // 7 == NAME_FULL |
| 1678 // 9 == EMAIL_ADDRESS |
| 1679 // 10 == PHONE_HOME_NUMBER, |
| 1680 // 11 == PHONE_HOME_CITY_CODE, |
| 1681 // 12 == PHONE_HOME_COUNTRY_CODE, |
| 1682 // 13 == PHONE_HOME_CITY_AND_NUMBER, |
| 1683 // 14 == PHONE_HOME_WHOLE_NUMBER, |
| 1684 // 20 == PHONE_FAX_NUMBER, |
| 1685 // 21 == PHONE_FAX_CITY_CODE, |
| 1686 // 22 == PHONE_FAX_COUNTRY_CODE, |
| 1687 // 23 == PHONE_FAX_CITY_AND_NUMBER, |
| 1688 // 24 == PHONE_FAX_WHOLE_NUMBER, |
| 1689 // 30 == ADDRESS_HOME_LINE1 |
| 1690 // 31 == ADDRESS_HOME_LINE2 |
| 1691 // 33 == ADDRESS_HOME_CITY |
| 1692 // 34 == ADDRESS_HOME_STATE |
| 1693 // 35 == ADDRESS_HOME_ZIP |
| 1694 // 36 == ADDRESS_HOME_COUNTRY |
| 1695 // 51 == CREDIT_CARD_NAME |
| 1696 // 52 == CREDIT_CARD_NUMBER |
| 1697 // 53 == CREDIT_CARD_EXP_MONTH |
| 1698 // 54 == CREDIT_CARD_EXP_2_DIGIT_YEAR |
| 1699 // 55 == CREDIT_CARD_EXP_4_DIGIT_YEAR |
| 1700 // 56 == CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR |
| 1701 // 57 == CREDIT_CARD_EXP_DATE_4_DIGIT_YEAR |
| 1702 // 60 == COMPANY_NAME |
| 1703 available_field_types.clear(); |
| 1704 available_field_types.insert(NAME_FIRST); |
| 1705 available_field_types.insert(NAME_MIDDLE); |
| 1706 available_field_types.insert(NAME_LAST); |
| 1707 available_field_types.insert(NAME_MIDDLE_INITIAL); |
| 1708 available_field_types.insert(NAME_FULL); |
| 1709 available_field_types.insert(EMAIL_ADDRESS); |
| 1710 available_field_types.insert(PHONE_HOME_NUMBER); |
| 1711 available_field_types.insert(PHONE_HOME_CITY_CODE); |
| 1712 available_field_types.insert(PHONE_HOME_COUNTRY_CODE); |
| 1713 available_field_types.insert(PHONE_HOME_CITY_AND_NUMBER); |
| 1714 available_field_types.insert(PHONE_HOME_WHOLE_NUMBER); |
| 1715 available_field_types.insert(PHONE_FAX_NUMBER); |
| 1716 available_field_types.insert(PHONE_FAX_CITY_CODE); |
| 1717 available_field_types.insert(PHONE_FAX_COUNTRY_CODE); |
| 1718 available_field_types.insert(PHONE_FAX_CITY_AND_NUMBER); |
| 1719 available_field_types.insert(PHONE_FAX_WHOLE_NUMBER); |
| 1720 available_field_types.insert(ADDRESS_HOME_LINE1); |
| 1721 available_field_types.insert(ADDRESS_HOME_LINE2); |
| 1722 available_field_types.insert(ADDRESS_HOME_CITY); |
| 1723 available_field_types.insert(ADDRESS_HOME_STATE); |
| 1724 available_field_types.insert(ADDRESS_HOME_ZIP); |
| 1725 available_field_types.insert(ADDRESS_HOME_COUNTRY); |
| 1726 available_field_types.insert(CREDIT_CARD_NAME); |
| 1727 available_field_types.insert(CREDIT_CARD_NUMBER); |
| 1728 available_field_types.insert(CREDIT_CARD_EXP_MONTH); |
| 1729 available_field_types.insert(CREDIT_CARD_EXP_2_DIGIT_YEAR); |
| 1730 available_field_types.insert(CREDIT_CARD_EXP_4_DIGIT_YEAR); |
| 1731 available_field_types.insert(CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR); |
| 1732 available_field_types.insert(CREDIT_CARD_EXP_DATE_4_DIGIT_YEAR); |
| 1733 available_field_types.insert(COMPANY_NAME); |
| 1734 |
| 1735 EXPECT_TRUE(form_structure.EncodeUploadRequest(available_field_types, false, |
| 1736 &encoded_xml)); |
| 1737 EXPECT_EQ("<\?xml version=\"1.0\" encoding=\"UTF-8\"\?>" |
| 1738 "<autofillupload clientversion=\"6.1.1715.1442/en (GGLL)\"" |
| 1739 " formsignature=\"6402244543831589061\" autofillused=\"false\"" |
| 1740 " datapresent=\"1f7e0f8378001fc8\">" |
| 1741 "<field signature=\"1089846351\" autofilltype=\"1\"/>" |
| 1742 "<field signature=\"2404144663\" autofilltype=\"1\"/>" |
| 1743 "<field signature=\"420638584\" autofilltype=\"1\"/>" |
| 1744 "</autofillupload>", |
| 1745 encoded_xml); |
| 1554 } | 1746 } |
| 1555 | 1747 |
| 1556 TEST(FormStructureTest, CheckMultipleTypes) { | 1748 TEST(FormStructureTest, CheckMultipleTypes) { |
| 1557 // Check that multiple types for the field are processed correctly, both in | 1749 // Throughout this test, datapresent should be |
| 1558 // datapresence and in actual field data. | 1750 // 0x1440000360000008 == |
| 1751 // 0b0001010001000000000000000000001101100000000000000000000000001000 |
| 1752 // The set bits are: |
| 1753 // 3 == NAME_FIRST |
| 1754 // 5 == NAME_LAST |
| 1755 // 9 == EMAIL_ADDRESS |
| 1756 // 30 == ADDRESS_HOME_LINE1 |
| 1757 // 31 == ADDRESS_HOME_LINE2 |
| 1758 // 33 == ADDRESS_HOME_CITY |
| 1759 // 34 == ADDRESS_HOME_STATE |
| 1760 // 60 == COMPANY_NAME |
| 1761 FieldTypeSet available_field_types; |
| 1762 available_field_types.insert(NAME_FIRST); |
| 1763 available_field_types.insert(NAME_LAST); |
| 1764 available_field_types.insert(EMAIL_ADDRESS); |
| 1765 available_field_types.insert(ADDRESS_HOME_LINE1); |
| 1766 available_field_types.insert(ADDRESS_HOME_LINE2); |
| 1767 available_field_types.insert(ADDRESS_HOME_CITY); |
| 1768 available_field_types.insert(ADDRESS_HOME_STATE); |
| 1769 available_field_types.insert(COMPANY_NAME); |
| 1770 |
| 1771 // Check that multiple types for the field are processed correctly. |
| 1559 scoped_ptr<FormStructure> form_structure; | 1772 scoped_ptr<FormStructure> form_structure; |
| 1560 std::vector<FieldTypeSet> possible_field_types; | 1773 std::vector<FieldTypeSet> possible_field_types; |
| 1561 FormData form; | 1774 FormData form; |
| 1562 form.method = ASCIIToUTF16("post"); | 1775 form.method = ASCIIToUTF16("post"); |
| 1563 form.fields.push_back(webkit_glue::FormField(ASCIIToUTF16("email"), | 1776 form.fields.push_back(webkit_glue::FormField(ASCIIToUTF16("email"), |
| 1564 ASCIIToUTF16("email"), | 1777 ASCIIToUTF16("email"), |
| 1565 string16(), | 1778 string16(), |
| 1566 ASCIIToUTF16("text"), | 1779 ASCIIToUTF16("text"), |
| 1567 0, | 1780 0, |
| 1568 false)); | 1781 false)); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 1586 possible_field_types.back().insert(NAME_LAST); | 1799 possible_field_types.back().insert(NAME_LAST); |
| 1587 form.fields.push_back(webkit_glue::FormField(ASCIIToUTF16("Address"), | 1800 form.fields.push_back(webkit_glue::FormField(ASCIIToUTF16("Address"), |
| 1588 ASCIIToUTF16("address"), | 1801 ASCIIToUTF16("address"), |
| 1589 string16(), | 1802 string16(), |
| 1590 ASCIIToUTF16("text"), | 1803 ASCIIToUTF16("text"), |
| 1591 0, | 1804 0, |
| 1592 false)); | 1805 false)); |
| 1593 possible_field_types.push_back(FieldTypeSet()); | 1806 possible_field_types.push_back(FieldTypeSet()); |
| 1594 possible_field_types.back().insert(ADDRESS_HOME_LINE1); | 1807 possible_field_types.back().insert(ADDRESS_HOME_LINE1); |
| 1595 form_structure.reset(new FormStructure(form)); | 1808 form_structure.reset(new FormStructure(form)); |
| 1809 |
| 1596 for (size_t i = 0; i < form_structure->field_count(); ++i) | 1810 for (size_t i = 0; i < form_structure->field_count(); ++i) |
| 1597 form_structure->set_possible_types(i, possible_field_types[i]); | 1811 form_structure->set_possible_types(i, possible_field_types[i]); |
| 1598 std::string encoded_xml; | 1812 std::string encoded_xml; |
| 1813 |
| 1599 // Now we matched both fields singularly. | 1814 // Now we matched both fields singularly. |
| 1600 EXPECT_TRUE(form_structure->EncodeUploadRequest(false, &encoded_xml)); | 1815 EXPECT_TRUE(form_structure->EncodeUploadRequest(available_field_types, false, |
| 1601 // datapresent==14400002==00010100010000000000000000000010b set bits are: | 1816 &encoded_xml)); |
| 1602 // #3 == NAME_FIRST | 1817 EXPECT_EQ("<\?xml version=\"1.0\" encoding=\"UTF-8\"\?>" |
| 1603 // #5 == NAME_LAST | 1818 "<autofillupload clientversion=\"6.1.1715.1442/en (GGLL)\"" |
| 1604 // #9 == EMAIL_ADDRESS | 1819 " formsignature=\"18062476096658145866\" autofillused=\"false\"" |
| 1605 // #30 == ADDRESS_HOME_LINE1 | 1820 " datapresent=\"1440000360000008\">" |
| 1606 EXPECT_EQ("<\?xml version=\"1.0\" encoding=\"UTF-8\"\?><autofillupload " | 1821 "<field signature=\"420638584\" autofilltype=\"9\"/>" |
| 1607 "clientversion=\"6.1.1715.1442/en (GGLL)\" formsignature=\"" | 1822 "<field signature=\"1089846351\" autofilltype=\"3\"/>" |
| 1608 "18062476096658145866\" autofillused=\"false\" datapresent=" | 1823 "<field signature=\"2404144663\" autofilltype=\"5\"/>" |
| 1609 "\"14400002\"><field signature=\"420638584\" autofilltype=" | 1824 "<field signature=\"509334676\" autofilltype=\"30\"/>" |
| 1610 "\"9\"/><field signature=\"1089846351\" autofilltype=\"3\"/><field " | 1825 "</autofillupload>", |
| 1611 "signature=\"2404144663\" autofilltype=\"5\"/><field signature=" | |
| 1612 "\"509334676\" autofilltype=\"30\"/></autofillupload>", | |
| 1613 encoded_xml); | 1826 encoded_xml); |
| 1614 // Match third field as both first and last. | 1827 // Match third field as both first and last. |
| 1615 possible_field_types[2].insert(NAME_FIRST); | 1828 possible_field_types[2].insert(NAME_FIRST); |
| 1616 form_structure->set_possible_types(2, possible_field_types[2]); | 1829 form_structure->set_possible_types(2, possible_field_types[2]); |
| 1617 EXPECT_TRUE(form_structure->EncodeUploadRequest(false, &encoded_xml)); | 1830 EXPECT_TRUE(form_structure->EncodeUploadRequest(available_field_types, false, |
| 1618 // datapresent==14400002==00010100010000000000000000000010b set bits are: | 1831 &encoded_xml)); |
| 1619 // #3 == NAME_FIRST | 1832 EXPECT_EQ("<\?xml version=\"1.0\" encoding=\"UTF-8\"\?>" |
| 1620 // #5 == NAME_LAST | 1833 "<autofillupload clientversion=\"6.1.1715.1442/en (GGLL)\"" |
| 1621 // #9 == EMAIL_ADDRESS | 1834 " formsignature=\"18062476096658145866\" autofillused=\"false\"" |
| 1622 // #30 == ADDRESS_HOME_LINE1 | 1835 " datapresent=\"1440000360000008\">" |
| 1623 EXPECT_EQ("<\?xml version=\"1.0\" encoding=\"UTF-8\"\?><autofillupload " | 1836 "<field signature=\"420638584\" autofilltype=\"9\"/>" |
| 1624 "clientversion=\"6.1.1715.1442/en (GGLL)\" formsignature=\"" | 1837 "<field signature=\"1089846351\" autofilltype=\"3\"/>" |
| 1625 "18062476096658145866\" autofillused=\"false\" datapresent=" | 1838 "<field signature=\"2404144663\" autofilltype=\"3\"/>" |
| 1626 "\"14400002\"><field signature=\"420638584\" autofilltype=" | 1839 "<field signature=\"2404144663\" autofilltype=\"5\"/>" |
| 1627 "\"9\"/><field signature=\"1089846351\" autofilltype=\"3\"/><field " | 1840 "<field signature=\"509334676\" autofilltype=\"30\"/>" |
| 1628 "signature=\"2404144663\" autofilltype=\"3\"/><field " | 1841 "</autofillupload>", |
| 1629 "signature=\"2404144663\" autofilltype=\"5\"/><field signature=" | |
| 1630 "\"509334676\" autofilltype=\"30\"/></autofillupload>", | |
| 1631 encoded_xml); | 1842 encoded_xml); |
| 1632 possible_field_types[3].insert(ADDRESS_BILLING_LINE1); | 1843 possible_field_types[3].insert(ADDRESS_HOME_LINE2); |
| 1633 form_structure->set_possible_types( | 1844 form_structure->set_possible_types( |
| 1634 form_structure->field_count() - 1, | 1845 form_structure->field_count() - 1, |
| 1635 possible_field_types[form_structure->field_count() - 1]); | 1846 possible_field_types[form_structure->field_count() - 1]); |
| 1636 EXPECT_TRUE(form_structure->EncodeUploadRequest(false, &encoded_xml)); | 1847 EXPECT_TRUE(form_structure->EncodeUploadRequest(available_field_types, false, |
| 1637 // datapresent==1440000204==0001010001000000000000000000001000000100b set bits | 1848 &encoded_xml)); |
| 1638 // are: | 1849 EXPECT_EQ("<\?xml version=\"1.0\" encoding=\"UTF-8\"\?>" |
| 1639 // #3 == NAME_FIRST | 1850 "<autofillupload clientversion=\"6.1.1715.1442/en (GGLL)\"" |
| 1640 // #5 == NAME_LAST | 1851 " formsignature=\"18062476096658145866\" autofillused=\"false\"" |
| 1641 // #9 == EMAIL_ADDRESS | 1852 " datapresent=\"1440000360000008\">" |
| 1642 // #30 == ADDRESS_HOME_LINE1 | 1853 "<field signature=\"420638584\" autofilltype=\"9\"/>" |
| 1643 // #37 == ADDRESS_BILLING_LINE1 | 1854 "<field signature=\"1089846351\" autofilltype=\"3\"/>" |
| 1644 EXPECT_EQ("<\?xml version=\"1.0\" encoding=\"UTF-8\"\?><autofillupload " | 1855 "<field signature=\"2404144663\" autofilltype=\"3\"/>" |
| 1645 "clientversion=\"6.1.1715.1442/en (GGLL)\" formsignature=\"" | 1856 "<field signature=\"2404144663\" autofilltype=\"5\"/>" |
| 1646 "18062476096658145866\" autofillused=\"false\" datapresent=" | 1857 "<field signature=\"509334676\" autofilltype=\"30\"/>" |
| 1647 "\"1440000204\"><field signature=\"420638584\" autofilltype=" | 1858 "<field signature=\"509334676\" autofilltype=\"31\"/>" |
| 1648 "\"9\"/><field signature=\"1089846351\" autofilltype=\"3\"/><field " | 1859 "</autofillupload>", |
| 1649 "signature=\"2404144663\" autofilltype=\"3\"/><field " | |
| 1650 "signature=\"2404144663\" autofilltype=\"5\"/><field signature=" | |
| 1651 "\"509334676\" autofilltype=\"30\"/><field signature=\"509334676\" " | |
| 1652 "autofilltype=\"37\"/></autofillupload>", | |
| 1653 encoded_xml); | 1860 encoded_xml); |
| 1654 possible_field_types[3].clear(); | 1861 possible_field_types[3].clear(); |
| 1655 possible_field_types[3].insert(ADDRESS_HOME_LINE1); | 1862 possible_field_types[3].insert(ADDRESS_HOME_LINE1); |
| 1656 possible_field_types[3].insert(ADDRESS_BILLING_LINE2); | 1863 possible_field_types[3].insert(COMPANY_NAME); |
| 1657 form_structure->set_possible_types( | 1864 form_structure->set_possible_types( |
| 1658 form_structure->field_count() - 1, | 1865 form_structure->field_count() - 1, |
| 1659 possible_field_types[form_structure->field_count() - 1]); | 1866 possible_field_types[form_structure->field_count() - 1]); |
| 1660 EXPECT_TRUE(form_structure->EncodeUploadRequest(false, &encoded_xml)); | 1867 EXPECT_TRUE(form_structure->EncodeUploadRequest(available_field_types, false, |
| 1661 // datapresent==1440000202==0001010001000000000000000000001000000010b set bits | 1868 &encoded_xml)); |
| 1662 // are: | 1869 EXPECT_EQ("<\?xml version=\"1.0\" encoding=\"UTF-8\"\?>" |
| 1663 // #3 == NAME_FIRST | 1870 "<autofillupload clientversion=\"6.1.1715.1442/en (GGLL)\"" |
| 1664 // #5 == NAME_LAST | 1871 " formsignature=\"18062476096658145866\" autofillused=\"false\"" |
| 1665 // #9 == EMAIL_ADDRESS | 1872 " datapresent=\"1440000360000008\">" |
| 1666 // #30 == ADDRESS_HOME_LINE1 | 1873 "<field signature=\"420638584\" autofilltype=\"9\"/>" |
| 1667 // #38 == ADDRESS_BILLING_LINE2 | 1874 "<field signature=\"1089846351\" autofilltype=\"3\"/>" |
| 1668 EXPECT_EQ("<\?xml version=\"1.0\" encoding=\"UTF-8\"\?><autofillupload " | 1875 "<field signature=\"2404144663\" autofilltype=\"3\"/>" |
| 1669 "clientversion=\"6.1.1715.1442/en (GGLL)\" formsignature=\"" | 1876 "<field signature=\"2404144663\" autofilltype=\"5\"/>" |
| 1670 "18062476096658145866\" autofillused=\"false\" datapresent=" | 1877 "<field signature=\"509334676\" autofilltype=\"30\"/>" |
| 1671 "\"1440000202\"><field signature=\"420638584\" autofilltype=" | 1878 "<field signature=\"509334676\" autofilltype=\"60\"/>" |
| 1672 "\"9\"/><field signature=\"1089846351\" autofilltype=\"3\"/><field " | 1879 "</autofillupload>", |
| 1673 "signature=\"2404144663\" autofilltype=\"3\"/><field " | |
| 1674 "signature=\"2404144663\" autofilltype=\"5\"/><field signature=" | |
| 1675 "\"509334676\" autofilltype=\"30\"/><field signature=\"509334676\" " | |
| 1676 "autofilltype=\"38\"/></autofillupload>", | |
| 1677 encoded_xml); | 1880 encoded_xml); |
| 1678 } | 1881 } |
| 1679 | 1882 |
| 1680 TEST(FormStructureTest, CheckFormSignature) { | 1883 TEST(FormStructureTest, CheckFormSignature) { |
| 1681 // Check that form signature is created correctly. | 1884 // Check that form signature is created correctly. |
| 1682 scoped_ptr<FormStructure> form_structure; | 1885 scoped_ptr<FormStructure> form_structure; |
| 1683 FormData form; | 1886 FormData form; |
| 1684 form.method = ASCIIToUTF16("post"); | 1887 form.method = ASCIIToUTF16("post"); |
| 1685 form.fields.push_back(webkit_glue::FormField(ASCIIToUTF16("email"), | 1888 form.fields.push_back(webkit_glue::FormField(ASCIIToUTF16("email"), |
| 1686 ASCIIToUTF16("email"), | 1889 ASCIIToUTF16("email"), |
| (...skipping 26 matching lines...) Expand all Loading... |
| 1713 form_structure->FormSignature()); | 1916 form_structure->FormSignature()); |
| 1714 | 1917 |
| 1715 form.name = ASCIIToUTF16("login_form"); | 1918 form.name = ASCIIToUTF16("login_form"); |
| 1716 form_structure.reset(new FormStructure(form)); | 1919 form_structure.reset(new FormStructure(form)); |
| 1717 EXPECT_EQ(FormStructureTest::Hash64Bit( | 1920 EXPECT_EQ(FormStructureTest::Hash64Bit( |
| 1718 std::string("https://login.facebook.com&login_form&email&first")), | 1921 std::string("https://login.facebook.com&login_form&email&first")), |
| 1719 form_structure->FormSignature()); | 1922 form_structure->FormSignature()); |
| 1720 } | 1923 } |
| 1721 | 1924 |
| 1722 } // namespace | 1925 } // namespace |
| OLD | NEW |