OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/scoped_ptr.h" | 5 #include "base/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 1657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1668 possible_field_types.back().insert(ADDRESS_HOME_LINE1); | 1668 possible_field_types.back().insert(ADDRESS_HOME_LINE1); |
1669 form_structure.reset(new FormStructure(form)); | 1669 form_structure.reset(new FormStructure(form)); |
1670 std::string encoded_xml; | 1670 std::string encoded_xml; |
1671 ASSERT_EQ(form_structure->field_count(), possible_field_types.size()); | 1671 ASSERT_EQ(form_structure->field_count(), possible_field_types.size()); |
1672 for (size_t i = 0; i < form_structure->field_count(); ++i) | 1672 for (size_t i = 0; i < form_structure->field_count(); ++i) |
1673 form_structure->set_possible_types(i, possible_field_types[i]); | 1673 form_structure->set_possible_types(i, possible_field_types[i]); |
1674 EXPECT_TRUE(form_structure->EncodeUploadRequest(false, &encoded_xml)); | 1674 EXPECT_TRUE(form_structure->EncodeUploadRequest(false, &encoded_xml)); |
1675 EXPECT_EQ(encoded_xml, | 1675 EXPECT_EQ(encoded_xml, |
1676 "<\?xml version=\"1.0\" encoding=\"UTF-8\"\?><autofillupload " | 1676 "<\?xml version=\"1.0\" encoding=\"UTF-8\"\?><autofillupload " |
1677 "clientversion=\"6.1.1715.1442/en (GGLL)\" formsignature=\"" | 1677 "clientversion=\"6.1.1715.1442/en (GGLL)\" formsignature=\"" |
1678 "8269229441054798720\" autofillused=\"false\" datapresent=\"\"><field " | 1678 "8269229441054798720\" autofillused=\"false\" datapresent=\"1442008208\">" |
1679 "signature=\"3763331450\" autofilltype=\"3\"/><field signature=\"" | 1679 "<field signature=\"3763331450\" autofilltype=\"3\"/><field signature=\"" |
1680 "3494530716\" autofilltype=\"5\"/><field signature=\"1029417091\" " | 1680 "3494530716\" autofilltype=\"5\"/><field signature=\"1029417091\" " |
1681 "autofilltype=\"9\"/><field signature=\"466116101\" autofilltype=" | 1681 "autofilltype=\"9\"/><field signature=\"466116101\" autofilltype=" |
1682 "\"14\"/><field signature=\"2799270304\" autofilltype=\"36\"/><field " | 1682 "\"14\"/><field signature=\"2799270304\" autofilltype=\"36\"/><field " |
1683 "signature=\"1876771436\" autofilltype=\"24\"/><field signature=" | 1683 "signature=\"1876771436\" autofilltype=\"24\"/><field signature=" |
1684 "\"263446779\" autofilltype=\"30\"/></autofillupload>"); | 1684 "\"263446779\" autofilltype=\"30\"/></autofillupload>"); |
1685 EXPECT_TRUE(form_structure->EncodeUploadRequest(true, &encoded_xml)); | 1685 EXPECT_TRUE(form_structure->EncodeUploadRequest(true, &encoded_xml)); |
1686 EXPECT_EQ(encoded_xml, | 1686 EXPECT_EQ(encoded_xml, |
1687 "<\?xml version=\"1.0\" encoding=\"UTF-8\"\?><autofillupload " | 1687 "<\?xml version=\"1.0\" encoding=\"UTF-8\"\?><autofillupload " |
1688 "clientversion=\"6.1.1715.1442/en (GGLL)\" formsignature=\"" | 1688 "clientversion=\"6.1.1715.1442/en (GGLL)\" formsignature=\"" |
1689 "8269229441054798720\" autofillused=\"true\" datapresent=\"\"><field " | 1689 "8269229441054798720\" autofillused=\"true\" datapresent=\"1442008208\">" |
1690 "signature=\"3763331450\" autofilltype=\"3\"/><field signature=\"" | 1690 "<field signature=\"3763331450\" autofilltype=\"3\"/><field signature=\"" |
1691 "3494530716\" autofilltype=\"5\"/><field signature=\"1029417091\" " | 1691 "3494530716\" autofilltype=\"5\"/><field signature=\"1029417091\" " |
1692 "autofilltype=\"9\"/><field signature=\"466116101\" autofilltype=" | 1692 "autofilltype=\"9\"/><field signature=\"466116101\" autofilltype=" |
1693 "\"14\"/><field signature=\"2799270304\" autofilltype=\"36\"/><field " | 1693 "\"14\"/><field signature=\"2799270304\" autofilltype=\"36\"/><field " |
1694 "signature=\"1876771436\" autofilltype=\"24\"/><field signature=" | 1694 "signature=\"1876771436\" autofilltype=\"24\"/><field signature=" |
1695 "\"263446779\" autofilltype=\"30\"/></autofillupload>"); | 1695 "\"263446779\" autofilltype=\"30\"/></autofillupload>"); |
1696 // Add 5 address fields - this should be still a valid form. | 1696 // Add 4 address fields - this should be still a valid form. |
1697 for (size_t i = 0; i < 5; ++i) { | 1697 for (size_t i = 0; i < 2; ++i) { |
1698 form.fields.push_back(webkit_glue::FormField(ASCIIToUTF16("Address"), | 1698 form.fields.push_back(webkit_glue::FormField(ASCIIToUTF16("Address"), |
1699 ASCIIToUTF16("address"), | 1699 ASCIIToUTF16("address"), |
1700 string16(), | 1700 string16(), |
1701 ASCIIToUTF16("text"), | 1701 ASCIIToUTF16("text"), |
1702 0, | 1702 0, |
1703 false)); | 1703 false)); |
1704 possible_field_types.push_back(FieldTypeSet()); | 1704 possible_field_types.push_back(FieldTypeSet()); |
1705 possible_field_types.back().insert(ADDRESS_HOME_LINE1); | 1705 possible_field_types.back().insert(ADDRESS_HOME_LINE1); |
1706 possible_field_types.back().insert(ADDRESS_HOME_LINE2); | 1706 possible_field_types.back().insert(ADDRESS_HOME_LINE2); |
1707 possible_field_types.back().insert(ADDRESS_BILLING_LINE1); | 1707 possible_field_types.back().insert(ADDRESS_BILLING_LINE1); |
1708 possible_field_types.back().insert(ADDRESS_BILLING_LINE2); | 1708 possible_field_types.back().insert(ADDRESS_BILLING_LINE2); |
1709 } | 1709 } |
1710 form_structure.reset(new FormStructure(form)); | 1710 form_structure.reset(new FormStructure(form)); |
1711 ASSERT_EQ(form_structure->field_count(), possible_field_types.size()); | 1711 ASSERT_EQ(form_structure->field_count(), possible_field_types.size()); |
1712 for (size_t i = 0; i < form_structure->field_count(); ++i) | 1712 for (size_t i = 0; i < form_structure->field_count(); ++i) |
1713 form_structure->set_possible_types(i, possible_field_types[i]); | 1713 form_structure->set_possible_types(i, possible_field_types[i]); |
1714 EXPECT_TRUE(form_structure->EncodeUploadRequest(false, &encoded_xml)); | 1714 EXPECT_TRUE(form_structure->EncodeUploadRequest(false, &encoded_xml)); |
1715 EXPECT_EQ(encoded_xml, | 1715 EXPECT_EQ(encoded_xml, |
1716 "<\?xml version=\"1.0\" encoding=\"UTF-8\"\?><autofillupload " | 1716 "<\?xml version=\"1.0\" encoding=\"UTF-8\"\?><autofillupload " |
1717 "clientversion=\"6.1.1715.1442/en (GGLL)\" formsignature=\"" | 1717 "clientversion=\"6.1.1715.1442/en (GGLL)\" formsignature=\"" |
1718 "2027360543766157144\" autofillused=\"false\" datapresent=\"\"><field " | 1718 "9124126510289951497\" autofillused=\"false\" datapresent=\"144200830e\">" |
1719 "signature=\"3763331450\" autofilltype=\"3\"/><field signature=\"" | 1719 "<field signature=\"3763331450\" autofilltype=\"3\"/><field signature=\"" |
1720 "3494530716\" autofilltype=\"5\"/><field signature=\"1029417091\" " | 1720 "3494530716\" autofilltype=\"5\"/><field signature=\"1029417091\" " |
1721 "autofilltype=\"9\"/><field signature=\"466116101\" autofilltype=\"14\"/>" | 1721 "autofilltype=\"9\"/><field signature=\"466116101\" autofilltype=\"14\"/>" |
1722 "<field signature=\"2799270304\" autofilltype=\"36\"/><field signature=\"" | 1722 "<field signature=\"2799270304\" autofilltype=\"36\"/><field signature=\"" |
1723 "1876771436\" autofilltype=\"24\"/><field signature=\"263446779\" " | 1723 "1876771436\" autofilltype=\"24\"/><field signature=\"263446779\" " |
1724 "autofilltype=\"30\"/><field signature=\"509334676\" autofilltype=" | 1724 "autofilltype=\"30\"/>" |
1725 "\"30\"/><field signature=\"509334676\" autofilltype=\"31\"/><field " | 1725 "<field signature=\"509334676\" autofilltype=\"30\"/>" |
1726 "signature=\"509334676\" autofilltype=\"37\"/><field signature=" | 1726 "<field signature=\"509334676\" autofilltype=\"31\"/>" |
1727 "\"509334676\" autofilltype=\"38\"/><field signature=\"509334676\" " | 1727 "<field signature=\"509334676\" autofilltype=\"37\"/>" |
1728 "autofilltype=\"30\"/><field signature=\"509334676\" autofilltype=" | 1728 "<field signature=\"509334676\" autofilltype=\"38\"/>" |
1729 "\"31\"/><field signature=\"509334676\" autofilltype=\"37\"/><field " | 1729 "<field signature=\"509334676\" autofilltype=\"30\"/>" |
1730 "signature=\"509334676\" autofilltype=\"38\"/><field signature=\"" | 1730 "<field signature=\"509334676\" autofilltype=\"31\"/>" |
1731 "509334676\" autofilltype=\"30\"/><field signature=\"509334676\" " | 1731 "<field signature=\"509334676\" autofilltype=\"37\"/>" |
1732 "autofilltype=\"31\"/><field signature=\"509334676\" " | 1732 "<field signature=\"509334676\" autofilltype=\"38\"/>" |
1733 "autofilltype=\"37\"/><field signature=\"509334676\" autofilltype=" | 1733 "</autofillupload>"); |
1734 "\"38\"/><field signature=\"509334676\" autofilltype=\"30\"/><field " | |
1735 "signature=\"509334676\" autofilltype=\"31\"/><field signature=" | |
1736 "\"509334676\" autofilltype=\"37\"/><field signature=\"509334676\" " | |
1737 "autofilltype=\"38\"/><field signature=\"509334676\" autofilltype=" | |
1738 "\"30\"/><field signature=\"509334676\" autofilltype=\"31\"/><field " | |
1739 "signature=\"509334676\" autofilltype=\"37\"/><field signature=" | |
1740 "\"509334676\" autofilltype=\"38\"/></autofillupload>"); | |
1741 // Add 50 address fields - now the form is invalid. | 1734 // Add 50 address fields - now the form is invalid. |
1742 for (size_t i = 0; i < 50; ++i) { | 1735 for (size_t i = 0; i < 50; ++i) { |
1743 form.fields.push_back(webkit_glue::FormField(ASCIIToUTF16("Address"), | 1736 form.fields.push_back(webkit_glue::FormField(ASCIIToUTF16("Address"), |
1744 ASCIIToUTF16("address"), | 1737 ASCIIToUTF16("address"), |
1745 string16(), | 1738 string16(), |
1746 ASCIIToUTF16("text"), | 1739 ASCIIToUTF16("text"), |
1747 0, | 1740 0, |
1748 false)); | 1741 false)); |
1749 possible_field_types.push_back(FieldTypeSet()); | 1742 possible_field_types.push_back(FieldTypeSet()); |
1750 possible_field_types.back().insert(ADDRESS_HOME_LINE1); | 1743 possible_field_types.back().insert(ADDRESS_HOME_LINE1); |
1751 possible_field_types.back().insert(ADDRESS_HOME_LINE2); | 1744 possible_field_types.back().insert(ADDRESS_HOME_LINE2); |
1752 possible_field_types.back().insert(ADDRESS_BILLING_LINE1); | 1745 possible_field_types.back().insert(ADDRESS_BILLING_LINE1); |
1753 possible_field_types.back().insert(ADDRESS_BILLING_LINE2); | 1746 possible_field_types.back().insert(ADDRESS_BILLING_LINE2); |
1754 } | 1747 } |
1755 form_structure.reset(new FormStructure(form)); | 1748 form_structure.reset(new FormStructure(form)); |
1756 ASSERT_EQ(form_structure->field_count(), possible_field_types.size()); | 1749 ASSERT_EQ(form_structure->field_count(), possible_field_types.size()); |
1757 for (size_t i = 0; i < form_structure->field_count(); ++i) | 1750 for (size_t i = 0; i < form_structure->field_count(); ++i) |
1758 form_structure->set_possible_types(i, possible_field_types[i]); | 1751 form_structure->set_possible_types(i, possible_field_types[i]); |
1759 EXPECT_FALSE(form_structure->EncodeUploadRequest(false, &encoded_xml)); | 1752 EXPECT_FALSE(form_structure->EncodeUploadRequest(false, &encoded_xml)); |
1760 EXPECT_EQ(encoded_xml, ""); | 1753 EXPECT_EQ(encoded_xml, ""); |
1761 } | 1754 } |
1762 | 1755 |
| 1756 TEST(FormStructureTest, CheckDataPresence) { |
| 1757 // Checks bits set in the datapresence field: for each type in the form |
| 1758 // relevant bit in datapresence has to be set. |
| 1759 scoped_ptr<FormStructure> form_structure; |
| 1760 std::vector<FieldTypeSet> possible_field_types; |
| 1761 FormData form; |
| 1762 form.method = ASCIIToUTF16("post"); |
| 1763 form.fields.push_back(webkit_glue::FormField(ASCIIToUTF16("First Name"), |
| 1764 ASCIIToUTF16("first"), |
| 1765 string16(), |
| 1766 ASCIIToUTF16("text"), |
| 1767 0, |
| 1768 false)); |
| 1769 possible_field_types.push_back(FieldTypeSet()); |
| 1770 possible_field_types.back().insert(NAME_FIRST); |
| 1771 form.fields.push_back(webkit_glue::FormField(ASCIIToUTF16("Last Name"), |
| 1772 ASCIIToUTF16("last"), |
| 1773 string16(), |
| 1774 ASCIIToUTF16("text"), |
| 1775 0, |
| 1776 false)); |
| 1777 possible_field_types.push_back(FieldTypeSet()); |
| 1778 possible_field_types.back().insert(NAME_LAST); |
| 1779 form.fields.push_back(webkit_glue::FormField(ASCIIToUTF16("email"), |
| 1780 ASCIIToUTF16("email"), |
| 1781 string16(), |
| 1782 ASCIIToUTF16("text"), |
| 1783 0, |
| 1784 false)); |
| 1785 possible_field_types.push_back(FieldTypeSet()); |
| 1786 possible_field_types.back().insert(EMAIL_ADDRESS); |
| 1787 form_structure.reset(new FormStructure(form)); |
| 1788 for (size_t i = 0; i < form_structure->field_count(); ++i) |
| 1789 form_structure->set_possible_types(i, possible_field_types[i]); |
| 1790 std::string encoded_xml; |
| 1791 EXPECT_TRUE(form_structure->EncodeUploadRequest(false, &encoded_xml)); |
| 1792 EXPECT_EQ("<\?xml version=\"1.0\" encoding=\"UTF-8\"\?><autofillupload " |
| 1793 "clientversion=\"6.1.1715.1442/en (GGLL)\" formsignature=\"" |
| 1794 "6402244543831589061\" autofillused=\"false\" " |
| 1795 "datapresent=\"1440\"><field signature=\"1089846351\" ", |
| 1796 encoded_xml.substr(0, 200)); |
| 1797 |
| 1798 form.fields.push_back(webkit_glue::FormField(ASCIIToUTF16("Address"), |
| 1799 ASCIIToUTF16("address"), |
| 1800 string16(), |
| 1801 ASCIIToUTF16("text"), |
| 1802 0, |
| 1803 false)); |
| 1804 possible_field_types.push_back(FieldTypeSet()); |
| 1805 possible_field_types.back().insert(ADDRESS_HOME_LINE1); |
| 1806 form_structure.reset(new FormStructure(form)); |
| 1807 for (size_t i = 0; i < form_structure->field_count(); ++i) |
| 1808 form_structure->set_possible_types(i, possible_field_types[i]); |
| 1809 EXPECT_TRUE(form_structure->EncodeUploadRequest(false, &encoded_xml)); |
| 1810 EXPECT_EQ("<\?xml version=\"1.0\" encoding=\"UTF-8\"\?><autofillupload " |
| 1811 "clientversion=\"6.1.1715.1442/en (GGLL)\" formsignature=\"" |
| 1812 "11817937699000629499\" autofillused=\"false\" " |
| 1813 "datapresent=\"14400002\"><field signature=\"1089846", |
| 1814 encoded_xml.substr(0, 200)); |
| 1815 |
| 1816 form.fields.push_back(webkit_glue::FormField(ASCIIToUTF16("F4"), |
| 1817 ASCIIToUTF16("f4"), |
| 1818 string16(), |
| 1819 ASCIIToUTF16("text"), |
| 1820 0, |
| 1821 false)); |
| 1822 possible_field_types.push_back(FieldTypeSet()); |
| 1823 possible_field_types.back().insert(CREDIT_CARD_TYPE); |
| 1824 form_structure.reset(new FormStructure(form)); |
| 1825 for (size_t i = 0; i < form_structure->field_count(); ++i) |
| 1826 form_structure->set_possible_types(i, possible_field_types[i]); |
| 1827 EXPECT_TRUE(form_structure->EncodeUploadRequest(false, &encoded_xml)); |
| 1828 EXPECT_EQ("<\?xml version=\"1.0\" encoding=\"UTF-8\"\?><autofillupload " |
| 1829 "clientversion=\"6.1.1715.1442/en (GGLL)\" formsignature=\"" |
| 1830 "15126663683491865216\" autofillused=\"false\" " |
| 1831 "datapresent=\"1440000200000020\"><field signature=", |
| 1832 encoded_xml.substr(0, 200)); |
| 1833 } |
| 1834 |
| 1835 TEST(FormStructureTest, CheckMultipleTypes) { |
| 1836 // Check that multiple types for the field are processed correctly, both in |
| 1837 // datapresence and in actual field data. |
| 1838 scoped_ptr<FormStructure> form_structure; |
| 1839 std::vector<FieldTypeSet> possible_field_types; |
| 1840 FormData form; |
| 1841 form.method = ASCIIToUTF16("post"); |
| 1842 form.fields.push_back(webkit_glue::FormField(ASCIIToUTF16("email"), |
| 1843 ASCIIToUTF16("email"), |
| 1844 string16(), |
| 1845 ASCIIToUTF16("text"), |
| 1846 0, |
| 1847 false)); |
| 1848 possible_field_types.push_back(FieldTypeSet()); |
| 1849 possible_field_types.back().insert(EMAIL_ADDRESS); |
| 1850 form.fields.push_back(webkit_glue::FormField(ASCIIToUTF16("First Name"), |
| 1851 ASCIIToUTF16("first"), |
| 1852 string16(), |
| 1853 ASCIIToUTF16("text"), |
| 1854 0, |
| 1855 false)); |
| 1856 possible_field_types.push_back(FieldTypeSet()); |
| 1857 possible_field_types.back().insert(NAME_FIRST); |
| 1858 form.fields.push_back(webkit_glue::FormField(ASCIIToUTF16("Last Name"), |
| 1859 ASCIIToUTF16("last"), |
| 1860 string16(), |
| 1861 ASCIIToUTF16("text"), |
| 1862 0, |
| 1863 false)); |
| 1864 possible_field_types.push_back(FieldTypeSet()); |
| 1865 possible_field_types.back().insert(NAME_LAST); |
| 1866 form.fields.push_back(webkit_glue::FormField(ASCIIToUTF16("Address"), |
| 1867 ASCIIToUTF16("address"), |
| 1868 string16(), |
| 1869 ASCIIToUTF16("text"), |
| 1870 0, |
| 1871 false)); |
| 1872 possible_field_types.push_back(FieldTypeSet()); |
| 1873 possible_field_types.back().insert(ADDRESS_HOME_LINE1); |
| 1874 form_structure.reset(new FormStructure(form)); |
| 1875 for (size_t i = 0; i < form_structure->field_count(); ++i) |
| 1876 form_structure->set_possible_types(i, possible_field_types[i]); |
| 1877 std::string encoded_xml; |
| 1878 // Now we matched both fields singularly. |
| 1879 EXPECT_TRUE(form_structure->EncodeUploadRequest(false, &encoded_xml)); |
| 1880 // datapresent==14400002==00010100010000000000000000000010b set bits are: |
| 1881 // #3 == NAME_FIRST |
| 1882 // #5 == NAME_LAST |
| 1883 // #9 == EMAIL_ADDRESS |
| 1884 // #30 == ADDRESS_HOME_LINE1 |
| 1885 EXPECT_EQ("<\?xml version=\"1.0\" encoding=\"UTF-8\"\?><autofillupload " |
| 1886 "clientversion=\"6.1.1715.1442/en (GGLL)\" formsignature=\"" |
| 1887 "18062476096658145866\" autofillused=\"false\" datapresent=" |
| 1888 "\"14400002\"><field signature=\"420638584\" autofilltype=" |
| 1889 "\"9\"/><field signature=\"1089846351\" autofilltype=\"3\"/><field " |
| 1890 "signature=\"2404144663\" autofilltype=\"5\"/><field signature=" |
| 1891 "\"509334676\" autofilltype=\"30\"/></autofillupload>", |
| 1892 encoded_xml); |
| 1893 // Match third field as both first and last. |
| 1894 possible_field_types[2].insert(NAME_FIRST); |
| 1895 form_structure->set_possible_types(2, possible_field_types[2]); |
| 1896 EXPECT_TRUE(form_structure->EncodeUploadRequest(false, &encoded_xml)); |
| 1897 // datapresent==14400002==00010100010000000000000000000010b set bits are: |
| 1898 // #3 == NAME_FIRST |
| 1899 // #5 == NAME_LAST |
| 1900 // #9 == EMAIL_ADDRESS |
| 1901 // #30 == ADDRESS_HOME_LINE1 |
| 1902 EXPECT_EQ("<\?xml version=\"1.0\" encoding=\"UTF-8\"\?><autofillupload " |
| 1903 "clientversion=\"6.1.1715.1442/en (GGLL)\" formsignature=\"" |
| 1904 "18062476096658145866\" autofillused=\"false\" datapresent=" |
| 1905 "\"14400002\"><field signature=\"420638584\" autofilltype=" |
| 1906 "\"9\"/><field signature=\"1089846351\" autofilltype=\"3\"/><field " |
| 1907 "signature=\"2404144663\" autofilltype=\"3\"/><field " |
| 1908 "signature=\"2404144663\" autofilltype=\"5\"/><field signature=" |
| 1909 "\"509334676\" autofilltype=\"30\"/></autofillupload>", |
| 1910 encoded_xml); |
| 1911 possible_field_types[3].insert(ADDRESS_BILLING_LINE1); |
| 1912 form_structure->set_possible_types( |
| 1913 form_structure->field_count() - 1, |
| 1914 possible_field_types[form_structure->field_count() - 1]); |
| 1915 EXPECT_TRUE(form_structure->EncodeUploadRequest(false, &encoded_xml)); |
| 1916 // datapresent==1440000204==0001010001000000000000000000001000000100b set bits |
| 1917 // are: |
| 1918 // #3 == NAME_FIRST |
| 1919 // #5 == NAME_LAST |
| 1920 // #9 == EMAIL_ADDRESS |
| 1921 // #30 == ADDRESS_HOME_LINE1 |
| 1922 // #37 == ADDRESS_BILLING_LINE1 |
| 1923 EXPECT_EQ("<\?xml version=\"1.0\" encoding=\"UTF-8\"\?><autofillupload " |
| 1924 "clientversion=\"6.1.1715.1442/en (GGLL)\" formsignature=\"" |
| 1925 "18062476096658145866\" autofillused=\"false\" datapresent=" |
| 1926 "\"1440000204\"><field signature=\"420638584\" autofilltype=" |
| 1927 "\"9\"/><field signature=\"1089846351\" autofilltype=\"3\"/><field " |
| 1928 "signature=\"2404144663\" autofilltype=\"3\"/><field " |
| 1929 "signature=\"2404144663\" autofilltype=\"5\"/><field signature=" |
| 1930 "\"509334676\" autofilltype=\"30\"/><field signature=\"509334676\" " |
| 1931 "autofilltype=\"37\"/></autofillupload>", |
| 1932 encoded_xml); |
| 1933 possible_field_types[3].clear(); |
| 1934 possible_field_types[3].insert(ADDRESS_HOME_LINE1); |
| 1935 possible_field_types[3].insert(ADDRESS_BILLING_LINE2); |
| 1936 form_structure->set_possible_types( |
| 1937 form_structure->field_count() - 1, |
| 1938 possible_field_types[form_structure->field_count() - 1]); |
| 1939 EXPECT_TRUE(form_structure->EncodeUploadRequest(false, &encoded_xml)); |
| 1940 // datapresent==1440000202==0001010001000000000000000000001000000010b set bits |
| 1941 // are: |
| 1942 // #3 == NAME_FIRST |
| 1943 // #5 == NAME_LAST |
| 1944 // #9 == EMAIL_ADDRESS |
| 1945 // #30 == ADDRESS_HOME_LINE1 |
| 1946 // #38 == ADDRESS_BILLING_LINE2 |
| 1947 EXPECT_EQ("<\?xml version=\"1.0\" encoding=\"UTF-8\"\?><autofillupload " |
| 1948 "clientversion=\"6.1.1715.1442/en (GGLL)\" formsignature=\"" |
| 1949 "18062476096658145866\" autofillused=\"false\" datapresent=" |
| 1950 "\"1440000202\"><field signature=\"420638584\" autofilltype=" |
| 1951 "\"9\"/><field signature=\"1089846351\" autofilltype=\"3\"/><field " |
| 1952 "signature=\"2404144663\" autofilltype=\"3\"/><field " |
| 1953 "signature=\"2404144663\" autofilltype=\"5\"/><field signature=" |
| 1954 "\"509334676\" autofilltype=\"30\"/><field signature=\"509334676\" " |
| 1955 "autofilltype=\"38\"/></autofillupload>", |
| 1956 encoded_xml); |
| 1957 } |
| 1958 |
1763 } // namespace | 1959 } // namespace |
OLD | NEW |