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

Side by Side Diff: components/autofill/core/browser/autofill_manager_unittest.cc

Issue 2819183004: [Autofill] Change MasterCard to Mastercard in UI and related tests (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "components/autofill/core/browser/autofill_manager.h" 5 #include "components/autofill/core/browser/autofill_manager.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <memory> 10 #include <memory>
(...skipping 1536 matching lines...) Expand 10 before | Expand all | Expand 10 after
1547 FormsSeen(forms); 1547 FormsSeen(forms);
1548 1548
1549 FormFieldData field = form.fields[1]; 1549 FormFieldData field = form.fields[1];
1550 GetAutofillSuggestions(form, field); 1550 GetAutofillSuggestions(form, field);
1551 1551
1552 // Test that we sent the right values to the external delegate. 1552 // Test that we sent the right values to the external delegate.
1553 external_delegate_->CheckSuggestions( 1553 external_delegate_->CheckSuggestions(
1554 kDefaultPageID, Suggestion("Visa" + kUTF8MidlineEllipsis + "3456", 1554 kDefaultPageID, Suggestion("Visa" + kUTF8MidlineEllipsis + "3456",
1555 "04/99", kVisaCard, 1555 "04/99", kVisaCard,
1556 autofill_manager_->GetPackedCreditCardID(4)), 1556 autofill_manager_->GetPackedCreditCardID(4)),
1557 Suggestion("MasterCard" + kUTF8MidlineEllipsis + "8765", "10/98", 1557 Suggestion("Mastercard" + kUTF8MidlineEllipsis + "8765", "10/98",
1558 kMasterCard, autofill_manager_->GetPackedCreditCardID(5))); 1558 kMasterCard, autofill_manager_->GetPackedCreditCardID(5)));
1559 } 1559 }
1560 1560
1561 // Test that we return all credit card profile suggestions when the triggering 1561 // Test that we return all credit card profile suggestions when the triggering
1562 // field has whitespace in it. 1562 // field has whitespace in it.
1563 TEST_F(AutofillManagerTest, GetCreditCardSuggestions_Whitespace) { 1563 TEST_F(AutofillManagerTest, GetCreditCardSuggestions_Whitespace) {
1564 // Set up our form data. 1564 // Set up our form data.
1565 FormData form; 1565 FormData form;
1566 CreateTestCreditCardFormData(&form, true, false); 1566 CreateTestCreditCardFormData(&form, true, false);
1567 std::vector<FormData> forms(1, form); 1567 std::vector<FormData> forms(1, form);
1568 FormsSeen(forms); 1568 FormsSeen(forms);
1569 1569
1570 FormFieldData field = form.fields[1]; 1570 FormFieldData field = form.fields[1];
1571 field.value = ASCIIToUTF16(" "); 1571 field.value = ASCIIToUTF16(" ");
1572 GetAutofillSuggestions(form, field); 1572 GetAutofillSuggestions(form, field);
1573 1573
1574 // Test that we sent the right values to the external delegate. 1574 // Test that we sent the right values to the external delegate.
1575 external_delegate_->CheckSuggestions( 1575 external_delegate_->CheckSuggestions(
1576 kDefaultPageID, Suggestion("Visa" + kUTF8MidlineEllipsis + "3456", 1576 kDefaultPageID, Suggestion("Visa" + kUTF8MidlineEllipsis + "3456",
1577 "04/99", kVisaCard, 1577 "04/99", kVisaCard,
1578 autofill_manager_->GetPackedCreditCardID(4)), 1578 autofill_manager_->GetPackedCreditCardID(4)),
1579 Suggestion("MasterCard" + kUTF8MidlineEllipsis + "8765", "10/98", 1579 Suggestion("Mastercard" + kUTF8MidlineEllipsis + "8765", "10/98",
1580 kMasterCard, autofill_manager_->GetPackedCreditCardID(5))); 1580 kMasterCard, autofill_manager_->GetPackedCreditCardID(5)));
1581 } 1581 }
1582 1582
1583 // Test that we return all credit card profile suggestions when the triggering 1583 // Test that we return all credit card profile suggestions when the triggering
1584 // field has stop characters in it, which should be removed. 1584 // field has stop characters in it, which should be removed.
1585 TEST_F(AutofillManagerTest, GetCreditCardSuggestions_StopCharsOnly) { 1585 TEST_F(AutofillManagerTest, GetCreditCardSuggestions_StopCharsOnly) {
1586 // Set up our form data. 1586 // Set up our form data.
1587 FormData form; 1587 FormData form;
1588 CreateTestCreditCardFormData(&form, true, false); 1588 CreateTestCreditCardFormData(&form, true, false);
1589 std::vector<FormData> forms(1, form); 1589 std::vector<FormData> forms(1, form);
1590 FormsSeen(forms); 1590 FormsSeen(forms);
1591 1591
1592 FormFieldData field = form.fields[1]; 1592 FormFieldData field = form.fields[1];
1593 field.value = ASCIIToUTF16("____-____-____-____"); 1593 field.value = ASCIIToUTF16("____-____-____-____");
1594 GetAutofillSuggestions(form, field); 1594 GetAutofillSuggestions(form, field);
1595 1595
1596 // Test that we sent the right values to the external delegate. 1596 // Test that we sent the right values to the external delegate.
1597 external_delegate_->CheckSuggestions( 1597 external_delegate_->CheckSuggestions(
1598 kDefaultPageID, Suggestion("Visa" + kUTF8MidlineEllipsis + "3456", 1598 kDefaultPageID, Suggestion("Visa" + kUTF8MidlineEllipsis + "3456",
1599 "04/99", kVisaCard, 1599 "04/99", kVisaCard,
1600 autofill_manager_->GetPackedCreditCardID(4)), 1600 autofill_manager_->GetPackedCreditCardID(4)),
1601 Suggestion("MasterCard" + kUTF8MidlineEllipsis + "8765", "10/98", 1601 Suggestion("Mastercard" + kUTF8MidlineEllipsis + "8765", "10/98",
1602 kMasterCard, autofill_manager_->GetPackedCreditCardID(5))); 1602 kMasterCard, autofill_manager_->GetPackedCreditCardID(5)));
1603 } 1603 }
1604 1604
1605 // Test that we return all credit card profile suggestions when the triggering 1605 // Test that we return all credit card profile suggestions when the triggering
1606 // field has stop characters in it and some input. 1606 // field has stop characters in it and some input.
1607 TEST_F(AutofillManagerTest, GetCreditCardSuggestions_StopCharsWithInput) { 1607 TEST_F(AutofillManagerTest, GetCreditCardSuggestions_StopCharsWithInput) {
1608 // Add a credit card with particular numbers that we will attempt to recall. 1608 // Add a credit card with particular numbers that we will attempt to recall.
1609 CreditCard credit_card; 1609 CreditCard credit_card;
1610 test::SetCreditCardInfo(&credit_card, "John Smith", 1610 test::SetCreditCardInfo(&credit_card, "John Smith",
1611 "5255667890123123", // Mastercard 1611 "5255667890123123", // Mastercard
1612 "08", "2017"); 1612 "08", "2017");
1613 credit_card.set_guid("00000000-0000-0000-0000-000000000007"); 1613 credit_card.set_guid("00000000-0000-0000-0000-000000000007");
1614 autofill_manager_->AddCreditCard(credit_card); 1614 autofill_manager_->AddCreditCard(credit_card);
1615 1615
1616 // Set up our form data. 1616 // Set up our form data.
1617 FormData form; 1617 FormData form;
1618 CreateTestCreditCardFormData(&form, true, false); 1618 CreateTestCreditCardFormData(&form, true, false);
1619 std::vector<FormData> forms(1, form); 1619 std::vector<FormData> forms(1, form);
1620 FormsSeen(forms); 1620 FormsSeen(forms);
1621 1621
1622 FormFieldData field = form.fields[1]; 1622 FormFieldData field = form.fields[1];
1623 1623
1624 field.value = ASCIIToUTF16("5255-66__-____-____"); 1624 field.value = ASCIIToUTF16("5255-66__-____-____");
1625 GetAutofillSuggestions(form, field); 1625 GetAutofillSuggestions(form, field);
1626 1626
1627 // Test that we sent the right value to the external delegate. 1627 // Test that we sent the right value to the external delegate.
1628 external_delegate_->CheckSuggestions( 1628 external_delegate_->CheckSuggestions(
1629 kDefaultPageID, Suggestion("MasterCard" + kUTF8MidlineEllipsis + "3123", 1629 kDefaultPageID, Suggestion("Mastercard" + kUTF8MidlineEllipsis + "3123",
1630 "08/17", kMasterCard, 1630 "08/17", kMasterCard,
1631 autofill_manager_->GetPackedCreditCardID(7))); 1631 autofill_manager_->GetPackedCreditCardID(7)));
1632 } 1632 }
1633 1633
1634 // Test that we return only matching credit card profile suggestions when the 1634 // Test that we return only matching credit card profile suggestions when the
1635 // selected form field has been partially filled out. 1635 // selected form field has been partially filled out.
1636 TEST_F(AutofillManagerTest, GetCreditCardSuggestions_MatchCharacter) { 1636 TEST_F(AutofillManagerTest, GetCreditCardSuggestions_MatchCharacter) {
1637 // Set up our form data. 1637 // Set up our form data.
1638 FormData form; 1638 FormData form;
1639 CreateTestCreditCardFormData(&form, true, false); 1639 CreateTestCreditCardFormData(&form, true, false);
(...skipping 20 matching lines...) Expand all
1660 std::vector<FormData> forms(1, form); 1660 std::vector<FormData> forms(1, form);
1661 FormsSeen(forms); 1661 FormsSeen(forms);
1662 1662
1663 const FormFieldData& field = form.fields[0]; 1663 const FormFieldData& field = form.fields[0];
1664 GetAutofillSuggestions(form, field); 1664 GetAutofillSuggestions(form, field);
1665 1665
1666 #if defined(OS_ANDROID) 1666 #if defined(OS_ANDROID)
1667 static const std::string kVisaSuggestion = 1667 static const std::string kVisaSuggestion =
1668 "Visa" + kUTF8MidlineEllipsis + "3456"; 1668 "Visa" + kUTF8MidlineEllipsis + "3456";
1669 static const std::string kMcSuggestion = 1669 static const std::string kMcSuggestion =
1670 "MasterCard" + kUTF8MidlineEllipsis + "8765"; 1670 "Mastercard" + kUTF8MidlineEllipsis + "8765";
1671 #else 1671 #else
1672 static const std::string kVisaSuggestion = "*3456"; 1672 static const std::string kVisaSuggestion = "*3456";
1673 static const std::string kMcSuggestion = "*8765"; 1673 static const std::string kMcSuggestion = "*8765";
1674 #endif 1674 #endif
1675 1675
1676 // Test that we sent the right values to the external delegate. 1676 // Test that we sent the right values to the external delegate.
1677 external_delegate_->CheckSuggestions( 1677 external_delegate_->CheckSuggestions(
1678 kDefaultPageID, 1678 kDefaultPageID,
1679 Suggestion("Elvis Presley", kVisaSuggestion, kVisaCard, 1679 Suggestion("Elvis Presley", kVisaSuggestion, kVisaCard,
1680 autofill_manager_->GetPackedCreditCardID(4)), 1680 autofill_manager_->GetPackedCreditCardID(4)),
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
1763 FormsSeen(forms); 1763 FormsSeen(forms);
1764 1764
1765 FormFieldData field = form.fields[1]; 1765 FormFieldData field = form.fields[1];
1766 GetAutofillSuggestions(form, field); 1766 GetAutofillSuggestions(form, field);
1767 1767
1768 // Test that we sent the right values to the external delegate. 1768 // Test that we sent the right values to the external delegate.
1769 external_delegate_->CheckSuggestions( 1769 external_delegate_->CheckSuggestions(
1770 kDefaultPageID, Suggestion("Visa" + kUTF8MidlineEllipsis + "3456", 1770 kDefaultPageID, Suggestion("Visa" + kUTF8MidlineEllipsis + "3456",
1771 "04/99", kVisaCard, 1771 "04/99", kVisaCard,
1772 autofill_manager_->GetPackedCreditCardID(4)), 1772 autofill_manager_->GetPackedCreditCardID(4)),
1773 Suggestion("MasterCard" + kUTF8MidlineEllipsis + "8765", "10/98", 1773 Suggestion("Mastercard" + kUTF8MidlineEllipsis + "8765", "10/98",
1774 kMasterCard, autofill_manager_->GetPackedCreditCardID(5))); 1774 kMasterCard, autofill_manager_->GetPackedCreditCardID(5)));
1775 } 1775 }
1776 1776
1777 // Test that we will eventually return the credit card signin promo when there 1777 // Test that we will eventually return the credit card signin promo when there
1778 // are no credit card suggestions and the promo is active. See the tests in 1778 // are no credit card suggestions and the promo is active. See the tests in
1779 // AutofillExternalDelegateTest that test whether the promo is added. 1779 // AutofillExternalDelegateTest that test whether the promo is added.
1780 TEST_F(AutofillManagerTest, GetCreditCardSuggestions_OnlySigninPromo) { 1780 TEST_F(AutofillManagerTest, GetCreditCardSuggestions_OnlySigninPromo) {
1781 // Make sure there are no credit cards. 1781 // Make sure there are no credit cards.
1782 personal_data_.ClearCreditCards(); 1782 personal_data_.ClearCreditCards();
1783 1783
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
1848 FormsSeen(forms); 1848 FormsSeen(forms);
1849 1849
1850 FormFieldData field = form.fields[1]; 1850 FormFieldData field = form.fields[1];
1851 GetAutofillSuggestions(form, field); 1851 GetAutofillSuggestions(form, field);
1852 1852
1853 // Test that we sent the right values to the external delegate. 1853 // Test that we sent the right values to the external delegate.
1854 external_delegate_->CheckSuggestions( 1854 external_delegate_->CheckSuggestions(
1855 kDefaultPageID, Suggestion("Visa" + kUTF8MidlineEllipsis + "3456", 1855 kDefaultPageID, Suggestion("Visa" + kUTF8MidlineEllipsis + "3456",
1856 "04/99", kVisaCard, 1856 "04/99", kVisaCard,
1857 autofill_manager_->GetPackedCreditCardID(4)), 1857 autofill_manager_->GetPackedCreditCardID(4)),
1858 Suggestion("MasterCard" + kUTF8MidlineEllipsis + "8765", "10/98", 1858 Suggestion("Mastercard" + kUTF8MidlineEllipsis + "8765", "10/98",
1859 kMasterCard, autofill_manager_->GetPackedCreditCardID(5))); 1859 kMasterCard, autofill_manager_->GetPackedCreditCardID(5)));
1860 } 1860 }
1861 1861
1862 // Test that we return credit card suggestions for secure pages that have a 1862 // Test that we return credit card suggestions for secure pages that have a
1863 // form action set to "javascript:something". 1863 // form action set to "javascript:something".
1864 TEST_F(AutofillManagerTest, 1864 TEST_F(AutofillManagerTest,
1865 GetCreditCardSuggestions_SecureContext_JavascriptFormAction) { 1865 GetCreditCardSuggestions_SecureContext_JavascriptFormAction) {
1866 // Set up our form data. 1866 // Set up our form data.
1867 FormData form; 1867 FormData form;
1868 CreateTestCreditCardFormData(&form, true, false); 1868 CreateTestCreditCardFormData(&form, true, false);
1869 // Have the form action be a javascript function (which is a valid URL). 1869 // Have the form action be a javascript function (which is a valid URL).
1870 form.action = GURL("javascript:alert('Hello');"); 1870 form.action = GURL("javascript:alert('Hello');");
1871 std::vector<FormData> forms(1, form); 1871 std::vector<FormData> forms(1, form);
1872 FormsSeen(forms); 1872 FormsSeen(forms);
1873 1873
1874 FormFieldData field = form.fields[1]; 1874 FormFieldData field = form.fields[1];
1875 GetAutofillSuggestions(form, field); 1875 GetAutofillSuggestions(form, field);
1876 1876
1877 // Test that we sent the right values to the external delegate. 1877 // Test that we sent the right values to the external delegate.
1878 external_delegate_->CheckSuggestions( 1878 external_delegate_->CheckSuggestions(
1879 kDefaultPageID, Suggestion("Visa" + kUTF8MidlineEllipsis + "3456", 1879 kDefaultPageID, Suggestion("Visa" + kUTF8MidlineEllipsis + "3456",
1880 "04/99", kVisaCard, 1880 "04/99", kVisaCard,
1881 autofill_manager_->GetPackedCreditCardID(4)), 1881 autofill_manager_->GetPackedCreditCardID(4)),
1882 Suggestion("MasterCard" + kUTF8MidlineEllipsis + "8765", "10/98", 1882 Suggestion("Mastercard" + kUTF8MidlineEllipsis + "8765", "10/98",
1883 kMasterCard, autofill_manager_->GetPackedCreditCardID(5))); 1883 kMasterCard, autofill_manager_->GetPackedCreditCardID(5)));
1884 } 1884 }
1885 1885
1886 // Test that we return all credit card suggestions in the case that two cards 1886 // Test that we return all credit card suggestions in the case that two cards
1887 // have the same obfuscated number. 1887 // have the same obfuscated number.
1888 TEST_F(AutofillManagerTest, GetCreditCardSuggestions_RepeatedObfuscatedNumber) { 1888 TEST_F(AutofillManagerTest, GetCreditCardSuggestions_RepeatedObfuscatedNumber) {
1889 // Add a credit card with the same obfuscated number as Elvis's. 1889 // Add a credit card with the same obfuscated number as Elvis's.
1890 // |credit_card| will be owned by the mock PersonalDataManager. 1890 // |credit_card| will be owned by the mock PersonalDataManager.
1891 CreditCard credit_card; 1891 CreditCard credit_card;
1892 test::SetCreditCardInfo(&credit_card, "Elvis Presley", 1892 test::SetCreditCardInfo(&credit_card, "Elvis Presley",
(...skipping 10 matching lines...) Expand all
1903 FormsSeen(forms); 1903 FormsSeen(forms);
1904 1904
1905 FormFieldData field = form.fields[1]; 1905 FormFieldData field = form.fields[1];
1906 GetAutofillSuggestions(form, field); 1906 GetAutofillSuggestions(form, field);
1907 1907
1908 // Test that we sent the right values to the external delegate. 1908 // Test that we sent the right values to the external delegate.
1909 external_delegate_->CheckSuggestions( 1909 external_delegate_->CheckSuggestions(
1910 kDefaultPageID, Suggestion("Visa" + kUTF8MidlineEllipsis + "3456", 1910 kDefaultPageID, Suggestion("Visa" + kUTF8MidlineEllipsis + "3456",
1911 "04/99", kVisaCard, 1911 "04/99", kVisaCard,
1912 autofill_manager_->GetPackedCreditCardID(4)), 1912 autofill_manager_->GetPackedCreditCardID(4)),
1913 Suggestion("MasterCard" + kUTF8MidlineEllipsis + "8765", "10/98", 1913 Suggestion("Mastercard" + kUTF8MidlineEllipsis + "8765", "10/98",
1914 kMasterCard, autofill_manager_->GetPackedCreditCardID(5)), 1914 kMasterCard, autofill_manager_->GetPackedCreditCardID(5)),
1915 Suggestion("MasterCard" + kUTF8MidlineEllipsis + "3456", "05/99", 1915 Suggestion("Mastercard" + kUTF8MidlineEllipsis + "3456", "05/99",
1916 kMasterCard, autofill_manager_->GetPackedCreditCardID(7))); 1916 kMasterCard, autofill_manager_->GetPackedCreditCardID(7)));
1917 } 1917 }
1918 1918
1919 // Test that we return profile and credit card suggestions for combined forms. 1919 // Test that we return profile and credit card suggestions for combined forms.
1920 TEST_F(AutofillManagerTest, GetAddressAndCreditCardSuggestions) { 1920 TEST_F(AutofillManagerTest, GetAddressAndCreditCardSuggestions) {
1921 // Set up our form data. 1921 // Set up our form data.
1922 FormData form; 1922 FormData form;
1923 test::CreateTestAddressFormData(&form); 1923 test::CreateTestAddressFormData(&form);
1924 CreateTestCreditCardFormData(&form, true, false); 1924 CreateTestCreditCardFormData(&form, true, false);
1925 std::vector<FormData> forms(1, form); 1925 std::vector<FormData> forms(1, form);
1926 FormsSeen(forms); 1926 FormsSeen(forms);
1927 1927
1928 FormFieldData field = form.fields[0]; 1928 FormFieldData field = form.fields[0];
1929 GetAutofillSuggestions(form, field); 1929 GetAutofillSuggestions(form, field);
1930 1930
1931 // Test that we sent the right address suggestions to the external delegate. 1931 // Test that we sent the right address suggestions to the external delegate.
1932 external_delegate_->CheckSuggestions( 1932 external_delegate_->CheckSuggestions(
1933 kDefaultPageID, Suggestion("Charles", "123 Apple St.", "", 1), 1933 kDefaultPageID, Suggestion("Charles", "123 Apple St.", "", 1),
1934 Suggestion("Elvis", "3734 Elvis Presley Blvd.", "", 2)); 1934 Suggestion("Elvis", "3734 Elvis Presley Blvd.", "", 2));
1935 1935
1936 const int kPageID2 = 2; 1936 const int kPageID2 = 2;
1937 test::CreateTestFormField("Card Number", "cardnumber", "", "text", &field); 1937 test::CreateTestFormField("Card Number", "cardnumber", "", "text", &field);
1938 GetAutofillSuggestions(kPageID2, form, field); 1938 GetAutofillSuggestions(kPageID2, form, field);
1939 1939
1940 // Test that we sent the credit card suggestions to the external delegate. 1940 // Test that we sent the credit card suggestions to the external delegate.
1941 external_delegate_->CheckSuggestions( 1941 external_delegate_->CheckSuggestions(
1942 kPageID2, Suggestion("Visa" + kUTF8MidlineEllipsis + "3456", 1942 kPageID2, Suggestion("Visa" + kUTF8MidlineEllipsis + "3456",
1943 "04/99", kVisaCard, 1943 "04/99", kVisaCard,
1944 autofill_manager_->GetPackedCreditCardID(4)), 1944 autofill_manager_->GetPackedCreditCardID(4)),
1945 Suggestion("MasterCard" + kUTF8MidlineEllipsis + "8765", "10/98", 1945 Suggestion("Mastercard" + kUTF8MidlineEllipsis + "8765", "10/98",
1946 kMasterCard, autofill_manager_->GetPackedCreditCardID(5))); 1946 kMasterCard, autofill_manager_->GetPackedCreditCardID(5)));
1947 } 1947 }
1948 1948
1949 // Test that for non-https forms with both address and credit card fields, we 1949 // Test that for non-https forms with both address and credit card fields, we
1950 // only return address suggestions. Instead of credit card suggestions, we 1950 // only return address suggestions. Instead of credit card suggestions, we
1951 // should return a warning explaining that credit card profile suggestions are 1951 // should return a warning explaining that credit card profile suggestions are
1952 // unavailable when the form is not https. 1952 // unavailable when the form is not https.
1953 TEST_F(AutofillManagerTest, GetAddressAndCreditCardSuggestionsNonHttps) { 1953 TEST_F(AutofillManagerTest, GetAddressAndCreditCardSuggestionsNonHttps) {
1954 // Set up our form data. 1954 // Set up our form data.
1955 FormData form; 1955 FormData form;
(...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after
2641 FormData form; 2641 FormData form;
2642 form.name = ASCIIToUTF16("MyForm"); 2642 form.name = ASCIIToUTF16("MyForm");
2643 form.origin = GURL("https://myform.com/form.html"); 2643 form.origin = GURL("https://myform.com/form.html");
2644 form.action = GURL("https://myform.com/submit.html"); 2644 form.action = GURL("https://myform.com/submit.html");
2645 2645
2646 // Create a credit card form. 2646 // Create a credit card form.
2647 FormFieldData field; 2647 FormFieldData field;
2648 test::CreateTestFormField("Name on Card", "nameoncard", "", "text", &field); 2648 test::CreateTestFormField("Name on Card", "nameoncard", "", "text", &field);
2649 field.autocomplete_attribute = "cc-name"; 2649 field.autocomplete_attribute = "cc-name";
2650 form.fields.push_back(field); 2650 form.fields.push_back(field);
2651 std::vector<const char*> kCreditCardTypes = {"Visa", "Master Card", "AmEx", 2651 std::vector<const char*> kCreditCardTypes = {"Visa", "Mastercard", "AmEx",
Jared Saul 2017/04/18 18:24:19 Should this stay "Master card"? Looks like "disco
jiahuiguo 2017/04/18 20:58:51 Done.
2652 "discover"}; 2652 "discover"};
2653 test::CreateTestSelectField("Card Type", "cardtype", "", kCreditCardTypes, 2653 test::CreateTestSelectField("Card Type", "cardtype", "", kCreditCardTypes,
2654 kCreditCardTypes, 4, &field); 2654 kCreditCardTypes, 4, &field);
2655 field.autocomplete_attribute = "cc-type"; 2655 field.autocomplete_attribute = "cc-type";
2656 form.fields.push_back(field); 2656 form.fields.push_back(field);
2657 test::CreateTestFormField("Card Number", "cardnumber", "", "text", &field); 2657 test::CreateTestFormField("Card Number", "cardnumber", "", "text", &field);
2658 field.autocomplete_attribute = "cc-number"; 2658 field.autocomplete_attribute = "cc-number";
2659 form.fields.push_back(field); 2659 form.fields.push_back(field);
2660 test::CreateTestFormField("Expiration Month", "ccmonth", "", "text", &field); 2660 test::CreateTestFormField("Expiration Month", "ccmonth", "", "text", &field);
2661 field.autocomplete_attribute = "cc-exp-month"; 2661 field.autocomplete_attribute = "cc-exp-month";
(...skipping 3419 matching lines...) Expand 10 before | Expand all | Expand 10 after
6081 autofill_manager_->StartUploadProcess(std::move(form_structure), 6081 autofill_manager_->StartUploadProcess(std::move(form_structure),
6082 base::TimeTicks::Now(), true); 6082 base::TimeTicks::Now(), true);
6083 6083
6084 // Wait for upload to complete (will check expected types as well). 6084 // Wait for upload to complete (will check expected types as well).
6085 autofill_manager_->WaitForAsyncUploadProcess(); 6085 autofill_manager_->WaitForAsyncUploadProcess();
6086 6086
6087 EXPECT_EQ(signature, autofill_manager_->GetSubmittedFormSignature()); 6087 EXPECT_EQ(signature, autofill_manager_->GetSubmittedFormSignature());
6088 } 6088 }
6089 6089
6090 } // namespace autofill 6090 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/core/browser/autofill_field_unittest.cc ('k') | components/autofill/core/browser/credit_card.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698