| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "base/ref_counted.h" | 9 #include "base/ref_counted.h" |
| 10 #include "base/scoped_ptr.h" | 10 #include "base/scoped_ptr.h" |
| (...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 517 autofill_test::CreateTestFormField( | 517 autofill_test::CreateTestFormField( |
| 518 "First name:", "first_name", "George", "text", &field); | 518 "First name:", "first_name", "George", "text", &field); |
| 519 form.fields.push_back(field); | 519 form.fields.push_back(field); |
| 520 autofill_test::CreateTestFormField( | 520 autofill_test::CreateTestFormField( |
| 521 "Last name:", "last_name", "Washington", "text", &field); | 521 "Last name:", "last_name", "Washington", "text", &field); |
| 522 form.fields.push_back(field); | 522 form.fields.push_back(field); |
| 523 autofill_test::CreateTestFormField( | 523 autofill_test::CreateTestFormField( |
| 524 "Email:", "email", "theprez@gmail.com", "text", &field); | 524 "Email:", "email", "theprez@gmail.com", "text", &field); |
| 525 form.fields.push_back(field); | 525 form.fields.push_back(field); |
| 526 FormStructure form_structure(form); | 526 FormStructure form_structure(form); |
| 527 std::vector<FormStructure*> forms; | 527 std::vector<const FormStructure*> forms; |
| 528 forms.push_back(&form_structure); | 528 forms.push_back(&form_structure); |
| 529 EXPECT_TRUE(personal_data_->ImportFormData(forms)); | 529 EXPECT_TRUE(personal_data_->ImportFormData(forms)); |
| 530 | 530 |
| 531 // Wait for the refresh. | 531 // Wait for the refresh. |
| 532 EXPECT_CALL(personal_data_observer_, | 532 EXPECT_CALL(personal_data_observer_, |
| 533 OnPersonalDataLoaded()).WillOnce(QuitUIMessageLoop()); | 533 OnPersonalDataLoaded()).WillOnce(QuitUIMessageLoop()); |
| 534 | 534 |
| 535 MessageLoop::current()->Run(); | 535 MessageLoop::current()->Run(); |
| 536 | 536 |
| 537 AutoFillProfile expected; | 537 AutoFillProfile expected; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 550 autofill_test::CreateTestFormField( | 550 autofill_test::CreateTestFormField( |
| 551 "First name:", "first_name", "George", "text", &field); | 551 "First name:", "first_name", "George", "text", &field); |
| 552 form.fields.push_back(field); | 552 form.fields.push_back(field); |
| 553 autofill_test::CreateTestFormField( | 553 autofill_test::CreateTestFormField( |
| 554 "Last name:", "last_name", "Washington", "text", &field); | 554 "Last name:", "last_name", "Washington", "text", &field); |
| 555 form.fields.push_back(field); | 555 form.fields.push_back(field); |
| 556 autofill_test::CreateTestFormField( | 556 autofill_test::CreateTestFormField( |
| 557 "Card number:", "card_number", "4111 1111 1111 1111", "text", &field); | 557 "Card number:", "card_number", "4111 1111 1111 1111", "text", &field); |
| 558 form.fields.push_back(field); | 558 form.fields.push_back(field); |
| 559 FormStructure form_structure(form); | 559 FormStructure form_structure(form); |
| 560 std::vector<FormStructure*> forms; | 560 std::vector<const FormStructure*> forms; |
| 561 forms.push_back(&form_structure); | 561 forms.push_back(&form_structure); |
| 562 EXPECT_FALSE(personal_data_->ImportFormData(forms)); | 562 EXPECT_FALSE(personal_data_->ImportFormData(forms)); |
| 563 | 563 |
| 564 // Wait for the refresh. | 564 // Wait for the refresh. |
| 565 EXPECT_CALL(personal_data_observer_, | 565 EXPECT_CALL(personal_data_observer_, |
| 566 OnPersonalDataLoaded()).WillOnce(QuitUIMessageLoop()); | 566 OnPersonalDataLoaded()).WillOnce(QuitUIMessageLoop()); |
| 567 | 567 |
| 568 const std::vector<AutoFillProfile*>& profiles = personal_data_->profiles(); | 568 const std::vector<AutoFillProfile*>& profiles = personal_data_->profiles(); |
| 569 ASSERT_EQ(0U, profiles.size()); | 569 ASSERT_EQ(0U, profiles.size()); |
| 570 const std::vector<CreditCard*>& credit_cards = personal_data_->credit_cards(); | 570 const std::vector<CreditCard*>& credit_cards = personal_data_->credit_cards(); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 586 form.fields.push_back(field); | 586 form.fields.push_back(field); |
| 587 autofill_test::CreateTestFormField( | 587 autofill_test::CreateTestFormField( |
| 588 "Phone #:", "home_phone_prefix", "555", "text", &field); | 588 "Phone #:", "home_phone_prefix", "555", "text", &field); |
| 589 field.set_max_length(3); | 589 field.set_max_length(3); |
| 590 form.fields.push_back(field); | 590 form.fields.push_back(field); |
| 591 autofill_test::CreateTestFormField( | 591 autofill_test::CreateTestFormField( |
| 592 "Phone #:", "home_phone_suffix", "0000", "text", &field); | 592 "Phone #:", "home_phone_suffix", "0000", "text", &field); |
| 593 field.set_max_length(4); | 593 field.set_max_length(4); |
| 594 form.fields.push_back(field); | 594 form.fields.push_back(field); |
| 595 FormStructure form_structure(form); | 595 FormStructure form_structure(form); |
| 596 std::vector<FormStructure*> forms; | 596 std::vector<const FormStructure*> forms; |
| 597 forms.push_back(&form_structure); | 597 forms.push_back(&form_structure); |
| 598 EXPECT_TRUE(personal_data_->ImportFormData(forms)); | 598 EXPECT_TRUE(personal_data_->ImportFormData(forms)); |
| 599 | 599 |
| 600 // Wait for the refresh. | 600 // Wait for the refresh. |
| 601 EXPECT_CALL(personal_data_observer_, | 601 EXPECT_CALL(personal_data_observer_, |
| 602 OnPersonalDataLoaded()).WillOnce(QuitUIMessageLoop()); | 602 OnPersonalDataLoaded()).WillOnce(QuitUIMessageLoop()); |
| 603 | 603 |
| 604 MessageLoop::current()->Run(); | 604 MessageLoop::current()->Run(); |
| 605 | 605 |
| 606 AutoFillProfile expected; | 606 AutoFillProfile expected; |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 679 "First name:", "first_name", "George", "text", &field); | 679 "First name:", "first_name", "George", "text", &field); |
| 680 form1.fields.push_back(field); | 680 form1.fields.push_back(field); |
| 681 autofill_test::CreateTestFormField( | 681 autofill_test::CreateTestFormField( |
| 682 "Last name:", "last_name", "Washington", "text", &field); | 682 "Last name:", "last_name", "Washington", "text", &field); |
| 683 form1.fields.push_back(field); | 683 form1.fields.push_back(field); |
| 684 autofill_test::CreateTestFormField( | 684 autofill_test::CreateTestFormField( |
| 685 "Email:", "email", "theprez@gmail.com", "text", &field); | 685 "Email:", "email", "theprez@gmail.com", "text", &field); |
| 686 form1.fields.push_back(field); | 686 form1.fields.push_back(field); |
| 687 | 687 |
| 688 FormStructure form_structure1(form1); | 688 FormStructure form_structure1(form1); |
| 689 std::vector<FormStructure*> forms; | 689 std::vector<const FormStructure*> forms; |
| 690 forms.push_back(&form_structure1); | 690 forms.push_back(&form_structure1); |
| 691 EXPECT_TRUE(personal_data_->ImportFormData(forms)); | 691 EXPECT_TRUE(personal_data_->ImportFormData(forms)); |
| 692 | 692 |
| 693 // Wait for the refresh. | 693 // Wait for the refresh. |
| 694 EXPECT_CALL(personal_data_observer_, | 694 EXPECT_CALL(personal_data_observer_, |
| 695 OnPersonalDataLoaded()).WillOnce(QuitUIMessageLoop()); | 695 OnPersonalDataLoaded()).WillOnce(QuitUIMessageLoop()); |
| 696 | 696 |
| 697 MessageLoop::current()->Run(); | 697 MessageLoop::current()->Run(); |
| 698 | 698 |
| 699 AutoFillProfile expected; | 699 AutoFillProfile expected; |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 755 form1.fields.push_back(field); | 755 form1.fields.push_back(field); |
| 756 autofill_test::CreateTestFormField( | 756 autofill_test::CreateTestFormField( |
| 757 "Email:", "email", "theprez@gmail.com", "text", &field); | 757 "Email:", "email", "theprez@gmail.com", "text", &field); |
| 758 form1.fields.push_back(field); | 758 form1.fields.push_back(field); |
| 759 // Phone gets updated. | 759 // Phone gets updated. |
| 760 autofill_test::CreateTestFormField( | 760 autofill_test::CreateTestFormField( |
| 761 "Phone:", "phone", "4445556666", "text", &field); | 761 "Phone:", "phone", "4445556666", "text", &field); |
| 762 form1.fields.push_back(field); | 762 form1.fields.push_back(field); |
| 763 | 763 |
| 764 FormStructure form_structure1(form1); | 764 FormStructure form_structure1(form1); |
| 765 std::vector<FormStructure*> forms; | 765 std::vector<const FormStructure*> forms; |
| 766 forms.push_back(&form_structure1); | 766 forms.push_back(&form_structure1); |
| 767 EXPECT_TRUE(personal_data_->ImportFormData(forms)); | 767 EXPECT_TRUE(personal_data_->ImportFormData(forms)); |
| 768 | 768 |
| 769 // Wait for the refresh. | 769 // Wait for the refresh. |
| 770 EXPECT_CALL(personal_data_observer_, | 770 EXPECT_CALL(personal_data_observer_, |
| 771 OnPersonalDataLoaded()).WillOnce(QuitUIMessageLoop()); | 771 OnPersonalDataLoaded()).WillOnce(QuitUIMessageLoop()); |
| 772 | 772 |
| 773 MessageLoop::current()->Run(); | 773 MessageLoop::current()->Run(); |
| 774 | 774 |
| 775 AutoFillProfile expected; | 775 AutoFillProfile expected; |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 834 "First name:", "first_name", "George", "text", &field); | 834 "First name:", "first_name", "George", "text", &field); |
| 835 form1.fields.push_back(field); | 835 form1.fields.push_back(field); |
| 836 autofill_test::CreateTestFormField( | 836 autofill_test::CreateTestFormField( |
| 837 "Last name:", "last_name", "Washington", "text", &field); | 837 "Last name:", "last_name", "Washington", "text", &field); |
| 838 form1.fields.push_back(field); | 838 form1.fields.push_back(field); |
| 839 autofill_test::CreateTestFormField( | 839 autofill_test::CreateTestFormField( |
| 840 "Email:", "email", "theprez@gmail.com", "text", &field); | 840 "Email:", "email", "theprez@gmail.com", "text", &field); |
| 841 form1.fields.push_back(field); | 841 form1.fields.push_back(field); |
| 842 | 842 |
| 843 FormStructure form_structure1(form1); | 843 FormStructure form_structure1(form1); |
| 844 std::vector<FormStructure*> forms; | 844 std::vector<const FormStructure*> forms; |
| 845 forms.push_back(&form_structure1); | 845 forms.push_back(&form_structure1); |
| 846 EXPECT_TRUE(personal_data_->ImportFormData(forms)); | 846 EXPECT_TRUE(personal_data_->ImportFormData(forms)); |
| 847 | 847 |
| 848 // Wait for the refresh. | 848 // Wait for the refresh. |
| 849 EXPECT_CALL(personal_data_observer_, | 849 EXPECT_CALL(personal_data_observer_, |
| 850 OnPersonalDataLoaded()).WillOnce(QuitUIMessageLoop()); | 850 OnPersonalDataLoaded()).WillOnce(QuitUIMessageLoop()); |
| 851 | 851 |
| 852 MessageLoop::current()->Run(); | 852 MessageLoop::current()->Run(); |
| 853 | 853 |
| 854 AutoFillProfile expected; | 854 AutoFillProfile expected; |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 911 "Last name:", "last_name", "Washington", "text", &field); | 911 "Last name:", "last_name", "Washington", "text", &field); |
| 912 form1.fields.push_back(field); | 912 form1.fields.push_back(field); |
| 913 autofill_test::CreateTestFormField( | 913 autofill_test::CreateTestFormField( |
| 914 "Company:", "company", "Government", "text", &field); | 914 "Company:", "company", "Government", "text", &field); |
| 915 form1.fields.push_back(field); | 915 form1.fields.push_back(field); |
| 916 autofill_test::CreateTestFormField( | 916 autofill_test::CreateTestFormField( |
| 917 "Email:", "email", "theprez@gmail.com", "text", &field); | 917 "Email:", "email", "theprez@gmail.com", "text", &field); |
| 918 form1.fields.push_back(field); | 918 form1.fields.push_back(field); |
| 919 | 919 |
| 920 FormStructure form_structure1(form1); | 920 FormStructure form_structure1(form1); |
| 921 std::vector<FormStructure*> forms; | 921 std::vector<const FormStructure*> forms; |
| 922 forms.push_back(&form_structure1); | 922 forms.push_back(&form_structure1); |
| 923 EXPECT_TRUE(personal_data_->ImportFormData(forms)); | 923 EXPECT_TRUE(personal_data_->ImportFormData(forms)); |
| 924 | 924 |
| 925 // Wait for the refresh. | 925 // Wait for the refresh. |
| 926 EXPECT_CALL(personal_data_observer_, | 926 EXPECT_CALL(personal_data_observer_, |
| 927 OnPersonalDataLoaded()).WillOnce(QuitUIMessageLoop()); | 927 OnPersonalDataLoaded()).WillOnce(QuitUIMessageLoop()); |
| 928 | 928 |
| 929 MessageLoop::current()->Run(); | 929 MessageLoop::current()->Run(); |
| 930 | 930 |
| 931 AutoFillProfile expected; | 931 AutoFillProfile expected; |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 979 "Card Number:", "card_number", "4111-1111-1111-1111", "text", &field); | 979 "Card Number:", "card_number", "4111-1111-1111-1111", "text", &field); |
| 980 form1.fields.push_back(field); | 980 form1.fields.push_back(field); |
| 981 autofill_test::CreateTestFormField( | 981 autofill_test::CreateTestFormField( |
| 982 "Exp Month:", "exp_month", "01", "text", &field); | 982 "Exp Month:", "exp_month", "01", "text", &field); |
| 983 form1.fields.push_back(field); | 983 form1.fields.push_back(field); |
| 984 autofill_test::CreateTestFormField( | 984 autofill_test::CreateTestFormField( |
| 985 "Exp Year:", "exp_year", "2011", "text", &field); | 985 "Exp Year:", "exp_year", "2011", "text", &field); |
| 986 form1.fields.push_back(field); | 986 form1.fields.push_back(field); |
| 987 | 987 |
| 988 FormStructure form_structure1(form1); | 988 FormStructure form_structure1(form1); |
| 989 std::vector<FormStructure*> forms; | 989 std::vector<const FormStructure*> forms; |
| 990 forms.push_back(&form_structure1); | 990 forms.push_back(&form_structure1); |
| 991 EXPECT_TRUE(personal_data_->ImportFormData(forms)); | 991 EXPECT_TRUE(personal_data_->ImportFormData(forms)); |
| 992 personal_data_->SaveImportedCreditCard(); | 992 personal_data_->SaveImportedCreditCard(); |
| 993 | 993 |
| 994 // Wait for the refresh. | 994 // Wait for the refresh. |
| 995 EXPECT_CALL(personal_data_observer_, | 995 EXPECT_CALL(personal_data_observer_, |
| 996 OnPersonalDataLoaded()).WillOnce(QuitUIMessageLoop()); | 996 OnPersonalDataLoaded()).WillOnce(QuitUIMessageLoop()); |
| 997 | 997 |
| 998 MessageLoop::current()->Run(); | 998 MessageLoop::current()->Run(); |
| 999 | 999 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1052 "Card Number:", "card_number", "4111-1111-1111-1111", "text", &field); | 1052 "Card Number:", "card_number", "4111-1111-1111-1111", "text", &field); |
| 1053 form1.fields.push_back(field); | 1053 form1.fields.push_back(field); |
| 1054 autofill_test::CreateTestFormField( | 1054 autofill_test::CreateTestFormField( |
| 1055 "Exp Month:", "exp_month", "01", "text", &field); | 1055 "Exp Month:", "exp_month", "01", "text", &field); |
| 1056 form1.fields.push_back(field); | 1056 form1.fields.push_back(field); |
| 1057 autofill_test::CreateTestFormField( | 1057 autofill_test::CreateTestFormField( |
| 1058 "Exp Year:", "exp_year", "2011", "text", &field); | 1058 "Exp Year:", "exp_year", "2011", "text", &field); |
| 1059 form1.fields.push_back(field); | 1059 form1.fields.push_back(field); |
| 1060 | 1060 |
| 1061 FormStructure form_structure1(form1); | 1061 FormStructure form_structure1(form1); |
| 1062 std::vector<FormStructure*> forms; | 1062 std::vector<const FormStructure*> forms; |
| 1063 forms.push_back(&form_structure1); | 1063 forms.push_back(&form_structure1); |
| 1064 EXPECT_TRUE(personal_data_->ImportFormData(forms)); | 1064 EXPECT_TRUE(personal_data_->ImportFormData(forms)); |
| 1065 personal_data_->SaveImportedCreditCard(); | 1065 personal_data_->SaveImportedCreditCard(); |
| 1066 | 1066 |
| 1067 // Wait for the refresh. | 1067 // Wait for the refresh. |
| 1068 EXPECT_CALL(personal_data_observer_, | 1068 EXPECT_CALL(personal_data_observer_, |
| 1069 OnPersonalDataLoaded()).WillOnce(QuitUIMessageLoop()); | 1069 OnPersonalDataLoaded()).WillOnce(QuitUIMessageLoop()); |
| 1070 | 1070 |
| 1071 MessageLoop::current()->Run(); | 1071 MessageLoop::current()->Run(); |
| 1072 | 1072 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1117 "Card Number:", "card_number", "4111-1111-1111-1111", "text", &field); | 1117 "Card Number:", "card_number", "4111-1111-1111-1111", "text", &field); |
| 1118 form1.fields.push_back(field); | 1118 form1.fields.push_back(field); |
| 1119 autofill_test::CreateTestFormField( | 1119 autofill_test::CreateTestFormField( |
| 1120 "Exp Month:", "exp_month", "01", "text", &field); | 1120 "Exp Month:", "exp_month", "01", "text", &field); |
| 1121 form1.fields.push_back(field); | 1121 form1.fields.push_back(field); |
| 1122 autofill_test::CreateTestFormField( | 1122 autofill_test::CreateTestFormField( |
| 1123 "Exp Year:", "exp_year", "2011", "text", &field); | 1123 "Exp Year:", "exp_year", "2011", "text", &field); |
| 1124 form1.fields.push_back(field); | 1124 form1.fields.push_back(field); |
| 1125 | 1125 |
| 1126 FormStructure form_structure1(form1); | 1126 FormStructure form_structure1(form1); |
| 1127 std::vector<FormStructure*> forms; | 1127 std::vector<const FormStructure*> forms; |
| 1128 forms.push_back(&form_structure1); | 1128 forms.push_back(&form_structure1); |
| 1129 EXPECT_TRUE(personal_data_->ImportFormData(forms)); | 1129 EXPECT_TRUE(personal_data_->ImportFormData(forms)); |
| 1130 personal_data_->SaveImportedCreditCard(); | 1130 personal_data_->SaveImportedCreditCard(); |
| 1131 | 1131 |
| 1132 // Wait for the refresh. | 1132 // Wait for the refresh. |
| 1133 EXPECT_CALL(personal_data_observer_, | 1133 EXPECT_CALL(personal_data_observer_, |
| 1134 OnPersonalDataLoaded()).WillOnce(QuitUIMessageLoop()); | 1134 OnPersonalDataLoaded()).WillOnce(QuitUIMessageLoop()); |
| 1135 | 1135 |
| 1136 MessageLoop::current()->Run(); | 1136 MessageLoop::current()->Run(); |
| 1137 | 1137 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1192 "Card Number:", "card_number", "4111-1111-1111-1111", "text", &field); | 1192 "Card Number:", "card_number", "4111-1111-1111-1111", "text", &field); |
| 1193 form1.fields.push_back(field); | 1193 form1.fields.push_back(field); |
| 1194 autofill_test::CreateTestFormField( | 1194 autofill_test::CreateTestFormField( |
| 1195 "Exp Month:", "exp_month", "01", "text", &field); | 1195 "Exp Month:", "exp_month", "01", "text", &field); |
| 1196 form1.fields.push_back(field); | 1196 form1.fields.push_back(field); |
| 1197 autofill_test::CreateTestFormField( | 1197 autofill_test::CreateTestFormField( |
| 1198 "Exp Year:", "exp_year", "2011", "text", &field); | 1198 "Exp Year:", "exp_year", "2011", "text", &field); |
| 1199 form1.fields.push_back(field); | 1199 form1.fields.push_back(field); |
| 1200 | 1200 |
| 1201 FormStructure form_structure1(form1); | 1201 FormStructure form_structure1(form1); |
| 1202 std::vector<FormStructure*> forms; | 1202 std::vector<const FormStructure*> forms; |
| 1203 forms.push_back(&form_structure1); | 1203 forms.push_back(&form_structure1); |
| 1204 EXPECT_TRUE(personal_data_->ImportFormData(forms)); | 1204 EXPECT_TRUE(personal_data_->ImportFormData(forms)); |
| 1205 personal_data_->SaveImportedCreditCard(); | 1205 personal_data_->SaveImportedCreditCard(); |
| 1206 | 1206 |
| 1207 // Wait for the refresh. | 1207 // Wait for the refresh. |
| 1208 EXPECT_CALL(personal_data_observer_, | 1208 EXPECT_CALL(personal_data_observer_, |
| 1209 OnPersonalDataLoaded()).WillOnce(QuitUIMessageLoop()); | 1209 OnPersonalDataLoaded()).WillOnce(QuitUIMessageLoop()); |
| 1210 | 1210 |
| 1211 MessageLoop::current()->Run(); | 1211 MessageLoop::current()->Run(); |
| 1212 | 1212 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1258 "Card Number:", "card_number", "4111-1111-1111-1111", "text", &field); | 1258 "Card Number:", "card_number", "4111-1111-1111-1111", "text", &field); |
| 1259 form1.fields.push_back(field); | 1259 form1.fields.push_back(field); |
| 1260 autofill_test::CreateTestFormField( | 1260 autofill_test::CreateTestFormField( |
| 1261 "Exp Month:", "exp_month", "01", "text", &field); | 1261 "Exp Month:", "exp_month", "01", "text", &field); |
| 1262 form1.fields.push_back(field); | 1262 form1.fields.push_back(field); |
| 1263 autofill_test::CreateTestFormField( | 1263 autofill_test::CreateTestFormField( |
| 1264 "Exp Year:", "exp_year", "2011", "text", &field); | 1264 "Exp Year:", "exp_year", "2011", "text", &field); |
| 1265 form1.fields.push_back(field); | 1265 form1.fields.push_back(field); |
| 1266 | 1266 |
| 1267 FormStructure form_structure1(form1); | 1267 FormStructure form_structure1(form1); |
| 1268 std::vector<FormStructure*> forms; | 1268 std::vector<const FormStructure*> forms; |
| 1269 forms.push_back(&form_structure1); | 1269 forms.push_back(&form_structure1); |
| 1270 EXPECT_TRUE(personal_data_->ImportFormData(forms)); | 1270 EXPECT_TRUE(personal_data_->ImportFormData(forms)); |
| 1271 personal_data_->SaveImportedCreditCard(); | 1271 personal_data_->SaveImportedCreditCard(); |
| 1272 | 1272 |
| 1273 // Wait for the refresh. | 1273 // Wait for the refresh. |
| 1274 EXPECT_CALL(personal_data_observer_, | 1274 EXPECT_CALL(personal_data_observer_, |
| 1275 OnPersonalDataLoaded()).WillOnce(QuitUIMessageLoop()); | 1275 OnPersonalDataLoaded()).WillOnce(QuitUIMessageLoop()); |
| 1276 | 1276 |
| 1277 MessageLoop::current()->Run(); | 1277 MessageLoop::current()->Run(); |
| 1278 | 1278 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1324 "Card Number:", "card_number", "4111-1111-1111-1111", "text", &field); | 1324 "Card Number:", "card_number", "4111-1111-1111-1111", "text", &field); |
| 1325 form1.fields.push_back(field); | 1325 form1.fields.push_back(field); |
| 1326 autofill_test::CreateTestFormField( | 1326 autofill_test::CreateTestFormField( |
| 1327 "Exp Month:", "exp_month", "01", "text", &field); | 1327 "Exp Month:", "exp_month", "01", "text", &field); |
| 1328 form1.fields.push_back(field); | 1328 form1.fields.push_back(field); |
| 1329 autofill_test::CreateTestFormField( | 1329 autofill_test::CreateTestFormField( |
| 1330 "Exp Year:", "exp_year", "2011", "text", &field); | 1330 "Exp Year:", "exp_year", "2011", "text", &field); |
| 1331 form1.fields.push_back(field); | 1331 form1.fields.push_back(field); |
| 1332 | 1332 |
| 1333 FormStructure form_structure1(form1); | 1333 FormStructure form_structure1(form1); |
| 1334 std::vector<FormStructure*> forms; | 1334 std::vector<const FormStructure*> forms; |
| 1335 forms.push_back(&form_structure1); | 1335 forms.push_back(&form_structure1); |
| 1336 EXPECT_TRUE(personal_data_->ImportFormData(forms)); | 1336 EXPECT_TRUE(personal_data_->ImportFormData(forms)); |
| 1337 personal_data_->SaveImportedCreditCard(); | 1337 personal_data_->SaveImportedCreditCard(); |
| 1338 | 1338 |
| 1339 // Wait for the refresh. | 1339 // Wait for the refresh. |
| 1340 EXPECT_CALL(personal_data_observer_, | 1340 EXPECT_CALL(personal_data_observer_, |
| 1341 OnPersonalDataLoaded()).WillOnce(QuitUIMessageLoop()); | 1341 OnPersonalDataLoaded()).WillOnce(QuitUIMessageLoop()); |
| 1342 | 1342 |
| 1343 MessageLoop::current()->Run(); | 1343 MessageLoop::current()->Run(); |
| 1344 | 1344 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1379 | 1379 |
| 1380 // Expect that the newer information is saved. In this case the year is | 1380 // Expect that the newer information is saved. In this case the year is |
| 1381 // added to the existing credit card. | 1381 // added to the existing credit card. |
| 1382 CreditCard expected2; | 1382 CreditCard expected2; |
| 1383 autofill_test::SetCreditCardInfo(&expected2, | 1383 autofill_test::SetCreditCardInfo(&expected2, |
| 1384 "L1", "Biggie Smalls", "4111111111111111", "01", "2011"); | 1384 "L1", "Biggie Smalls", "4111111111111111", "01", "2011"); |
| 1385 const std::vector<CreditCard*>& results2 = personal_data_->credit_cards(); | 1385 const std::vector<CreditCard*>& results2 = personal_data_->credit_cards(); |
| 1386 ASSERT_EQ(1U, results2.size()); | 1386 ASSERT_EQ(1U, results2.size()); |
| 1387 EXPECT_EQ(0, expected2.Compare(*results2[0])); | 1387 EXPECT_EQ(0, expected2.Compare(*results2[0])); |
| 1388 } | 1388 } |
| OLD | NEW |