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