| OLD | NEW |
| 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 <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/guid.h" | 8 #include "base/guid.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 589 form.fields.push_back(field); | 589 form.fields.push_back(field); |
| 590 test::CreateTestFormField( | 590 test::CreateTestFormField( |
| 591 "Address:", "address1", "21 Laussat St", "text", &field); | 591 "Address:", "address1", "21 Laussat St", "text", &field); |
| 592 form.fields.push_back(field); | 592 form.fields.push_back(field); |
| 593 test::CreateTestFormField("City:", "city", "San Francisco", "text", &field); | 593 test::CreateTestFormField("City:", "city", "San Francisco", "text", &field); |
| 594 form.fields.push_back(field); | 594 form.fields.push_back(field); |
| 595 test::CreateTestFormField("State:", "state", "California", "text", &field); | 595 test::CreateTestFormField("State:", "state", "California", "text", &field); |
| 596 form.fields.push_back(field); | 596 form.fields.push_back(field); |
| 597 test::CreateTestFormField("Zip:", "zip", "94102", "text", &field); | 597 test::CreateTestFormField("Zip:", "zip", "94102", "text", &field); |
| 598 form.fields.push_back(field); | 598 form.fields.push_back(field); |
| 599 FormStructure form_structure(form, std::string()); | 599 FormStructure form_structure(form); |
| 600 form_structure.DetermineHeuristicTypes(TestAutofillMetrics()); | 600 form_structure.DetermineHeuristicTypes(TestAutofillMetrics()); |
| 601 const CreditCard* imported_credit_card; | 601 const CreditCard* imported_credit_card; |
| 602 EXPECT_TRUE(personal_data_->ImportFormData(form_structure, | 602 EXPECT_TRUE(personal_data_->ImportFormData(form_structure, |
| 603 &imported_credit_card)); | 603 &imported_credit_card)); |
| 604 ASSERT_FALSE(imported_credit_card); | 604 ASSERT_FALSE(imported_credit_card); |
| 605 | 605 |
| 606 // Verify that the web database has been updated and the notification sent. | 606 // Verify that the web database has been updated and the notification sent. |
| 607 EXPECT_CALL(personal_data_observer_, | 607 EXPECT_CALL(personal_data_observer_, |
| 608 OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); | 608 OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); |
| 609 base::MessageLoop::current()->Run(); | 609 base::MessageLoop::current()->Run(); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 630 form.fields.push_back(field); | 630 form.fields.push_back(field); |
| 631 test::CreateTestFormField( | 631 test::CreateTestFormField( |
| 632 "Address:", "address1", "21 Laussat St", "text", &field); | 632 "Address:", "address1", "21 Laussat St", "text", &field); |
| 633 form.fields.push_back(field); | 633 form.fields.push_back(field); |
| 634 test::CreateTestFormField("City:", "city", "San Francisco", "text", &field); | 634 test::CreateTestFormField("City:", "city", "San Francisco", "text", &field); |
| 635 form.fields.push_back(field); | 635 form.fields.push_back(field); |
| 636 test::CreateTestFormField("State:", "state", "California", "text", &field); | 636 test::CreateTestFormField("State:", "state", "California", "text", &field); |
| 637 form.fields.push_back(field); | 637 form.fields.push_back(field); |
| 638 test::CreateTestFormField("Zip:", "zip", "94102", "text", &field); | 638 test::CreateTestFormField("Zip:", "zip", "94102", "text", &field); |
| 639 form.fields.push_back(field); | 639 form.fields.push_back(field); |
| 640 FormStructure form_structure(form, std::string()); | 640 FormStructure form_structure(form); |
| 641 form_structure.DetermineHeuristicTypes(TestAutofillMetrics()); | 641 form_structure.DetermineHeuristicTypes(TestAutofillMetrics()); |
| 642 const CreditCard* imported_credit_card; | 642 const CreditCard* imported_credit_card; |
| 643 EXPECT_FALSE(personal_data_->ImportFormData(form_structure, | 643 EXPECT_FALSE(personal_data_->ImportFormData(form_structure, |
| 644 &imported_credit_card)); | 644 &imported_credit_card)); |
| 645 ASSERT_EQ(static_cast<CreditCard*>(NULL), imported_credit_card); | 645 ASSERT_EQ(static_cast<CreditCard*>(NULL), imported_credit_card); |
| 646 | 646 |
| 647 const std::vector<AutofillProfile*>& results = personal_data_->GetProfiles(); | 647 const std::vector<AutofillProfile*>& results = personal_data_->GetProfiles(); |
| 648 ASSERT_EQ(0U, results.size()); | 648 ASSERT_EQ(0U, results.size()); |
| 649 } | 649 } |
| 650 | 650 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 663 test::CreateTestFormField("State:", "state", "California", "text", &field); | 663 test::CreateTestFormField("State:", "state", "California", "text", &field); |
| 664 form.fields.push_back(field); | 664 form.fields.push_back(field); |
| 665 test::CreateTestFormField("Zip:", "zip", "94102", "text", &field); | 665 test::CreateTestFormField("Zip:", "zip", "94102", "text", &field); |
| 666 form.fields.push_back(field); | 666 form.fields.push_back(field); |
| 667 test::CreateTestFormField( | 667 test::CreateTestFormField( |
| 668 "Email:", "email", "example@example.com", "text", &field); | 668 "Email:", "email", "example@example.com", "text", &field); |
| 669 form.fields.push_back(field); | 669 form.fields.push_back(field); |
| 670 test::CreateTestFormField( | 670 test::CreateTestFormField( |
| 671 "Confirm email:", "confirm_email", "example@example.com", "text", &field); | 671 "Confirm email:", "confirm_email", "example@example.com", "text", &field); |
| 672 form.fields.push_back(field); | 672 form.fields.push_back(field); |
| 673 FormStructure form_structure(form, std::string()); | 673 FormStructure form_structure(form); |
| 674 form_structure.DetermineHeuristicTypes(TestAutofillMetrics()); | 674 form_structure.DetermineHeuristicTypes(TestAutofillMetrics()); |
| 675 const CreditCard* imported_credit_card; | 675 const CreditCard* imported_credit_card; |
| 676 EXPECT_TRUE(personal_data_->ImportFormData(form_structure, | 676 EXPECT_TRUE(personal_data_->ImportFormData(form_structure, |
| 677 &imported_credit_card)); | 677 &imported_credit_card)); |
| 678 const std::vector<AutofillProfile*>& results = personal_data_->GetProfiles(); | 678 const std::vector<AutofillProfile*>& results = personal_data_->GetProfiles(); |
| 679 ASSERT_EQ(1U, results.size()); | 679 ASSERT_EQ(1U, results.size()); |
| 680 } | 680 } |
| 681 | 681 |
| 682 // Tests two email fields containing different values blocks provile import. | 682 // Tests two email fields containing different values blocks provile import. |
| 683 TEST_F(PersonalDataManagerTest, ImportFormDataTwoDifferentEmails) { | 683 TEST_F(PersonalDataManagerTest, ImportFormDataTwoDifferentEmails) { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 694 test::CreateTestFormField("State:", "state", "California", "text", &field); | 694 test::CreateTestFormField("State:", "state", "California", "text", &field); |
| 695 form.fields.push_back(field); | 695 form.fields.push_back(field); |
| 696 test::CreateTestFormField("Zip:", "zip", "94102", "text", &field); | 696 test::CreateTestFormField("Zip:", "zip", "94102", "text", &field); |
| 697 form.fields.push_back(field); | 697 form.fields.push_back(field); |
| 698 test::CreateTestFormField( | 698 test::CreateTestFormField( |
| 699 "Email:", "email", "example@example.com", "text", &field); | 699 "Email:", "email", "example@example.com", "text", &field); |
| 700 form.fields.push_back(field); | 700 form.fields.push_back(field); |
| 701 test::CreateTestFormField( | 701 test::CreateTestFormField( |
| 702 "Email:", "email2", "example2@example.com", "text", &field); | 702 "Email:", "email2", "example2@example.com", "text", &field); |
| 703 form.fields.push_back(field); | 703 form.fields.push_back(field); |
| 704 FormStructure form_structure(form, std::string()); | 704 FormStructure form_structure(form); |
| 705 form_structure.DetermineHeuristicTypes(TestAutofillMetrics()); | 705 form_structure.DetermineHeuristicTypes(TestAutofillMetrics()); |
| 706 const CreditCard* imported_credit_card; | 706 const CreditCard* imported_credit_card; |
| 707 EXPECT_FALSE(personal_data_->ImportFormData(form_structure, | 707 EXPECT_FALSE(personal_data_->ImportFormData(form_structure, |
| 708 &imported_credit_card)); | 708 &imported_credit_card)); |
| 709 const std::vector<AutofillProfile*>& results = personal_data_->GetProfiles(); | 709 const std::vector<AutofillProfile*>& results = personal_data_->GetProfiles(); |
| 710 ASSERT_EQ(0U, results.size()); | 710 ASSERT_EQ(0U, results.size()); |
| 711 } | 711 } |
| 712 | 712 |
| 713 TEST_F(PersonalDataManagerTest, ImportFormDataNotEnoughFilledFields) { | 713 TEST_F(PersonalDataManagerTest, ImportFormDataNotEnoughFilledFields) { |
| 714 FormData form; | 714 FormData form; |
| 715 FormFieldData field; | 715 FormFieldData field; |
| 716 test::CreateTestFormField( | 716 test::CreateTestFormField( |
| 717 "First name:", "first_name", "George", "text", &field); | 717 "First name:", "first_name", "George", "text", &field); |
| 718 form.fields.push_back(field); | 718 form.fields.push_back(field); |
| 719 test::CreateTestFormField( | 719 test::CreateTestFormField( |
| 720 "Last name:", "last_name", "Washington", "text", &field); | 720 "Last name:", "last_name", "Washington", "text", &field); |
| 721 form.fields.push_back(field); | 721 form.fields.push_back(field); |
| 722 test::CreateTestFormField( | 722 test::CreateTestFormField( |
| 723 "Card number:", "card_number", "4111 1111 1111 1111", "text", &field); | 723 "Card number:", "card_number", "4111 1111 1111 1111", "text", &field); |
| 724 form.fields.push_back(field); | 724 form.fields.push_back(field); |
| 725 FormStructure form_structure(form, std::string()); | 725 FormStructure form_structure(form); |
| 726 form_structure.DetermineHeuristicTypes(TestAutofillMetrics()); | 726 form_structure.DetermineHeuristicTypes(TestAutofillMetrics()); |
| 727 const CreditCard* imported_credit_card; | 727 const CreditCard* imported_credit_card; |
| 728 EXPECT_FALSE(personal_data_->ImportFormData(form_structure, | 728 EXPECT_FALSE(personal_data_->ImportFormData(form_structure, |
| 729 &imported_credit_card)); | 729 &imported_credit_card)); |
| 730 ASSERT_FALSE(imported_credit_card); | 730 ASSERT_FALSE(imported_credit_card); |
| 731 | 731 |
| 732 const std::vector<AutofillProfile*>& profiles = personal_data_->GetProfiles(); | 732 const std::vector<AutofillProfile*>& profiles = personal_data_->GetProfiles(); |
| 733 ASSERT_EQ(0U, profiles.size()); | 733 ASSERT_EQ(0U, profiles.size()); |
| 734 const std::vector<CreditCard*>& cards = personal_data_->GetCreditCards(); | 734 const std::vector<CreditCard*>& cards = personal_data_->GetCreditCards(); |
| 735 ASSERT_EQ(0U, cards.size()); | 735 ASSERT_EQ(0U, cards.size()); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 746 "Address:", "address", "1600 Pennsylvania Avenue", "text", &field); | 746 "Address:", "address", "1600 Pennsylvania Avenue", "text", &field); |
| 747 form.fields.push_back(field); | 747 form.fields.push_back(field); |
| 748 test::CreateTestFormField("City:", "city", "Washington", "text", &field); | 748 test::CreateTestFormField("City:", "city", "Washington", "text", &field); |
| 749 form.fields.push_back(field); | 749 form.fields.push_back(field); |
| 750 test::CreateTestFormField("State:", "state", "DC", "text", &field); | 750 test::CreateTestFormField("State:", "state", "DC", "text", &field); |
| 751 form.fields.push_back(field); | 751 form.fields.push_back(field); |
| 752 test::CreateTestFormField("Zip:", "zip", "20500", "text", &field); | 752 test::CreateTestFormField("Zip:", "zip", "20500", "text", &field); |
| 753 form.fields.push_back(field); | 753 form.fields.push_back(field); |
| 754 test::CreateTestFormField("Country:", "country", "USA", "text", &field); | 754 test::CreateTestFormField("Country:", "country", "USA", "text", &field); |
| 755 form.fields.push_back(field); | 755 form.fields.push_back(field); |
| 756 FormStructure form_structure(form, std::string()); | 756 FormStructure form_structure(form); |
| 757 form_structure.DetermineHeuristicTypes(TestAutofillMetrics()); | 757 form_structure.DetermineHeuristicTypes(TestAutofillMetrics()); |
| 758 const CreditCard* imported_credit_card; | 758 const CreditCard* imported_credit_card; |
| 759 EXPECT_TRUE(personal_data_->ImportFormData(form_structure, | 759 EXPECT_TRUE(personal_data_->ImportFormData(form_structure, |
| 760 &imported_credit_card)); | 760 &imported_credit_card)); |
| 761 const std::vector<AutofillProfile*>& profiles = personal_data_->GetProfiles(); | 761 const std::vector<AutofillProfile*>& profiles = personal_data_->GetProfiles(); |
| 762 ASSERT_EQ(1U, profiles.size()); | 762 ASSERT_EQ(1U, profiles.size()); |
| 763 } | 763 } |
| 764 | 764 |
| 765 TEST_F(PersonalDataManagerTest, ImportFormMinimumAddressGB) { | 765 TEST_F(PersonalDataManagerTest, ImportFormMinimumAddressGB) { |
| 766 // British addresses do not require a state/province as the county is usually | 766 // British addresses do not require a state/province as the county is usually |
| 767 // not requested on forms. | 767 // not requested on forms. |
| 768 FormData form; | 768 FormData form; |
| 769 FormFieldData field; | 769 FormFieldData field; |
| 770 test::CreateTestFormField("Name:", "name", "David Cameron", "text", &field); | 770 test::CreateTestFormField("Name:", "name", "David Cameron", "text", &field); |
| 771 form.fields.push_back(field); | 771 form.fields.push_back(field); |
| 772 test::CreateTestFormField( | 772 test::CreateTestFormField( |
| 773 "Address:", "address", "10 Downing Street", "text", &field); | 773 "Address:", "address", "10 Downing Street", "text", &field); |
| 774 form.fields.push_back(field); | 774 form.fields.push_back(field); |
| 775 test::CreateTestFormField("City:", "city", "London", "text", &field); | 775 test::CreateTestFormField("City:", "city", "London", "text", &field); |
| 776 form.fields.push_back(field); | 776 form.fields.push_back(field); |
| 777 test::CreateTestFormField( | 777 test::CreateTestFormField( |
| 778 "Postcode:", "postcode", "SW1A 2AA", "text", &field); | 778 "Postcode:", "postcode", "SW1A 2AA", "text", &field); |
| 779 form.fields.push_back(field); | 779 form.fields.push_back(field); |
| 780 test::CreateTestFormField( | 780 test::CreateTestFormField( |
| 781 "Country:", "country", "United Kingdom", "text", &field); | 781 "Country:", "country", "United Kingdom", "text", &field); |
| 782 form.fields.push_back(field); | 782 form.fields.push_back(field); |
| 783 FormStructure form_structure(form, std::string()); | 783 FormStructure form_structure(form); |
| 784 form_structure.DetermineHeuristicTypes(TestAutofillMetrics()); | 784 form_structure.DetermineHeuristicTypes(TestAutofillMetrics()); |
| 785 const CreditCard* imported_credit_card; | 785 const CreditCard* imported_credit_card; |
| 786 EXPECT_TRUE(personal_data_->ImportFormData(form_structure, | 786 EXPECT_TRUE(personal_data_->ImportFormData(form_structure, |
| 787 &imported_credit_card)); | 787 &imported_credit_card)); |
| 788 const std::vector<AutofillProfile*>& profiles = personal_data_->GetProfiles(); | 788 const std::vector<AutofillProfile*>& profiles = personal_data_->GetProfiles(); |
| 789 ASSERT_EQ(1U, profiles.size()); | 789 ASSERT_EQ(1U, profiles.size()); |
| 790 } | 790 } |
| 791 | 791 |
| 792 TEST_F(PersonalDataManagerTest, ImportFormMinimumAddressGI) { | 792 TEST_F(PersonalDataManagerTest, ImportFormMinimumAddressGI) { |
| 793 // Gibraltar has the most minimal set of requirements for a valid address. | 793 // Gibraltar has the most minimal set of requirements for a valid address. |
| 794 // There are no cities or provinces and no postal/zip code system. | 794 // There are no cities or provinces and no postal/zip code system. |
| 795 FormData form; | 795 FormData form; |
| 796 FormFieldData field; | 796 FormFieldData field; |
| 797 test::CreateTestFormField( | 797 test::CreateTestFormField( |
| 798 "Name:", "name", "Sir Adrian Johns", "text", &field); | 798 "Name:", "name", "Sir Adrian Johns", "text", &field); |
| 799 form.fields.push_back(field); | 799 form.fields.push_back(field); |
| 800 test::CreateTestFormField( | 800 test::CreateTestFormField( |
| 801 "Address:", "address", "The Convent, Main Street", "text", &field); | 801 "Address:", "address", "The Convent, Main Street", "text", &field); |
| 802 form.fields.push_back(field); | 802 form.fields.push_back(field); |
| 803 test::CreateTestFormField("Country:", "country", "Gibraltar", "text", &field); | 803 test::CreateTestFormField("Country:", "country", "Gibraltar", "text", &field); |
| 804 form.fields.push_back(field); | 804 form.fields.push_back(field); |
| 805 FormStructure form_structure(form, std::string()); | 805 FormStructure form_structure(form); |
| 806 form_structure.DetermineHeuristicTypes(TestAutofillMetrics()); | 806 form_structure.DetermineHeuristicTypes(TestAutofillMetrics()); |
| 807 const CreditCard* imported_credit_card; | 807 const CreditCard* imported_credit_card; |
| 808 EXPECT_TRUE(personal_data_->ImportFormData(form_structure, | 808 EXPECT_TRUE(personal_data_->ImportFormData(form_structure, |
| 809 &imported_credit_card)); | 809 &imported_credit_card)); |
| 810 const std::vector<AutofillProfile*>& profiles = personal_data_->GetProfiles(); | 810 const std::vector<AutofillProfile*>& profiles = personal_data_->GetProfiles(); |
| 811 ASSERT_EQ(1U, profiles.size()); | 811 ASSERT_EQ(1U, profiles.size()); |
| 812 } | 812 } |
| 813 | 813 |
| 814 TEST_F(PersonalDataManagerTest, ImportPhoneNumberSplitAcrossMultipleFields) { | 814 TEST_F(PersonalDataManagerTest, ImportPhoneNumberSplitAcrossMultipleFields) { |
| 815 FormData form; | 815 FormData form; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 834 form.fields.push_back(field); | 834 form.fields.push_back(field); |
| 835 test::CreateTestFormField( | 835 test::CreateTestFormField( |
| 836 "Address:", "address1", "21 Laussat St", "text", &field); | 836 "Address:", "address1", "21 Laussat St", "text", &field); |
| 837 form.fields.push_back(field); | 837 form.fields.push_back(field); |
| 838 test::CreateTestFormField("City:", "city", "San Francisco", "text", &field); | 838 test::CreateTestFormField("City:", "city", "San Francisco", "text", &field); |
| 839 form.fields.push_back(field); | 839 form.fields.push_back(field); |
| 840 test::CreateTestFormField("State:", "state", "California", "text", &field); | 840 test::CreateTestFormField("State:", "state", "California", "text", &field); |
| 841 form.fields.push_back(field); | 841 form.fields.push_back(field); |
| 842 test::CreateTestFormField("Zip:", "zip", "94102", "text", &field); | 842 test::CreateTestFormField("Zip:", "zip", "94102", "text", &field); |
| 843 form.fields.push_back(field); | 843 form.fields.push_back(field); |
| 844 FormStructure form_structure(form, std::string()); | 844 FormStructure form_structure(form); |
| 845 form_structure.DetermineHeuristicTypes(TestAutofillMetrics()); | 845 form_structure.DetermineHeuristicTypes(TestAutofillMetrics()); |
| 846 const CreditCard* imported_credit_card; | 846 const CreditCard* imported_credit_card; |
| 847 EXPECT_TRUE(personal_data_->ImportFormData(form_structure, | 847 EXPECT_TRUE(personal_data_->ImportFormData(form_structure, |
| 848 &imported_credit_card)); | 848 &imported_credit_card)); |
| 849 ASSERT_FALSE(imported_credit_card); | 849 ASSERT_FALSE(imported_credit_card); |
| 850 | 850 |
| 851 // Verify that the web database has been updated and the notification sent. | 851 // Verify that the web database has been updated and the notification sent. |
| 852 EXPECT_CALL(personal_data_observer_, | 852 EXPECT_CALL(personal_data_observer_, |
| 853 OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); | 853 OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); |
| 854 base::MessageLoop::current()->Run(); | 854 base::MessageLoop::current()->Run(); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 914 test::CreateTestFormField( | 914 test::CreateTestFormField( |
| 915 "Address:", "address1", "21 Laussat St", "text", &field); | 915 "Address:", "address1", "21 Laussat St", "text", &field); |
| 916 form1.fields.push_back(field); | 916 form1.fields.push_back(field); |
| 917 test::CreateTestFormField("City:", "city", "San Francisco", "text", &field); | 917 test::CreateTestFormField("City:", "city", "San Francisco", "text", &field); |
| 918 form1.fields.push_back(field); | 918 form1.fields.push_back(field); |
| 919 test::CreateTestFormField("State:", "state", "California", "text", &field); | 919 test::CreateTestFormField("State:", "state", "California", "text", &field); |
| 920 form1.fields.push_back(field); | 920 form1.fields.push_back(field); |
| 921 test::CreateTestFormField("Zip:", "zip", "94102", "text", &field); | 921 test::CreateTestFormField("Zip:", "zip", "94102", "text", &field); |
| 922 form1.fields.push_back(field); | 922 form1.fields.push_back(field); |
| 923 | 923 |
| 924 FormStructure form_structure1(form1, std::string()); | 924 FormStructure form_structure1(form1); |
| 925 form_structure1.DetermineHeuristicTypes(TestAutofillMetrics()); | 925 form_structure1.DetermineHeuristicTypes(TestAutofillMetrics()); |
| 926 const CreditCard* imported_credit_card; | 926 const CreditCard* imported_credit_card; |
| 927 EXPECT_TRUE(personal_data_->ImportFormData(form_structure1, | 927 EXPECT_TRUE(personal_data_->ImportFormData(form_structure1, |
| 928 &imported_credit_card)); | 928 &imported_credit_card)); |
| 929 ASSERT_FALSE(imported_credit_card); | 929 ASSERT_FALSE(imported_credit_card); |
| 930 | 930 |
| 931 // Verify that the web database has been updated and the notification sent. | 931 // Verify that the web database has been updated and the notification sent. |
| 932 EXPECT_CALL(personal_data_observer_, | 932 EXPECT_CALL(personal_data_observer_, |
| 933 OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); | 933 OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); |
| 934 base::MessageLoop::current()->Run(); | 934 base::MessageLoop::current()->Run(); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 955 test::CreateTestFormField( | 955 test::CreateTestFormField( |
| 956 "Address:", "address1", "22 Laussat St", "text", &field); | 956 "Address:", "address1", "22 Laussat St", "text", &field); |
| 957 form2.fields.push_back(field); | 957 form2.fields.push_back(field); |
| 958 test::CreateTestFormField("City:", "city", "San Francisco", "text", &field); | 958 test::CreateTestFormField("City:", "city", "San Francisco", "text", &field); |
| 959 form2.fields.push_back(field); | 959 form2.fields.push_back(field); |
| 960 test::CreateTestFormField("State:", "state", "California", "text", &field); | 960 test::CreateTestFormField("State:", "state", "California", "text", &field); |
| 961 form2.fields.push_back(field); | 961 form2.fields.push_back(field); |
| 962 test::CreateTestFormField("Zip:", "zip", "94102", "text", &field); | 962 test::CreateTestFormField("Zip:", "zip", "94102", "text", &field); |
| 963 form2.fields.push_back(field); | 963 form2.fields.push_back(field); |
| 964 | 964 |
| 965 FormStructure form_structure2(form2, std::string()); | 965 FormStructure form_structure2(form2); |
| 966 form_structure2.DetermineHeuristicTypes(TestAutofillMetrics()); | 966 form_structure2.DetermineHeuristicTypes(TestAutofillMetrics()); |
| 967 EXPECT_TRUE(personal_data_->ImportFormData(form_structure2, | 967 EXPECT_TRUE(personal_data_->ImportFormData(form_structure2, |
| 968 &imported_credit_card)); | 968 &imported_credit_card)); |
| 969 ASSERT_FALSE(imported_credit_card); | 969 ASSERT_FALSE(imported_credit_card); |
| 970 | 970 |
| 971 // Verify that the web database has been updated and the notification sent. | 971 // Verify that the web database has been updated and the notification sent. |
| 972 EXPECT_CALL(personal_data_observer_, | 972 EXPECT_CALL(personal_data_observer_, |
| 973 OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); | 973 OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); |
| 974 base::MessageLoop::current()->Run(); | 974 base::MessageLoop::current()->Run(); |
| 975 | 975 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 999 test::CreateTestFormField( | 999 test::CreateTestFormField( |
| 1000 "Address:", "address1", "21 Laussat St", "text", &field); | 1000 "Address:", "address1", "21 Laussat St", "text", &field); |
| 1001 form1.fields.push_back(field); | 1001 form1.fields.push_back(field); |
| 1002 test::CreateTestFormField("City:", "city", "San Francisco", "text", &field); | 1002 test::CreateTestFormField("City:", "city", "San Francisco", "text", &field); |
| 1003 form1.fields.push_back(field); | 1003 form1.fields.push_back(field); |
| 1004 test::CreateTestFormField("State:", "state", "California", "text", &field); | 1004 test::CreateTestFormField("State:", "state", "California", "text", &field); |
| 1005 form1.fields.push_back(field); | 1005 form1.fields.push_back(field); |
| 1006 test::CreateTestFormField("Zip:", "zip", "94102", "text", &field); | 1006 test::CreateTestFormField("Zip:", "zip", "94102", "text", &field); |
| 1007 form1.fields.push_back(field); | 1007 form1.fields.push_back(field); |
| 1008 | 1008 |
| 1009 FormStructure form_structure1(form1, std::string()); | 1009 FormStructure form_structure1(form1); |
| 1010 form_structure1.DetermineHeuristicTypes(TestAutofillMetrics()); | 1010 form_structure1.DetermineHeuristicTypes(TestAutofillMetrics()); |
| 1011 const CreditCard* imported_credit_card; | 1011 const CreditCard* imported_credit_card; |
| 1012 EXPECT_TRUE(personal_data_->ImportFormData(form_structure1, | 1012 EXPECT_TRUE(personal_data_->ImportFormData(form_structure1, |
| 1013 &imported_credit_card)); | 1013 &imported_credit_card)); |
| 1014 ASSERT_FALSE(imported_credit_card); | 1014 ASSERT_FALSE(imported_credit_card); |
| 1015 | 1015 |
| 1016 // Verify that the web database has been updated and the notification sent. | 1016 // Verify that the web database has been updated and the notification sent. |
| 1017 EXPECT_CALL(personal_data_observer_, | 1017 EXPECT_CALL(personal_data_observer_, |
| 1018 OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); | 1018 OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); |
| 1019 base::MessageLoop::current()->Run(); | 1019 base::MessageLoop::current()->Run(); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1039 test::CreateTestFormField( | 1039 test::CreateTestFormField( |
| 1040 "Address:", "address1", "21 Laussat St", "text", &field); | 1040 "Address:", "address1", "21 Laussat St", "text", &field); |
| 1041 form2.fields.push_back(field); | 1041 form2.fields.push_back(field); |
| 1042 test::CreateTestFormField("City:", "city", "San Francisco", "text", &field); | 1042 test::CreateTestFormField("City:", "city", "San Francisco", "text", &field); |
| 1043 form2.fields.push_back(field); | 1043 form2.fields.push_back(field); |
| 1044 test::CreateTestFormField("State:", "state", "California", "text", &field); | 1044 test::CreateTestFormField("State:", "state", "California", "text", &field); |
| 1045 form2.fields.push_back(field); | 1045 form2.fields.push_back(field); |
| 1046 test::CreateTestFormField("Zip:", "zip", "94102", "text", &field); | 1046 test::CreateTestFormField("Zip:", "zip", "94102", "text", &field); |
| 1047 form2.fields.push_back(field); | 1047 form2.fields.push_back(field); |
| 1048 | 1048 |
| 1049 FormStructure form_structure2(form2, std::string()); | 1049 FormStructure form_structure2(form2); |
| 1050 form_structure2.DetermineHeuristicTypes(TestAutofillMetrics()); | 1050 form_structure2.DetermineHeuristicTypes(TestAutofillMetrics()); |
| 1051 EXPECT_TRUE(personal_data_->ImportFormData(form_structure2, | 1051 EXPECT_TRUE(personal_data_->ImportFormData(form_structure2, |
| 1052 &imported_credit_card)); | 1052 &imported_credit_card)); |
| 1053 ASSERT_FALSE(imported_credit_card); | 1053 ASSERT_FALSE(imported_credit_card); |
| 1054 | 1054 |
| 1055 // Verify that the web database has been updated and the notification sent. | 1055 // Verify that the web database has been updated and the notification sent. |
| 1056 EXPECT_CALL(personal_data_observer_, | 1056 EXPECT_CALL(personal_data_observer_, |
| 1057 OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); | 1057 OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); |
| 1058 base::MessageLoop::current()->Run(); | 1058 base::MessageLoop::current()->Run(); |
| 1059 | 1059 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1092 test::CreateTestFormField("State:", "state", "California", "text", &field); | 1092 test::CreateTestFormField("State:", "state", "California", "text", &field); |
| 1093 form1.fields.push_back(field); | 1093 form1.fields.push_back(field); |
| 1094 test::CreateTestFormField("Zip:", "zip", "94102", "text", &field); | 1094 test::CreateTestFormField("Zip:", "zip", "94102", "text", &field); |
| 1095 form1.fields.push_back(field); | 1095 form1.fields.push_back(field); |
| 1096 test::CreateTestFormField( | 1096 test::CreateTestFormField( |
| 1097 "Email:", "email", "theprez@gmail.com", "text", &field); | 1097 "Email:", "email", "theprez@gmail.com", "text", &field); |
| 1098 form1.fields.push_back(field); | 1098 form1.fields.push_back(field); |
| 1099 test::CreateTestFormField("Phone:", "phone", "6505556666", "text", &field); | 1099 test::CreateTestFormField("Phone:", "phone", "6505556666", "text", &field); |
| 1100 form1.fields.push_back(field); | 1100 form1.fields.push_back(field); |
| 1101 | 1101 |
| 1102 FormStructure form_structure1(form1, std::string()); | 1102 FormStructure form_structure1(form1); |
| 1103 form_structure1.DetermineHeuristicTypes(TestAutofillMetrics()); | 1103 form_structure1.DetermineHeuristicTypes(TestAutofillMetrics()); |
| 1104 const CreditCard* imported_credit_card; | 1104 const CreditCard* imported_credit_card; |
| 1105 EXPECT_TRUE(personal_data_->ImportFormData(form_structure1, | 1105 EXPECT_TRUE(personal_data_->ImportFormData(form_structure1, |
| 1106 &imported_credit_card)); | 1106 &imported_credit_card)); |
| 1107 ASSERT_FALSE(imported_credit_card); | 1107 ASSERT_FALSE(imported_credit_card); |
| 1108 | 1108 |
| 1109 // Verify that the web database has been updated and the notification sent. | 1109 // Verify that the web database has been updated and the notification sent. |
| 1110 EXPECT_CALL(personal_data_observer_, | 1110 EXPECT_CALL(personal_data_observer_, |
| 1111 OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); | 1111 OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); |
| 1112 base::MessageLoop::current()->Run(); | 1112 base::MessageLoop::current()->Run(); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 1143 test::CreateTestFormField( | 1143 test::CreateTestFormField( |
| 1144 "Email:", "email", "theprez@gmail.com", "text", &field); | 1144 "Email:", "email", "theprez@gmail.com", "text", &field); |
| 1145 form2.fields.push_back(field); | 1145 form2.fields.push_back(field); |
| 1146 // Country gets added. | 1146 // Country gets added. |
| 1147 test::CreateTestFormField("Country:", "country", "USA", "text", &field); | 1147 test::CreateTestFormField("Country:", "country", "USA", "text", &field); |
| 1148 form2.fields.push_back(field); | 1148 form2.fields.push_back(field); |
| 1149 // Phone gets updated. | 1149 // Phone gets updated. |
| 1150 test::CreateTestFormField("Phone:", "phone", "6502231234", "text", &field); | 1150 test::CreateTestFormField("Phone:", "phone", "6502231234", "text", &field); |
| 1151 form2.fields.push_back(field); | 1151 form2.fields.push_back(field); |
| 1152 | 1152 |
| 1153 FormStructure form_structure2(form2, std::string()); | 1153 FormStructure form_structure2(form2); |
| 1154 form_structure2.DetermineHeuristicTypes(TestAutofillMetrics()); | 1154 form_structure2.DetermineHeuristicTypes(TestAutofillMetrics()); |
| 1155 EXPECT_TRUE(personal_data_->ImportFormData(form_structure2, | 1155 EXPECT_TRUE(personal_data_->ImportFormData(form_structure2, |
| 1156 &imported_credit_card)); | 1156 &imported_credit_card)); |
| 1157 ASSERT_FALSE(imported_credit_card); | 1157 ASSERT_FALSE(imported_credit_card); |
| 1158 | 1158 |
| 1159 // Verify that the web database has been updated and the notification sent. | 1159 // Verify that the web database has been updated and the notification sent. |
| 1160 EXPECT_CALL(personal_data_observer_, | 1160 EXPECT_CALL(personal_data_observer_, |
| 1161 OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); | 1161 OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); |
| 1162 base::MessageLoop::current()->Run(); | 1162 base::MessageLoop::current()->Run(); |
| 1163 | 1163 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 1185 test::CreateTestFormField( | 1185 test::CreateTestFormField( |
| 1186 "Address Line 1:", "address", "190 High Street", "text", &field); | 1186 "Address Line 1:", "address", "190 High Street", "text", &field); |
| 1187 form1.fields.push_back(field); | 1187 form1.fields.push_back(field); |
| 1188 test::CreateTestFormField("City:", "city", "Philadelphia", "text", &field); | 1188 test::CreateTestFormField("City:", "city", "Philadelphia", "text", &field); |
| 1189 form1.fields.push_back(field); | 1189 form1.fields.push_back(field); |
| 1190 test::CreateTestFormField("State:", "state", "Pennsylvania", "text", &field); | 1190 test::CreateTestFormField("State:", "state", "Pennsylvania", "text", &field); |
| 1191 form1.fields.push_back(field); | 1191 form1.fields.push_back(field); |
| 1192 test::CreateTestFormField("Zip:", "zipcode", "19106", "text", &field); | 1192 test::CreateTestFormField("Zip:", "zipcode", "19106", "text", &field); |
| 1193 form1.fields.push_back(field); | 1193 form1.fields.push_back(field); |
| 1194 | 1194 |
| 1195 FormStructure form_structure1(form1, std::string()); | 1195 FormStructure form_structure1(form1); |
| 1196 form_structure1.DetermineHeuristicTypes(TestAutofillMetrics()); | 1196 form_structure1.DetermineHeuristicTypes(TestAutofillMetrics()); |
| 1197 const CreditCard* imported_credit_card; | 1197 const CreditCard* imported_credit_card; |
| 1198 EXPECT_TRUE(personal_data_->ImportFormData(form_structure1, | 1198 EXPECT_TRUE(personal_data_->ImportFormData(form_structure1, |
| 1199 &imported_credit_card)); | 1199 &imported_credit_card)); |
| 1200 EXPECT_FALSE(imported_credit_card); | 1200 EXPECT_FALSE(imported_credit_card); |
| 1201 | 1201 |
| 1202 // Verify that the web database has been updated and the notification sent. | 1202 // Verify that the web database has been updated and the notification sent. |
| 1203 EXPECT_CALL(personal_data_observer_, | 1203 EXPECT_CALL(personal_data_observer_, |
| 1204 OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); | 1204 OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); |
| 1205 base::MessageLoop::current()->Run(); | 1205 base::MessageLoop::current()->Run(); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 1226 test::CreateTestFormField( | 1226 test::CreateTestFormField( |
| 1227 "Address Line 1:", "address", "190 High Street", "text", &field); | 1227 "Address Line 1:", "address", "190 High Street", "text", &field); |
| 1228 form2.fields.push_back(field); | 1228 form2.fields.push_back(field); |
| 1229 test::CreateTestFormField("City:", "city", "Philadelphia", "text", &field); | 1229 test::CreateTestFormField("City:", "city", "Philadelphia", "text", &field); |
| 1230 form2.fields.push_back(field); | 1230 form2.fields.push_back(field); |
| 1231 test::CreateTestFormField("State:", "state", "Pennsylvania", "text", &field); | 1231 test::CreateTestFormField("State:", "state", "Pennsylvania", "text", &field); |
| 1232 form2.fields.push_back(field); | 1232 form2.fields.push_back(field); |
| 1233 test::CreateTestFormField("Zip:", "zipcode", "19106", "text", &field); | 1233 test::CreateTestFormField("Zip:", "zipcode", "19106", "text", &field); |
| 1234 form2.fields.push_back(field); | 1234 form2.fields.push_back(field); |
| 1235 | 1235 |
| 1236 FormStructure form_structure2(form2, std::string()); | 1236 FormStructure form_structure2(form2); |
| 1237 form_structure2.DetermineHeuristicTypes(TestAutofillMetrics()); | 1237 form_structure2.DetermineHeuristicTypes(TestAutofillMetrics()); |
| 1238 EXPECT_TRUE(personal_data_->ImportFormData(form_structure2, | 1238 EXPECT_TRUE(personal_data_->ImportFormData(form_structure2, |
| 1239 &imported_credit_card)); | 1239 &imported_credit_card)); |
| 1240 ASSERT_FALSE(imported_credit_card); | 1240 ASSERT_FALSE(imported_credit_card); |
| 1241 | 1241 |
| 1242 // Verify that the web database has been updated and the notification sent. | 1242 // Verify that the web database has been updated and the notification sent. |
| 1243 EXPECT_CALL(personal_data_observer_, | 1243 EXPECT_CALL(personal_data_observer_, |
| 1244 OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); | 1244 OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); |
| 1245 base::MessageLoop::current()->Run(); | 1245 base::MessageLoop::current()->Run(); |
| 1246 | 1246 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 1272 test::CreateTestFormField( | 1272 test::CreateTestFormField( |
| 1273 "Address Line 1:", "address", "190 High Street", "text", &field); | 1273 "Address Line 1:", "address", "190 High Street", "text", &field); |
| 1274 form1.fields.push_back(field); | 1274 form1.fields.push_back(field); |
| 1275 test::CreateTestFormField("City:", "city", "Philadelphia", "text", &field); | 1275 test::CreateTestFormField("City:", "city", "Philadelphia", "text", &field); |
| 1276 form1.fields.push_back(field); | 1276 form1.fields.push_back(field); |
| 1277 test::CreateTestFormField("State:", "state", "Pennsylvania", "text", &field); | 1277 test::CreateTestFormField("State:", "state", "Pennsylvania", "text", &field); |
| 1278 form1.fields.push_back(field); | 1278 form1.fields.push_back(field); |
| 1279 test::CreateTestFormField("Zip:", "zipcode", "19106", "text", &field); | 1279 test::CreateTestFormField("Zip:", "zipcode", "19106", "text", &field); |
| 1280 form1.fields.push_back(field); | 1280 form1.fields.push_back(field); |
| 1281 | 1281 |
| 1282 FormStructure form_structure1(form1, std::string()); | 1282 FormStructure form_structure1(form1); |
| 1283 form_structure1.DetermineHeuristicTypes(TestAutofillMetrics()); | 1283 form_structure1.DetermineHeuristicTypes(TestAutofillMetrics()); |
| 1284 const CreditCard* imported_credit_card; | 1284 const CreditCard* imported_credit_card; |
| 1285 EXPECT_TRUE(personal_data_->ImportFormData(form_structure1, | 1285 EXPECT_TRUE(personal_data_->ImportFormData(form_structure1, |
| 1286 &imported_credit_card)); | 1286 &imported_credit_card)); |
| 1287 ASSERT_FALSE(imported_credit_card); | 1287 ASSERT_FALSE(imported_credit_card); |
| 1288 | 1288 |
| 1289 // Verify that the web database has been updated and the notification sent. | 1289 // Verify that the web database has been updated and the notification sent. |
| 1290 EXPECT_CALL(personal_data_observer_, | 1290 EXPECT_CALL(personal_data_observer_, |
| 1291 OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); | 1291 OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); |
| 1292 base::MessageLoop::current()->Run(); | 1292 base::MessageLoop::current()->Run(); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 1314 test::CreateTestFormField( | 1314 test::CreateTestFormField( |
| 1315 "Address Line 1:", "address", "190 High Street", "text", &field); | 1315 "Address Line 1:", "address", "190 High Street", "text", &field); |
| 1316 form2.fields.push_back(field); | 1316 form2.fields.push_back(field); |
| 1317 test::CreateTestFormField("City:", "city", "Philadelphia", "text", &field); | 1317 test::CreateTestFormField("City:", "city", "Philadelphia", "text", &field); |
| 1318 form2.fields.push_back(field); | 1318 form2.fields.push_back(field); |
| 1319 test::CreateTestFormField("State:", "state", "Pennsylvania", "text", &field); | 1319 test::CreateTestFormField("State:", "state", "Pennsylvania", "text", &field); |
| 1320 form2.fields.push_back(field); | 1320 form2.fields.push_back(field); |
| 1321 test::CreateTestFormField("Zip:", "zipcode", "19106", "text", &field); | 1321 test::CreateTestFormField("Zip:", "zipcode", "19106", "text", &field); |
| 1322 form2.fields.push_back(field); | 1322 form2.fields.push_back(field); |
| 1323 | 1323 |
| 1324 FormStructure form_structure2(form2, std::string()); | 1324 FormStructure form_structure2(form2); |
| 1325 form_structure2.DetermineHeuristicTypes(TestAutofillMetrics()); | 1325 form_structure2.DetermineHeuristicTypes(TestAutofillMetrics()); |
| 1326 EXPECT_TRUE(personal_data_->ImportFormData(form_structure2, | 1326 EXPECT_TRUE(personal_data_->ImportFormData(form_structure2, |
| 1327 &imported_credit_card)); | 1327 &imported_credit_card)); |
| 1328 ASSERT_FALSE(imported_credit_card); | 1328 ASSERT_FALSE(imported_credit_card); |
| 1329 | 1329 |
| 1330 // Verify that the web database has been updated and the notification sent. | 1330 // Verify that the web database has been updated and the notification sent. |
| 1331 EXPECT_CALL(personal_data_observer_, | 1331 EXPECT_CALL(personal_data_observer_, |
| 1332 OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); | 1332 OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); |
| 1333 base::MessageLoop::current()->Run(); | 1333 base::MessageLoop::current()->Run(); |
| 1334 | 1334 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 1353 form1.fields.push_back(field); | 1353 form1.fields.push_back(field); |
| 1354 test::CreateTestFormField( | 1354 test::CreateTestFormField( |
| 1355 "Email:", "email", "theprez@gmail.com", "text", &field); | 1355 "Email:", "email", "theprez@gmail.com", "text", &field); |
| 1356 form1.fields.push_back(field); | 1356 form1.fields.push_back(field); |
| 1357 test::CreateTestFormField( | 1357 test::CreateTestFormField( |
| 1358 "Address Line 1:", "address", "190 High Street", "text", &field); | 1358 "Address Line 1:", "address", "190 High Street", "text", &field); |
| 1359 form1.fields.push_back(field); | 1359 form1.fields.push_back(field); |
| 1360 test::CreateTestFormField("City:", "city", "Philadelphia", "text", &field); | 1360 test::CreateTestFormField("City:", "city", "Philadelphia", "text", &field); |
| 1361 form1.fields.push_back(field); | 1361 form1.fields.push_back(field); |
| 1362 | 1362 |
| 1363 FormStructure form_structure1(form1, std::string()); | 1363 FormStructure form_structure1(form1); |
| 1364 form_structure1.DetermineHeuristicTypes(TestAutofillMetrics()); | 1364 form_structure1.DetermineHeuristicTypes(TestAutofillMetrics()); |
| 1365 const CreditCard* imported_credit_card; | 1365 const CreditCard* imported_credit_card; |
| 1366 EXPECT_FALSE(personal_data_->ImportFormData(form_structure1, | 1366 EXPECT_FALSE(personal_data_->ImportFormData(form_structure1, |
| 1367 &imported_credit_card)); | 1367 &imported_credit_card)); |
| 1368 ASSERT_FALSE(imported_credit_card); | 1368 ASSERT_FALSE(imported_credit_card); |
| 1369 | 1369 |
| 1370 // Since no refresh is expected, reload the data from the database to make | 1370 // Since no refresh is expected, reload the data from the database to make |
| 1371 // sure no changes were written out. | 1371 // sure no changes were written out. |
| 1372 ResetPersonalDataManager(); | 1372 ResetPersonalDataManager(); |
| 1373 | 1373 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1407 form.fields.push_back(field); | 1407 form.fields.push_back(field); |
| 1408 test::CreateTestFormField("City:", "city", "San Francisco", "text", &field); | 1408 test::CreateTestFormField("City:", "city", "San Francisco", "text", &field); |
| 1409 form.fields.push_back(field); | 1409 form.fields.push_back(field); |
| 1410 test::CreateTestFormField("State:", "state", "CA", "text", &field); | 1410 test::CreateTestFormField("State:", "state", "CA", "text", &field); |
| 1411 form.fields.push_back(field); | 1411 form.fields.push_back(field); |
| 1412 test::CreateTestFormField("Zip:", "zip", "94102", "text", &field); | 1412 test::CreateTestFormField("Zip:", "zip", "94102", "text", &field); |
| 1413 form.fields.push_back(field); | 1413 form.fields.push_back(field); |
| 1414 test::CreateTestFormField("Phone:", "phone", "4158889999", "text", &field); | 1414 test::CreateTestFormField("Phone:", "phone", "4158889999", "text", &field); |
| 1415 form.fields.push_back(field); | 1415 form.fields.push_back(field); |
| 1416 | 1416 |
| 1417 FormStructure form_structure(form, std::string()); | 1417 FormStructure form_structure(form); |
| 1418 form_structure.DetermineHeuristicTypes(TestAutofillMetrics()); | 1418 form_structure.DetermineHeuristicTypes(TestAutofillMetrics()); |
| 1419 const CreditCard* imported_credit_card; | 1419 const CreditCard* imported_credit_card; |
| 1420 EXPECT_TRUE(personal_data_->ImportFormData(form_structure, | 1420 EXPECT_TRUE(personal_data_->ImportFormData(form_structure, |
| 1421 &imported_credit_card)); | 1421 &imported_credit_card)); |
| 1422 EXPECT_FALSE(imported_credit_card); | 1422 EXPECT_FALSE(imported_credit_card); |
| 1423 | 1423 |
| 1424 // Note: No refresh. | 1424 // Note: No refresh. |
| 1425 | 1425 |
| 1426 // Expect no change. | 1426 // Expect no change. |
| 1427 const std::vector<AutofillProfile*>& web_profiles = | 1427 const std::vector<AutofillProfile*>& web_profiles = |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1440 "Name on card:", "name_on_card", "Biggie Smalls", "text", &field); | 1440 "Name on card:", "name_on_card", "Biggie Smalls", "text", &field); |
| 1441 form1.fields.push_back(field); | 1441 form1.fields.push_back(field); |
| 1442 test::CreateTestFormField( | 1442 test::CreateTestFormField( |
| 1443 "Card Number:", "card_number", "4111-1111-1111-1111", "text", &field); | 1443 "Card Number:", "card_number", "4111-1111-1111-1111", "text", &field); |
| 1444 form1.fields.push_back(field); | 1444 form1.fields.push_back(field); |
| 1445 test::CreateTestFormField("Exp Month:", "exp_month", "01", "text", &field); | 1445 test::CreateTestFormField("Exp Month:", "exp_month", "01", "text", &field); |
| 1446 form1.fields.push_back(field); | 1446 form1.fields.push_back(field); |
| 1447 test::CreateTestFormField("Exp Year:", "exp_year", "2011", "text", &field); | 1447 test::CreateTestFormField("Exp Year:", "exp_year", "2011", "text", &field); |
| 1448 form1.fields.push_back(field); | 1448 form1.fields.push_back(field); |
| 1449 | 1449 |
| 1450 FormStructure form_structure1(form1, std::string()); | 1450 FormStructure form_structure1(form1); |
| 1451 form_structure1.DetermineHeuristicTypes(TestAutofillMetrics()); | 1451 form_structure1.DetermineHeuristicTypes(TestAutofillMetrics()); |
| 1452 const CreditCard* imported_credit_card; | 1452 const CreditCard* imported_credit_card; |
| 1453 EXPECT_TRUE(personal_data_->ImportFormData(form_structure1, | 1453 EXPECT_TRUE(personal_data_->ImportFormData(form_structure1, |
| 1454 &imported_credit_card)); | 1454 &imported_credit_card)); |
| 1455 ASSERT_TRUE(imported_credit_card); | 1455 ASSERT_TRUE(imported_credit_card); |
| 1456 personal_data_->SaveImportedCreditCard(*imported_credit_card); | 1456 personal_data_->SaveImportedCreditCard(*imported_credit_card); |
| 1457 delete imported_credit_card; | 1457 delete imported_credit_card; |
| 1458 | 1458 |
| 1459 // Verify that the web database has been updated and the notification sent. | 1459 // Verify that the web database has been updated and the notification sent. |
| 1460 EXPECT_CALL(personal_data_observer_, | 1460 EXPECT_CALL(personal_data_observer_, |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1474 "Name on card:", "name_on_card", "", "text", &field); | 1474 "Name on card:", "name_on_card", "", "text", &field); |
| 1475 form2.fields.push_back(field); | 1475 form2.fields.push_back(field); |
| 1476 test::CreateTestFormField( | 1476 test::CreateTestFormField( |
| 1477 "Card Number:", "card_number", "5500 0000 0000 0004", "text", &field); | 1477 "Card Number:", "card_number", "5500 0000 0000 0004", "text", &field); |
| 1478 form2.fields.push_back(field); | 1478 form2.fields.push_back(field); |
| 1479 test::CreateTestFormField("Exp Month:", "exp_month", "02", "text", &field); | 1479 test::CreateTestFormField("Exp Month:", "exp_month", "02", "text", &field); |
| 1480 form2.fields.push_back(field); | 1480 form2.fields.push_back(field); |
| 1481 test::CreateTestFormField("Exp Year:", "exp_year", "2012", "text", &field); | 1481 test::CreateTestFormField("Exp Year:", "exp_year", "2012", "text", &field); |
| 1482 form2.fields.push_back(field); | 1482 form2.fields.push_back(field); |
| 1483 | 1483 |
| 1484 FormStructure form_structure2(form2, std::string()); | 1484 FormStructure form_structure2(form2); |
| 1485 form_structure2.DetermineHeuristicTypes(TestAutofillMetrics()); | 1485 form_structure2.DetermineHeuristicTypes(TestAutofillMetrics()); |
| 1486 EXPECT_TRUE(personal_data_->ImportFormData(form_structure2, | 1486 EXPECT_TRUE(personal_data_->ImportFormData(form_structure2, |
| 1487 &imported_credit_card)); | 1487 &imported_credit_card)); |
| 1488 ASSERT_TRUE(imported_credit_card); | 1488 ASSERT_TRUE(imported_credit_card); |
| 1489 personal_data_->SaveImportedCreditCard(*imported_credit_card); | 1489 personal_data_->SaveImportedCreditCard(*imported_credit_card); |
| 1490 delete imported_credit_card; | 1490 delete imported_credit_card; |
| 1491 | 1491 |
| 1492 // Verify that the web database has been updated and the notification sent. | 1492 // Verify that the web database has been updated and the notification sent. |
| 1493 EXPECT_CALL(personal_data_observer_, | 1493 EXPECT_CALL(personal_data_observer_, |
| 1494 OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); | 1494 OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 1511 "Name on card:", "name_on_card", "Biggie Smalls", "text", &field); | 1511 "Name on card:", "name_on_card", "Biggie Smalls", "text", &field); |
| 1512 form1.fields.push_back(field); | 1512 form1.fields.push_back(field); |
| 1513 test::CreateTestFormField( | 1513 test::CreateTestFormField( |
| 1514 "Card Number:", "card_number", "4111-1111-1111-1111", "text", &field); | 1514 "Card Number:", "card_number", "4111-1111-1111-1111", "text", &field); |
| 1515 form1.fields.push_back(field); | 1515 form1.fields.push_back(field); |
| 1516 test::CreateTestFormField("Exp Month:", "exp_month", "01", "text", &field); | 1516 test::CreateTestFormField("Exp Month:", "exp_month", "01", "text", &field); |
| 1517 form1.fields.push_back(field); | 1517 form1.fields.push_back(field); |
| 1518 test::CreateTestFormField("Exp Year:", "exp_year", "2011", "text", &field); | 1518 test::CreateTestFormField("Exp Year:", "exp_year", "2011", "text", &field); |
| 1519 form1.fields.push_back(field); | 1519 form1.fields.push_back(field); |
| 1520 | 1520 |
| 1521 FormStructure form_structure1(form1, std::string()); | 1521 FormStructure form_structure1(form1); |
| 1522 form_structure1.DetermineHeuristicTypes(TestAutofillMetrics()); | 1522 form_structure1.DetermineHeuristicTypes(TestAutofillMetrics()); |
| 1523 const CreditCard* imported_credit_card; | 1523 const CreditCard* imported_credit_card; |
| 1524 EXPECT_TRUE(personal_data_->ImportFormData(form_structure1, | 1524 EXPECT_TRUE(personal_data_->ImportFormData(form_structure1, |
| 1525 &imported_credit_card)); | 1525 &imported_credit_card)); |
| 1526 ASSERT_TRUE(imported_credit_card); | 1526 ASSERT_TRUE(imported_credit_card); |
| 1527 personal_data_->SaveImportedCreditCard(*imported_credit_card); | 1527 personal_data_->SaveImportedCreditCard(*imported_credit_card); |
| 1528 delete imported_credit_card; | 1528 delete imported_credit_card; |
| 1529 | 1529 |
| 1530 // Verify that the web database has been updated and the notification sent. | 1530 // Verify that the web database has been updated and the notification sent. |
| 1531 EXPECT_CALL(personal_data_observer_, | 1531 EXPECT_CALL(personal_data_observer_, |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1545 "Name on card:", "name_on_card", "Jim Johansen", "text", &field); | 1545 "Name on card:", "name_on_card", "Jim Johansen", "text", &field); |
| 1546 form2.fields.push_back(field); | 1546 form2.fields.push_back(field); |
| 1547 test::CreateTestFormField( | 1547 test::CreateTestFormField( |
| 1548 "Card Number:", "card_number", "1000000000000000", "text", &field); | 1548 "Card Number:", "card_number", "1000000000000000", "text", &field); |
| 1549 form2.fields.push_back(field); | 1549 form2.fields.push_back(field); |
| 1550 test::CreateTestFormField("Exp Month:", "exp_month", "02", "text", &field); | 1550 test::CreateTestFormField("Exp Month:", "exp_month", "02", "text", &field); |
| 1551 form2.fields.push_back(field); | 1551 form2.fields.push_back(field); |
| 1552 test::CreateTestFormField("Exp Year:", "exp_year", "2012", "text", &field); | 1552 test::CreateTestFormField("Exp Year:", "exp_year", "2012", "text", &field); |
| 1553 form2.fields.push_back(field); | 1553 form2.fields.push_back(field); |
| 1554 | 1554 |
| 1555 FormStructure form_structure2(form2, std::string()); | 1555 FormStructure form_structure2(form2); |
| 1556 form_structure2.DetermineHeuristicTypes(TestAutofillMetrics()); | 1556 form_structure2.DetermineHeuristicTypes(TestAutofillMetrics()); |
| 1557 EXPECT_FALSE(personal_data_->ImportFormData(form_structure2, | 1557 EXPECT_FALSE(personal_data_->ImportFormData(form_structure2, |
| 1558 &imported_credit_card)); | 1558 &imported_credit_card)); |
| 1559 ASSERT_FALSE(imported_credit_card); | 1559 ASSERT_FALSE(imported_credit_card); |
| 1560 | 1560 |
| 1561 // Since no refresh is expected, reload the data from the database to make | 1561 // Since no refresh is expected, reload the data from the database to make |
| 1562 // sure no changes were written out. | 1562 // sure no changes were written out. |
| 1563 ResetPersonalDataManager(); | 1563 ResetPersonalDataManager(); |
| 1564 | 1564 |
| 1565 const std::vector<CreditCard*>& results2 = personal_data_->GetCreditCards(); | 1565 const std::vector<CreditCard*>& results2 = personal_data_->GetCreditCards(); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 1576 "Name on card:", "name_on_card", "Biggie Smalls", "text", &field); | 1576 "Name on card:", "name_on_card", "Biggie Smalls", "text", &field); |
| 1577 form1.fields.push_back(field); | 1577 form1.fields.push_back(field); |
| 1578 test::CreateTestFormField( | 1578 test::CreateTestFormField( |
| 1579 "Card Number:", "card_number", "4111-1111-1111-1111", "text", &field); | 1579 "Card Number:", "card_number", "4111-1111-1111-1111", "text", &field); |
| 1580 form1.fields.push_back(field); | 1580 form1.fields.push_back(field); |
| 1581 test::CreateTestFormField("Exp Month:", "exp_month", "01", "text", &field); | 1581 test::CreateTestFormField("Exp Month:", "exp_month", "01", "text", &field); |
| 1582 form1.fields.push_back(field); | 1582 form1.fields.push_back(field); |
| 1583 test::CreateTestFormField("Exp Year:", "exp_year", "2011", "text", &field); | 1583 test::CreateTestFormField("Exp Year:", "exp_year", "2011", "text", &field); |
| 1584 form1.fields.push_back(field); | 1584 form1.fields.push_back(field); |
| 1585 | 1585 |
| 1586 FormStructure form_structure1(form1, std::string()); | 1586 FormStructure form_structure1(form1); |
| 1587 form_structure1.DetermineHeuristicTypes(TestAutofillMetrics()); | 1587 form_structure1.DetermineHeuristicTypes(TestAutofillMetrics()); |
| 1588 const CreditCard* imported_credit_card; | 1588 const CreditCard* imported_credit_card; |
| 1589 EXPECT_TRUE(personal_data_->ImportFormData(form_structure1, | 1589 EXPECT_TRUE(personal_data_->ImportFormData(form_structure1, |
| 1590 &imported_credit_card)); | 1590 &imported_credit_card)); |
| 1591 ASSERT_TRUE(imported_credit_card); | 1591 ASSERT_TRUE(imported_credit_card); |
| 1592 personal_data_->SaveImportedCreditCard(*imported_credit_card); | 1592 personal_data_->SaveImportedCreditCard(*imported_credit_card); |
| 1593 delete imported_credit_card; | 1593 delete imported_credit_card; |
| 1594 | 1594 |
| 1595 // Verify that the web database has been updated and the notification sent. | 1595 // Verify that the web database has been updated and the notification sent. |
| 1596 EXPECT_CALL(personal_data_observer_, | 1596 EXPECT_CALL(personal_data_observer_, |
| (...skipping 14 matching lines...) Expand all Loading... |
| 1611 "Name on card:", "name_on_card", "Biggie Smalls", "text", &field); | 1611 "Name on card:", "name_on_card", "Biggie Smalls", "text", &field); |
| 1612 form2.fields.push_back(field); | 1612 form2.fields.push_back(field); |
| 1613 test::CreateTestFormField( | 1613 test::CreateTestFormField( |
| 1614 "Card Number:", "card_number", "4111 1111 1111 1111", "text", &field); | 1614 "Card Number:", "card_number", "4111 1111 1111 1111", "text", &field); |
| 1615 form2.fields.push_back(field); | 1615 form2.fields.push_back(field); |
| 1616 test::CreateTestFormField("Exp Month:", "exp_month", "01", "text", &field); | 1616 test::CreateTestFormField("Exp Month:", "exp_month", "01", "text", &field); |
| 1617 form2.fields.push_back(field); | 1617 form2.fields.push_back(field); |
| 1618 test::CreateTestFormField("Exp Year:", "exp_year", "2012", "text", &field); | 1618 test::CreateTestFormField("Exp Year:", "exp_year", "2012", "text", &field); |
| 1619 form2.fields.push_back(field); | 1619 form2.fields.push_back(field); |
| 1620 | 1620 |
| 1621 FormStructure form_structure2(form2, std::string()); | 1621 FormStructure form_structure2(form2); |
| 1622 form_structure2.DetermineHeuristicTypes(TestAutofillMetrics()); | 1622 form_structure2.DetermineHeuristicTypes(TestAutofillMetrics()); |
| 1623 EXPECT_TRUE(personal_data_->ImportFormData(form_structure2, | 1623 EXPECT_TRUE(personal_data_->ImportFormData(form_structure2, |
| 1624 &imported_credit_card)); | 1624 &imported_credit_card)); |
| 1625 EXPECT_FALSE(imported_credit_card); | 1625 EXPECT_FALSE(imported_credit_card); |
| 1626 | 1626 |
| 1627 // Verify that the web database has been updated and the notification sent. | 1627 // Verify that the web database has been updated and the notification sent. |
| 1628 EXPECT_CALL(personal_data_observer_, | 1628 EXPECT_CALL(personal_data_observer_, |
| 1629 OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); | 1629 OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); |
| 1630 base::MessageLoop::current()->Run(); | 1630 base::MessageLoop::current()->Run(); |
| 1631 | 1631 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 1648 "Name on card:", "name_on_card", "Biggie Smalls", "text", &field); | 1648 "Name on card:", "name_on_card", "Biggie Smalls", "text", &field); |
| 1649 form1.fields.push_back(field); | 1649 form1.fields.push_back(field); |
| 1650 test::CreateTestFormField( | 1650 test::CreateTestFormField( |
| 1651 "Card Number:", "card_number", "4111-1111-1111-1111", "text", &field); | 1651 "Card Number:", "card_number", "4111-1111-1111-1111", "text", &field); |
| 1652 form1.fields.push_back(field); | 1652 form1.fields.push_back(field); |
| 1653 test::CreateTestFormField("Exp Month:", "exp_month", "01", "text", &field); | 1653 test::CreateTestFormField("Exp Month:", "exp_month", "01", "text", &field); |
| 1654 form1.fields.push_back(field); | 1654 form1.fields.push_back(field); |
| 1655 test::CreateTestFormField("Exp Year:", "exp_year", "2011", "text", &field); | 1655 test::CreateTestFormField("Exp Year:", "exp_year", "2011", "text", &field); |
| 1656 form1.fields.push_back(field); | 1656 form1.fields.push_back(field); |
| 1657 | 1657 |
| 1658 FormStructure form_structure1(form1, std::string()); | 1658 FormStructure form_structure1(form1); |
| 1659 form_structure1.DetermineHeuristicTypes(TestAutofillMetrics()); | 1659 form_structure1.DetermineHeuristicTypes(TestAutofillMetrics()); |
| 1660 const CreditCard* imported_credit_card; | 1660 const CreditCard* imported_credit_card; |
| 1661 EXPECT_TRUE(personal_data_->ImportFormData(form_structure1, | 1661 EXPECT_TRUE(personal_data_->ImportFormData(form_structure1, |
| 1662 &imported_credit_card)); | 1662 &imported_credit_card)); |
| 1663 ASSERT_TRUE(imported_credit_card); | 1663 ASSERT_TRUE(imported_credit_card); |
| 1664 personal_data_->SaveImportedCreditCard(*imported_credit_card); | 1664 personal_data_->SaveImportedCreditCard(*imported_credit_card); |
| 1665 delete imported_credit_card; | 1665 delete imported_credit_card; |
| 1666 | 1666 |
| 1667 // Verify that the web database has been updated and the notification sent. | 1667 // Verify that the web database has been updated and the notification sent. |
| 1668 EXPECT_CALL(personal_data_observer_, | 1668 EXPECT_CALL(personal_data_observer_, |
| (...skipping 10 matching lines...) Expand all Loading... |
| 1679 // Add a second credit card with no number. | 1679 // Add a second credit card with no number. |
| 1680 FormData form2; | 1680 FormData form2; |
| 1681 test::CreateTestFormField( | 1681 test::CreateTestFormField( |
| 1682 "Name on card:", "name_on_card", "Biggie Smalls", "text", &field); | 1682 "Name on card:", "name_on_card", "Biggie Smalls", "text", &field); |
| 1683 form2.fields.push_back(field); | 1683 form2.fields.push_back(field); |
| 1684 test::CreateTestFormField("Exp Month:", "exp_month", "01", "text", &field); | 1684 test::CreateTestFormField("Exp Month:", "exp_month", "01", "text", &field); |
| 1685 form2.fields.push_back(field); | 1685 form2.fields.push_back(field); |
| 1686 test::CreateTestFormField("Exp Year:", "exp_year", "2012", "text", &field); | 1686 test::CreateTestFormField("Exp Year:", "exp_year", "2012", "text", &field); |
| 1687 form2.fields.push_back(field); | 1687 form2.fields.push_back(field); |
| 1688 | 1688 |
| 1689 FormStructure form_structure2(form2, std::string()); | 1689 FormStructure form_structure2(form2); |
| 1690 form_structure2.DetermineHeuristicTypes(TestAutofillMetrics()); | 1690 form_structure2.DetermineHeuristicTypes(TestAutofillMetrics()); |
| 1691 EXPECT_FALSE(personal_data_->ImportFormData(form_structure2, | 1691 EXPECT_FALSE(personal_data_->ImportFormData(form_structure2, |
| 1692 &imported_credit_card)); | 1692 &imported_credit_card)); |
| 1693 EXPECT_FALSE(imported_credit_card); | 1693 EXPECT_FALSE(imported_credit_card); |
| 1694 | 1694 |
| 1695 // Since no refresh is expected, reload the data from the database to make | 1695 // Since no refresh is expected, reload the data from the database to make |
| 1696 // sure no changes were written out. | 1696 // sure no changes were written out. |
| 1697 ResetPersonalDataManager(); | 1697 ResetPersonalDataManager(); |
| 1698 | 1698 |
| 1699 // No change is expected. | 1699 // No change is expected. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 1714 "Name on card:", "name_on_card", "Biggie Smalls", "text", &field); | 1714 "Name on card:", "name_on_card", "Biggie Smalls", "text", &field); |
| 1715 form1.fields.push_back(field); | 1715 form1.fields.push_back(field); |
| 1716 test::CreateTestFormField( | 1716 test::CreateTestFormField( |
| 1717 "Card Number:", "card_number", "4111-1111-1111-1111", "text", &field); | 1717 "Card Number:", "card_number", "4111-1111-1111-1111", "text", &field); |
| 1718 form1.fields.push_back(field); | 1718 form1.fields.push_back(field); |
| 1719 test::CreateTestFormField("Exp Month:", "exp_month", "01", "text", &field); | 1719 test::CreateTestFormField("Exp Month:", "exp_month", "01", "text", &field); |
| 1720 form1.fields.push_back(field); | 1720 form1.fields.push_back(field); |
| 1721 test::CreateTestFormField("Exp Year:", "exp_year", "2011", "text", &field); | 1721 test::CreateTestFormField("Exp Year:", "exp_year", "2011", "text", &field); |
| 1722 form1.fields.push_back(field); | 1722 form1.fields.push_back(field); |
| 1723 | 1723 |
| 1724 FormStructure form_structure1(form1, std::string()); | 1724 FormStructure form_structure1(form1); |
| 1725 form_structure1.DetermineHeuristicTypes(TestAutofillMetrics()); | 1725 form_structure1.DetermineHeuristicTypes(TestAutofillMetrics()); |
| 1726 const CreditCard* imported_credit_card; | 1726 const CreditCard* imported_credit_card; |
| 1727 EXPECT_TRUE(personal_data_->ImportFormData(form_structure1, | 1727 EXPECT_TRUE(personal_data_->ImportFormData(form_structure1, |
| 1728 &imported_credit_card)); | 1728 &imported_credit_card)); |
| 1729 ASSERT_TRUE(imported_credit_card); | 1729 ASSERT_TRUE(imported_credit_card); |
| 1730 personal_data_->SaveImportedCreditCard(*imported_credit_card); | 1730 personal_data_->SaveImportedCreditCard(*imported_credit_card); |
| 1731 delete imported_credit_card; | 1731 delete imported_credit_card; |
| 1732 | 1732 |
| 1733 // Verify that the web database has been updated and the notification sent. | 1733 // Verify that the web database has been updated and the notification sent. |
| 1734 EXPECT_CALL(personal_data_observer_, | 1734 EXPECT_CALL(personal_data_observer_, |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1747 FormData form2; | 1747 FormData form2; |
| 1748 // Note missing name. | 1748 // Note missing name. |
| 1749 test::CreateTestFormField( | 1749 test::CreateTestFormField( |
| 1750 "Card Number:", "card_number", "4111111111111111", "text", &field); | 1750 "Card Number:", "card_number", "4111111111111111", "text", &field); |
| 1751 form2.fields.push_back(field); | 1751 form2.fields.push_back(field); |
| 1752 test::CreateTestFormField("Exp Month:", "exp_month", "01", "text", &field); | 1752 test::CreateTestFormField("Exp Month:", "exp_month", "01", "text", &field); |
| 1753 form2.fields.push_back(field); | 1753 form2.fields.push_back(field); |
| 1754 test::CreateTestFormField("Exp Year:", "exp_year", "2011", "text", &field); | 1754 test::CreateTestFormField("Exp Year:", "exp_year", "2011", "text", &field); |
| 1755 form2.fields.push_back(field); | 1755 form2.fields.push_back(field); |
| 1756 | 1756 |
| 1757 FormStructure form_structure2(form2, std::string()); | 1757 FormStructure form_structure2(form2); |
| 1758 form_structure2.DetermineHeuristicTypes(TestAutofillMetrics()); | 1758 form_structure2.DetermineHeuristicTypes(TestAutofillMetrics()); |
| 1759 EXPECT_TRUE(personal_data_->ImportFormData(form_structure2, | 1759 EXPECT_TRUE(personal_data_->ImportFormData(form_structure2, |
| 1760 &imported_credit_card)); | 1760 &imported_credit_card)); |
| 1761 EXPECT_FALSE(imported_credit_card); | 1761 EXPECT_FALSE(imported_credit_card); |
| 1762 | 1762 |
| 1763 // Since no refresh is expected, reload the data from the database to make | 1763 // Since no refresh is expected, reload the data from the database to make |
| 1764 // sure no changes were written out. | 1764 // sure no changes were written out. |
| 1765 ResetPersonalDataManager(); | 1765 ResetPersonalDataManager(); |
| 1766 | 1766 |
| 1767 // No change is expected. | 1767 // No change is expected. |
| 1768 CreditCard expected2(base::GenerateGUID(), "https://www.example.com"); | 1768 CreditCard expected2(base::GenerateGUID(), "https://www.example.com"); |
| 1769 test::SetCreditCardInfo(&expected2, | 1769 test::SetCreditCardInfo(&expected2, |
| 1770 "Biggie Smalls", "4111111111111111", "01", "2011"); | 1770 "Biggie Smalls", "4111111111111111", "01", "2011"); |
| 1771 const std::vector<CreditCard*>& results2 = personal_data_->GetCreditCards(); | 1771 const std::vector<CreditCard*>& results2 = personal_data_->GetCreditCards(); |
| 1772 ASSERT_EQ(1U, results2.size()); | 1772 ASSERT_EQ(1U, results2.size()); |
| 1773 EXPECT_EQ(0, expected2.Compare(*results2[0])); | 1773 EXPECT_EQ(0, expected2.Compare(*results2[0])); |
| 1774 | 1774 |
| 1775 // Add a third credit card where the expiration date is missing. | 1775 // Add a third credit card where the expiration date is missing. |
| 1776 FormData form3; | 1776 FormData form3; |
| 1777 test::CreateTestFormField( | 1777 test::CreateTestFormField( |
| 1778 "Name on card:", "name_on_card", "Johnny McEnroe", "text", &field); | 1778 "Name on card:", "name_on_card", "Johnny McEnroe", "text", &field); |
| 1779 form3.fields.push_back(field); | 1779 form3.fields.push_back(field); |
| 1780 test::CreateTestFormField( | 1780 test::CreateTestFormField( |
| 1781 "Card Number:", "card_number", "5555555555554444", "text", &field); | 1781 "Card Number:", "card_number", "5555555555554444", "text", &field); |
| 1782 form3.fields.push_back(field); | 1782 form3.fields.push_back(field); |
| 1783 // Note missing expiration month and year.. | 1783 // Note missing expiration month and year.. |
| 1784 | 1784 |
| 1785 FormStructure form_structure3(form3, std::string()); | 1785 FormStructure form_structure3(form3); |
| 1786 form_structure3.DetermineHeuristicTypes(TestAutofillMetrics()); | 1786 form_structure3.DetermineHeuristicTypes(TestAutofillMetrics()); |
| 1787 EXPECT_FALSE(personal_data_->ImportFormData(form_structure3, | 1787 EXPECT_FALSE(personal_data_->ImportFormData(form_structure3, |
| 1788 &imported_credit_card)); | 1788 &imported_credit_card)); |
| 1789 ASSERT_FALSE(imported_credit_card); | 1789 ASSERT_FALSE(imported_credit_card); |
| 1790 | 1790 |
| 1791 // Since no refresh is expected, reload the data from the database to make | 1791 // Since no refresh is expected, reload the data from the database to make |
| 1792 // sure no changes were written out. | 1792 // sure no changes were written out. |
| 1793 ResetPersonalDataManager(); | 1793 ResetPersonalDataManager(); |
| 1794 | 1794 |
| 1795 // No change is expected. | 1795 // No change is expected. |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1827 "Name on card:", "name_on_card", "Biggie Smalls", "text", &field); | 1827 "Name on card:", "name_on_card", "Biggie Smalls", "text", &field); |
| 1828 form.fields.push_back(field); | 1828 form.fields.push_back(field); |
| 1829 test::CreateTestFormField( | 1829 test::CreateTestFormField( |
| 1830 "Card Number:", "card_number", "4111-1111-1111-1111", "text", &field); | 1830 "Card Number:", "card_number", "4111-1111-1111-1111", "text", &field); |
| 1831 form.fields.push_back(field); | 1831 form.fields.push_back(field); |
| 1832 test::CreateTestFormField("Exp Month:", "exp_month", "01", "text", &field); | 1832 test::CreateTestFormField("Exp Month:", "exp_month", "01", "text", &field); |
| 1833 form.fields.push_back(field); | 1833 form.fields.push_back(field); |
| 1834 test::CreateTestFormField("Exp Year:", "exp_year", "2012", "text", &field); | 1834 test::CreateTestFormField("Exp Year:", "exp_year", "2012", "text", &field); |
| 1835 form.fields.push_back(field); | 1835 form.fields.push_back(field); |
| 1836 | 1836 |
| 1837 FormStructure form_structure(form, std::string()); | 1837 FormStructure form_structure(form); |
| 1838 form_structure.DetermineHeuristicTypes(TestAutofillMetrics()); | 1838 form_structure.DetermineHeuristicTypes(TestAutofillMetrics()); |
| 1839 const CreditCard* imported_credit_card; | 1839 const CreditCard* imported_credit_card; |
| 1840 EXPECT_TRUE(personal_data_->ImportFormData(form_structure, | 1840 EXPECT_TRUE(personal_data_->ImportFormData(form_structure, |
| 1841 &imported_credit_card)); | 1841 &imported_credit_card)); |
| 1842 EXPECT_FALSE(imported_credit_card); | 1842 EXPECT_FALSE(imported_credit_card); |
| 1843 | 1843 |
| 1844 // Verify that the web database has been updated and the notification sent. | 1844 // Verify that the web database has been updated and the notification sent. |
| 1845 EXPECT_CALL(personal_data_observer_, | 1845 EXPECT_CALL(personal_data_observer_, |
| 1846 OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); | 1846 OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); |
| 1847 base::MessageLoop::current()->Run(); | 1847 base::MessageLoop::current()->Run(); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1882 "Name on card:", "name_on_card", "Biggie Smalls", "text", &field); | 1882 "Name on card:", "name_on_card", "Biggie Smalls", "text", &field); |
| 1883 form.fields.push_back(field); | 1883 form.fields.push_back(field); |
| 1884 test::CreateTestFormField( | 1884 test::CreateTestFormField( |
| 1885 "Card Number:", "card_number", "4111-1111-1111-1111", "text", &field); | 1885 "Card Number:", "card_number", "4111-1111-1111-1111", "text", &field); |
| 1886 form.fields.push_back(field); | 1886 form.fields.push_back(field); |
| 1887 test::CreateTestFormField("Exp Month:", "exp_month", "01", "text", &field); | 1887 test::CreateTestFormField("Exp Month:", "exp_month", "01", "text", &field); |
| 1888 form.fields.push_back(field); | 1888 form.fields.push_back(field); |
| 1889 test::CreateTestFormField("Exp Year:", "exp_year", "2011", "text", &field); | 1889 test::CreateTestFormField("Exp Year:", "exp_year", "2011", "text", &field); |
| 1890 form.fields.push_back(field); | 1890 form.fields.push_back(field); |
| 1891 | 1891 |
| 1892 FormStructure form_structure(form, std::string()); | 1892 FormStructure form_structure(form); |
| 1893 form_structure.DetermineHeuristicTypes(TestAutofillMetrics()); | 1893 form_structure.DetermineHeuristicTypes(TestAutofillMetrics()); |
| 1894 const CreditCard* imported_credit_card; | 1894 const CreditCard* imported_credit_card; |
| 1895 EXPECT_TRUE(personal_data_->ImportFormData(form_structure, | 1895 EXPECT_TRUE(personal_data_->ImportFormData(form_structure, |
| 1896 &imported_credit_card)); | 1896 &imported_credit_card)); |
| 1897 EXPECT_FALSE(imported_credit_card); | 1897 EXPECT_FALSE(imported_credit_card); |
| 1898 | 1898 |
| 1899 // Since no refresh is expected, reload the data from the database to make | 1899 // Since no refresh is expected, reload the data from the database to make |
| 1900 // sure no changes were written out. | 1900 // sure no changes were written out. |
| 1901 ResetPersonalDataManager(); | 1901 ResetPersonalDataManager(); |
| 1902 | 1902 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1940 test::CreateTestFormField( | 1940 test::CreateTestFormField( |
| 1941 "Address:", "address1", "123 Zoo St.", "text", &field); | 1941 "Address:", "address1", "123 Zoo St.", "text", &field); |
| 1942 form.fields.push_back(field); | 1942 form.fields.push_back(field); |
| 1943 test::CreateTestFormField("City:", "city", "Hollywood", "text", &field); | 1943 test::CreateTestFormField("City:", "city", "Hollywood", "text", &field); |
| 1944 form.fields.push_back(field); | 1944 form.fields.push_back(field); |
| 1945 test::CreateTestFormField("State:", "state", "CA", "text", &field); | 1945 test::CreateTestFormField("State:", "state", "CA", "text", &field); |
| 1946 form.fields.push_back(field); | 1946 form.fields.push_back(field); |
| 1947 test::CreateTestFormField("Zip:", "zip", "91601", "text", &field); | 1947 test::CreateTestFormField("Zip:", "zip", "91601", "text", &field); |
| 1948 form.fields.push_back(field); | 1948 form.fields.push_back(field); |
| 1949 | 1949 |
| 1950 FormStructure form_structure(form, std::string()); | 1950 FormStructure form_structure(form); |
| 1951 form_structure.DetermineHeuristicTypes(TestAutofillMetrics()); | 1951 form_structure.DetermineHeuristicTypes(TestAutofillMetrics()); |
| 1952 const CreditCard* imported_credit_card; | 1952 const CreditCard* imported_credit_card; |
| 1953 EXPECT_TRUE(personal_data_->ImportFormData(form_structure, | 1953 EXPECT_TRUE(personal_data_->ImportFormData(form_structure, |
| 1954 &imported_credit_card)); | 1954 &imported_credit_card)); |
| 1955 EXPECT_FALSE(imported_credit_card); | 1955 EXPECT_FALSE(imported_credit_card); |
| 1956 | 1956 |
| 1957 // Wait for the refresh, which in this case is a no-op. | 1957 // Wait for the refresh, which in this case is a no-op. |
| 1958 EXPECT_CALL(personal_data_observer_, | 1958 EXPECT_CALL(personal_data_observer_, |
| 1959 OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); | 1959 OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); |
| 1960 base::MessageLoop::current()->Run(); | 1960 base::MessageLoop::current()->Run(); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 1990 "Name on card:", "name_on_card", "Biggie Smalls", "text", &field); | 1990 "Name on card:", "name_on_card", "Biggie Smalls", "text", &field); |
| 1991 form.fields.push_back(field); | 1991 form.fields.push_back(field); |
| 1992 test::CreateTestFormField( | 1992 test::CreateTestFormField( |
| 1993 "Card Number:", "card_number", "4111 1111 1111 1111", "text", &field); | 1993 "Card Number:", "card_number", "4111 1111 1111 1111", "text", &field); |
| 1994 form.fields.push_back(field); | 1994 form.fields.push_back(field); |
| 1995 test::CreateTestFormField("Exp Month:", "exp_month", "01", "text", &field); | 1995 test::CreateTestFormField("Exp Month:", "exp_month", "01", "text", &field); |
| 1996 form.fields.push_back(field); | 1996 form.fields.push_back(field); |
| 1997 test::CreateTestFormField("Exp Year:", "exp_year", "2012", "text", &field); | 1997 test::CreateTestFormField("Exp Year:", "exp_year", "2012", "text", &field); |
| 1998 form.fields.push_back(field); | 1998 form.fields.push_back(field); |
| 1999 | 1999 |
| 2000 FormStructure form_structure(form, std::string()); | 2000 FormStructure form_structure(form); |
| 2001 form_structure.DetermineHeuristicTypes(TestAutofillMetrics()); | 2001 form_structure.DetermineHeuristicTypes(TestAutofillMetrics()); |
| 2002 const CreditCard* imported_credit_card; | 2002 const CreditCard* imported_credit_card; |
| 2003 EXPECT_TRUE(personal_data_->ImportFormData(form_structure, | 2003 EXPECT_TRUE(personal_data_->ImportFormData(form_structure, |
| 2004 &imported_credit_card)); | 2004 &imported_credit_card)); |
| 2005 ASSERT_FALSE(imported_credit_card); | 2005 ASSERT_FALSE(imported_credit_card); |
| 2006 | 2006 |
| 2007 // Since no refresh is expected, reload the data from the database to make | 2007 // Since no refresh is expected, reload the data from the database to make |
| 2008 // sure no changes were written out. | 2008 // sure no changes were written out. |
| 2009 ResetPersonalDataManager(); | 2009 ResetPersonalDataManager(); |
| 2010 | 2010 |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2273 form1.fields.push_back(field); | 2273 form1.fields.push_back(field); |
| 2274 test::CreateTestFormField("State:", "state", "California", "text", &field); | 2274 test::CreateTestFormField("State:", "state", "California", "text", &field); |
| 2275 form1.fields.push_back(field); | 2275 form1.fields.push_back(field); |
| 2276 test::CreateTestFormField( | 2276 test::CreateTestFormField( |
| 2277 "Zip:", "zip", "94102", "text", &field); | 2277 "Zip:", "zip", "94102", "text", &field); |
| 2278 form1.fields.push_back(field); | 2278 form1.fields.push_back(field); |
| 2279 test::CreateTestFormField( | 2279 test::CreateTestFormField( |
| 2280 "Phone number:", "phone_number", "817-555-6789", "text", &field); | 2280 "Phone number:", "phone_number", "817-555-6789", "text", &field); |
| 2281 form1.fields.push_back(field); | 2281 form1.fields.push_back(field); |
| 2282 | 2282 |
| 2283 FormStructure form_structure1(form1, std::string()); | 2283 FormStructure form_structure1(form1); |
| 2284 form_structure1.DetermineHeuristicTypes(TestAutofillMetrics()); | 2284 form_structure1.DetermineHeuristicTypes(TestAutofillMetrics()); |
| 2285 const CreditCard* imported_credit_card; | 2285 const CreditCard* imported_credit_card; |
| 2286 EXPECT_TRUE(personal_data_->ImportFormData(form_structure1, | 2286 EXPECT_TRUE(personal_data_->ImportFormData(form_structure1, |
| 2287 &imported_credit_card)); | 2287 &imported_credit_card)); |
| 2288 ASSERT_FALSE(imported_credit_card); | 2288 ASSERT_FALSE(imported_credit_card); |
| 2289 | 2289 |
| 2290 // Verify that the web database has been updated and the notification sent. | 2290 // Verify that the web database has been updated and the notification sent. |
| 2291 EXPECT_CALL(personal_data_observer_, | 2291 EXPECT_CALL(personal_data_observer_, |
| 2292 OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); | 2292 OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); |
| 2293 base::MessageLoop::current()->Run(); | 2293 base::MessageLoop::current()->Run(); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 2317 test::CreateTestFormField("City:", "city", "San Francisco", "text", &field); | 2317 test::CreateTestFormField("City:", "city", "San Francisco", "text", &field); |
| 2318 form2.fields.push_back(field); | 2318 form2.fields.push_back(field); |
| 2319 test::CreateTestFormField("State:", "state", "California", "text", &field); | 2319 test::CreateTestFormField("State:", "state", "California", "text", &field); |
| 2320 form2.fields.push_back(field); | 2320 form2.fields.push_back(field); |
| 2321 test::CreateTestFormField("Zip:", "zip", "94102", "text", &field); | 2321 test::CreateTestFormField("Zip:", "zip", "94102", "text", &field); |
| 2322 form2.fields.push_back(field); | 2322 form2.fields.push_back(field); |
| 2323 test::CreateTestFormField( | 2323 test::CreateTestFormField( |
| 2324 "Phone number:", "phone_number", "214-555-1234", "text", &field); | 2324 "Phone number:", "phone_number", "214-555-1234", "text", &field); |
| 2325 form2.fields.push_back(field); | 2325 form2.fields.push_back(field); |
| 2326 | 2326 |
| 2327 FormStructure form_structure2(form2, std::string()); | 2327 FormStructure form_structure2(form2); |
| 2328 form_structure2.DetermineHeuristicTypes(TestAutofillMetrics()); | 2328 form_structure2.DetermineHeuristicTypes(TestAutofillMetrics()); |
| 2329 EXPECT_TRUE(personal_data_->ImportFormData(form_structure2, | 2329 EXPECT_TRUE(personal_data_->ImportFormData(form_structure2, |
| 2330 &imported_credit_card)); | 2330 &imported_credit_card)); |
| 2331 ASSERT_FALSE(imported_credit_card); | 2331 ASSERT_FALSE(imported_credit_card); |
| 2332 | 2332 |
| 2333 // Verify that the web database has been updated and the notification sent. | 2333 // Verify that the web database has been updated and the notification sent. |
| 2334 EXPECT_CALL(personal_data_observer_, | 2334 EXPECT_CALL(personal_data_observer_, |
| 2335 OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); | 2335 OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); |
| 2336 base::MessageLoop::current()->Run(); | 2336 base::MessageLoop::current()->Run(); |
| 2337 | 2337 |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2411 // Removing shouldn't work. | 2411 // Removing shouldn't work. |
| 2412 personal_data_->RemoveByGUID(steve_jobs.guid()); | 2412 personal_data_->RemoveByGUID(steve_jobs.guid()); |
| 2413 personal_data_->RemoveByGUID(bill_gates.guid()); | 2413 personal_data_->RemoveByGUID(bill_gates.guid()); |
| 2414 | 2414 |
| 2415 ResetPersonalDataManager(); | 2415 ResetPersonalDataManager(); |
| 2416 EXPECT_EQ(1U, personal_data_->GetProfiles().size()); | 2416 EXPECT_EQ(1U, personal_data_->GetProfiles().size()); |
| 2417 EXPECT_EQ(1U, personal_data_->GetCreditCards().size()); | 2417 EXPECT_EQ(1U, personal_data_->GetCreditCards().size()); |
| 2418 } | 2418 } |
| 2419 | 2419 |
| 2420 } // namespace autofill | 2420 } // namespace autofill |
| OLD | NEW |