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 5 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 < 5; ++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 "2027360543766157144\" autofillused=\"false\" datapresent=\"5442008208\">" |
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\"/><field signature=\"509334676\" autofilltype=\"1\"/>" |
1725 "\"30\"/><field signature=\"509334676\" autofilltype=\"31\"/><field " | 1725 "<field signature=\"509334676\" autofilltype=\"1\"/><field signature=\"" |
1726 "signature=\"509334676\" autofilltype=\"37\"/><field signature=" | 1726 "509334676\" autofilltype=\"1\"/><field signature=\"509334676\" " |
1727 "\"509334676\" autofilltype=\"38\"/><field signature=\"509334676\" " | 1727 "autofilltype=\"1\"/><field signature=\"509334676\" autofilltype=\"1\"/>" |
1728 "autofilltype=\"30\"/><field signature=\"509334676\" autofilltype=" | 1728 "</autofillupload>"); |
1729 "\"31\"/><field signature=\"509334676\" autofilltype=\"37\"/><field " | |
1730 "signature=\"509334676\" autofilltype=\"38\"/><field signature=\"" | |
1731 "509334676\" autofilltype=\"30\"/><field signature=\"509334676\" " | |
1732 "autofilltype=\"31\"/><field signature=\"509334676\" " | |
1733 "autofilltype=\"37\"/><field signature=\"509334676\" autofilltype=" | |
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. | 1729 // Add 50 address fields - now the form is invalid. |
1742 for (size_t i = 0; i < 50; ++i) { | 1730 for (size_t i = 0; i < 50; ++i) { |
1743 form.fields.push_back(webkit_glue::FormField(ASCIIToUTF16("Address"), | 1731 form.fields.push_back(webkit_glue::FormField(ASCIIToUTF16("Address"), |
1744 ASCIIToUTF16("address"), | 1732 ASCIIToUTF16("address"), |
1745 string16(), | 1733 string16(), |
1746 ASCIIToUTF16("text"), | 1734 ASCIIToUTF16("text"), |
1747 0, | 1735 0, |
1748 false)); | 1736 false)); |
1749 possible_field_types.push_back(FieldTypeSet()); | 1737 possible_field_types.push_back(FieldTypeSet()); |
1750 possible_field_types.back().insert(ADDRESS_HOME_LINE1); | 1738 possible_field_types.back().insert(ADDRESS_HOME_LINE1); |
1751 possible_field_types.back().insert(ADDRESS_HOME_LINE2); | 1739 possible_field_types.back().insert(ADDRESS_HOME_LINE2); |
1752 possible_field_types.back().insert(ADDRESS_BILLING_LINE1); | 1740 possible_field_types.back().insert(ADDRESS_BILLING_LINE1); |
1753 possible_field_types.back().insert(ADDRESS_BILLING_LINE2); | 1741 possible_field_types.back().insert(ADDRESS_BILLING_LINE2); |
1754 } | 1742 } |
1755 form_structure.reset(new FormStructure(form)); | 1743 form_structure.reset(new FormStructure(form)); |
1756 ASSERT_EQ(form_structure->field_count(), possible_field_types.size()); | 1744 ASSERT_EQ(form_structure->field_count(), possible_field_types.size()); |
1757 for (size_t i = 0; i < form_structure->field_count(); ++i) | 1745 for (size_t i = 0; i < form_structure->field_count(); ++i) |
1758 form_structure->set_possible_types(i, possible_field_types[i]); | 1746 form_structure->set_possible_types(i, possible_field_types[i]); |
1759 EXPECT_FALSE(form_structure->EncodeUploadRequest(false, &encoded_xml)); | 1747 EXPECT_FALSE(form_structure->EncodeUploadRequest(false, &encoded_xml)); |
1760 EXPECT_EQ(encoded_xml, ""); | 1748 EXPECT_EQ(encoded_xml, ""); |
1761 } | 1749 } |
1762 | 1750 |
1751 TEST(FormStructureTest, CheckDataPresence) { | |
Ilya Sherman
2011/01/22 01:12:35
nit: Please include a quick comment describing thi
Ilya Sherman
2011/01/22 01:12:35
Might be good to test EmptyType as well.
GeorgeY
2011/01/22 01:40:40
Done.
| |
1752 scoped_ptr<FormStructure> form_structure; | |
1753 std::vector<FieldTypeSet> possible_field_types; | |
1754 FormData form; | |
1755 form.method = ASCIIToUTF16("post"); | |
1756 form.fields.push_back(webkit_glue::FormField(ASCIIToUTF16("First Name"), | |
1757 ASCIIToUTF16("first"), | |
1758 string16(), | |
1759 ASCIIToUTF16("text"), | |
1760 0, | |
1761 false)); | |
1762 possible_field_types.push_back(FieldTypeSet()); | |
1763 possible_field_types.back().insert(NAME_FIRST); | |
1764 form.fields.push_back(webkit_glue::FormField(ASCIIToUTF16("Last Name"), | |
1765 ASCIIToUTF16("last"), | |
1766 string16(), | |
1767 ASCIIToUTF16("text"), | |
1768 0, | |
1769 false)); | |
1770 possible_field_types.push_back(FieldTypeSet()); | |
1771 possible_field_types.back().insert(NAME_LAST); | |
1772 form.fields.push_back(webkit_glue::FormField(ASCIIToUTF16("email"), | |
1773 ASCIIToUTF16("email"), | |
1774 string16(), | |
1775 ASCIIToUTF16("text"), | |
1776 0, | |
1777 false)); | |
1778 possible_field_types.push_back(FieldTypeSet()); | |
1779 possible_field_types.back().insert(EMAIL_ADDRESS); | |
1780 form_structure.reset(new FormStructure(form)); | |
1781 for (size_t i = 0; i < form_structure->field_count(); ++i) | |
1782 form_structure->set_possible_types(i, possible_field_types[i]); | |
1783 std::string encoded_xml; | |
1784 EXPECT_TRUE(form_structure->EncodeUploadRequest(false, &encoded_xml)); | |
1785 EXPECT_EQ("<\?xml version=\"1.0\" encoding=\"UTF-8\"\?><autofillupload " | |
1786 "clientversion=\"6.1.1715.1442/en (GGLL)\" formsignature=\"" | |
1787 "6402244543831589061\" autofillused=\"false\" " | |
1788 "datapresent=\"1440\"><field signature=\"1089846351\" ", | |
1789 encoded_xml.substr(0, 200)); | |
1790 | |
1791 form.fields.push_back(webkit_glue::FormField(ASCIIToUTF16("Address"), | |
1792 ASCIIToUTF16("address"), | |
1793 string16(), | |
1794 ASCIIToUTF16("text"), | |
1795 0, | |
1796 false)); | |
1797 possible_field_types.push_back(FieldTypeSet()); | |
1798 possible_field_types.back().insert(ADDRESS_HOME_LINE1); | |
1799 form_structure.reset(new FormStructure(form)); | |
1800 for (size_t i = 0; i < form_structure->field_count(); ++i) | |
1801 form_structure->set_possible_types(i, possible_field_types[i]); | |
1802 EXPECT_TRUE(form_structure->EncodeUploadRequest(false, &encoded_xml)); | |
1803 EXPECT_EQ("<\?xml version=\"1.0\" encoding=\"UTF-8\"\?><autofillupload " | |
1804 "clientversion=\"6.1.1715.1442/en (GGLL)\" formsignature=\"" | |
1805 "11817937699000629499\" autofillused=\"false\" " | |
1806 "datapresent=\"14400002\"><field signature=\"1089846", | |
1807 encoded_xml.substr(0, 200)); | |
1808 | |
1809 form.fields.push_back(webkit_glue::FormField(ASCIIToUTF16("F4"), | |
1810 ASCIIToUTF16("f4"), | |
1811 string16(), | |
1812 ASCIIToUTF16("text"), | |
1813 0, | |
1814 false)); | |
1815 possible_field_types.push_back(FieldTypeSet()); | |
1816 possible_field_types.back().insert(CREDIT_CARD_TYPE); | |
1817 form_structure.reset(new FormStructure(form)); | |
1818 for (size_t i = 0; i < form_structure->field_count(); ++i) | |
1819 form_structure->set_possible_types(i, possible_field_types[i]); | |
1820 EXPECT_TRUE(form_structure->EncodeUploadRequest(false, &encoded_xml)); | |
1821 EXPECT_EQ("<\?xml version=\"1.0\" encoding=\"UTF-8\"\?><autofillupload " | |
1822 "clientversion=\"6.1.1715.1442/en (GGLL)\" formsignature=\"" | |
1823 "15126663683491865216\" autofillused=\"false\" " | |
1824 "datapresent=\"1440000200000020\"><field signature=", | |
1825 encoded_xml.substr(0, 200)); | |
1826 } | |
1827 | |
1828 TEST(FormStructureTest, CheckMultipleTypes) { | |
Ilya Sherman
2011/01/22 01:12:35
nit: Ditto.
GeorgeY
2011/01/22 01:40:40
Changed comment in next 4 lines
| |
1829 // Let's imagine user entered 'George' 'Washington' in first and second fields | |
1830 // and there are two profiles: for George Washington and Washington Irving. | |
1831 // As Washington will match both first and last name in two profiles we are | |
1832 // not sure which one it is, so we will not poison crowd sourced data. | |
1833 scoped_ptr<FormStructure> form_structure; | |
1834 std::vector<FieldTypeSet> possible_field_types; | |
1835 FormData form; | |
1836 form.method = ASCIIToUTF16("post"); | |
1837 form.fields.push_back(webkit_glue::FormField(ASCIIToUTF16("email"), | |
1838 ASCIIToUTF16("email"), | |
1839 string16(), | |
1840 ASCIIToUTF16("text"), | |
1841 0, | |
1842 false)); | |
1843 possible_field_types.push_back(FieldTypeSet()); | |
1844 possible_field_types.back().insert(EMAIL_ADDRESS); | |
1845 form.fields.push_back(webkit_glue::FormField(ASCIIToUTF16("First Name"), | |
1846 ASCIIToUTF16("first"), | |
1847 string16(), | |
1848 ASCIIToUTF16("text"), | |
1849 0, | |
1850 false)); | |
1851 possible_field_types.push_back(FieldTypeSet()); | |
1852 possible_field_types.back().insert(NAME_FIRST); | |
1853 form.fields.push_back(webkit_glue::FormField(ASCIIToUTF16("Last Name"), | |
1854 ASCIIToUTF16("last"), | |
1855 string16(), | |
1856 ASCIIToUTF16("text"), | |
1857 0, | |
1858 false)); | |
1859 possible_field_types.push_back(FieldTypeSet()); | |
1860 possible_field_types.back().insert(NAME_LAST); | |
1861 form.fields.push_back(webkit_glue::FormField(ASCIIToUTF16("Address"), | |
1862 ASCIIToUTF16("address"), | |
1863 string16(), | |
1864 ASCIIToUTF16("text"), | |
1865 0, | |
1866 false)); | |
1867 possible_field_types.push_back(FieldTypeSet()); | |
1868 possible_field_types.back().insert(ADDRESS_HOME_LINE1); | |
1869 form_structure.reset(new FormStructure(form)); | |
1870 for (size_t i = 0; i < form_structure->field_count(); ++i) | |
1871 form_structure->set_possible_types(i, possible_field_types[i]); | |
1872 std::string encoded_xml; | |
1873 // Now we matched both fields singularly. | |
1874 EXPECT_TRUE(form_structure->EncodeUploadRequest(false, &encoded_xml)); | |
1875 // datapresent==14400002==00010100010000000000000000000010b set bits are: | |
1876 // #3 == NAME_FIRST | |
1877 // #5 == NAME_LAST | |
1878 // #9 == EMAIL_ADDRESS | |
1879 // #30 == ADDRESS_HOME_LINE1 | |
1880 EXPECT_EQ("<\?xml version=\"1.0\" encoding=\"UTF-8\"\?><autofillupload " | |
1881 "clientversion=\"6.1.1715.1442/en (GGLL)\" formsignature=\"" | |
1882 "18062476096658145866\" autofillused=\"false\" datapresent=" | |
1883 "\"14400002\"><field signature=\"420638584\" autofilltype=" | |
1884 "\"9\"/><field signature=\"1089846351\" autofilltype=\"3\"/><field " | |
1885 "signature=\"2404144663\" autofilltype=\"5\"/><field signature=" | |
1886 "\"509334676\" autofilltype=\"30\"/></autofillupload>", | |
1887 encoded_xml); | |
1888 // Match third field as both first and last. | |
1889 possible_field_types[2].insert(NAME_FIRST); | |
1890 form_structure->set_possible_types(2, possible_field_types[2]); | |
1891 EXPECT_TRUE(form_structure->EncodeUploadRequest(false, &encoded_xml)); | |
1892 // datapresent==50400002==01010100010000000000000000000010b set bits are: | |
1893 // #1 == UNKNOWN_TYPE | |
1894 // #3 == NAME_FIRST | |
1895 // #9 == EMAIL_ADDRESS | |
1896 // #30 == ADDRESS_HOME_LINE1 | |
1897 EXPECT_EQ("<\?xml version=\"1.0\" encoding=\"UTF-8\"\?><autofillupload " | |
1898 "clientversion=\"6.1.1715.1442/en (GGLL)\" formsignature=\"" | |
1899 "18062476096658145866\" autofillused=\"false\" datapresent=" | |
1900 "\"50400002\"><field signature=\"420638584\" autofilltype=" | |
1901 "\"9\"/><field signature=\"1089846351\" autofilltype=\"3\"/><field " | |
1902 "signature=\"2404144663\" autofilltype=\"1\"/><field signature=" | |
1903 "\"509334676\" autofilltype=\"30\"/></autofillupload>", | |
1904 encoded_xml); | |
1905 possible_field_types[3].insert(ADDRESS_BILLING_LINE1); | |
1906 form_structure->set_possible_types( | |
1907 form_structure->field_count() - 1, | |
1908 possible_field_types[form_structure->field_count() - 1]); | |
1909 EXPECT_TRUE(form_structure->EncodeUploadRequest(false, &encoded_xml)); | |
1910 // datapresent==5040000204==0101010001000000000000000000001000000100b set bits | |
1911 // are: | |
1912 // #1 == UNKNOWN_TYPE | |
1913 // #3 == NAME_FIRST | |
1914 // #9 == EMAIL_ADDRESS | |
1915 // #30 == ADDRESS_HOME_LINE1 | |
1916 // #37 == ADDRESS_BILLING_LINE1 | |
1917 EXPECT_EQ("<\?xml version=\"1.0\" encoding=\"UTF-8\"\?><autofillupload " | |
1918 "clientversion=\"6.1.1715.1442/en (GGLL)\" formsignature=\"" | |
1919 "18062476096658145866\" autofillused=\"false\" datapresent=" | |
1920 "\"5040000204\"><field signature=\"420638584\" autofilltype=" | |
1921 "\"9\"/><field signature=\"1089846351\" autofilltype=\"3\"/><field " | |
1922 "signature=\"2404144663\" autofilltype=\"1\"/><field signature=" | |
1923 "\"509334676\" autofilltype=\"30\"/><field signature=\"509334676\" " | |
1924 "autofilltype=\"37\"/></autofillupload>", | |
1925 encoded_xml); | |
1926 possible_field_types[3].clear(); | |
1927 possible_field_types[3].insert(ADDRESS_HOME_LINE1); | |
1928 possible_field_types[3].insert(ADDRESS_BILLING_LINE2); | |
1929 form_structure->set_possible_types( | |
1930 form_structure->field_count() - 1, | |
1931 possible_field_types[form_structure->field_count() - 1]); | |
1932 EXPECT_TRUE(form_structure->EncodeUploadRequest(false, &encoded_xml)); | |
1933 // datapresent==5040==0101010001000000b set bits are: | |
1934 // #1 == UNKNOWN_TYPE | |
1935 // #3 == NAME_FIRST | |
1936 // #9 == EMAIL_ADDRESS | |
1937 EXPECT_EQ("<\?xml version=\"1.0\" encoding=\"UTF-8\"\?><autofillupload " | |
1938 "clientversion=\"6.1.1715.1442/en (GGLL)\" formsignature=\"" | |
1939 "18062476096658145866\" autofillused=\"false\" " | |
1940 "datapresent=\"5040\"><field signature=\"420638584\" autofilltype=" | |
1941 "\"9\"/><field signature=\"1089846351\" autofilltype=\"3\"/><field " | |
1942 "signature=\"2404144663\" autofilltype=\"1\"/><field signature=" | |
1943 "\"509334676\" autofilltype=\"1\"/></autofillupload>", | |
1944 encoded_xml); | |
1945 } | |
1946 | |
1763 } // namespace | 1947 } // namespace |
OLD | NEW |