OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 874 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
885 translation_observer.Wait(); | 885 translation_observer.Wait(); |
886 | 886 |
887 TryBasicFormFill(); | 887 TryBasicFormFill(); |
888 } | 888 } |
889 | 889 |
890 // Test filling profiles with unicode strings and crazy characters. | 890 // Test filling profiles with unicode strings and crazy characters. |
891 // TODO(isherman): rewrite as unit test under PersonalDataManagerTest. | 891 // TODO(isherman): rewrite as unit test under PersonalDataManagerTest. |
892 IN_PROC_BROWSER_TEST_F(AutofillTest, FillProfileCrazyCharacters) { | 892 IN_PROC_BROWSER_TEST_F(AutofillTest, FillProfileCrazyCharacters) { |
893 std::vector<AutofillProfile> profiles; | 893 std::vector<AutofillProfile> profiles; |
894 AutofillProfile profile1; | 894 AutofillProfile profile1; |
895 profile1.SetInfo(NAME_FIRST, WideToUTF16(L"\u0623\u0648\u0628\u0627\u0645\u062
7 \u064a\u0639\u062a\u0630\u0631 \u0647\u0627\u062a\u0641\u064a\u0627 \u0644\u06
45\u0648\u0638\u0641\u0629 \u0633\u0648\u062f\u0627\u0621 \u0627\u0633\u062a\u06
42\u0627\u0644\u062a \u0628\u0633\u0628\u0628 \u062a\u0635\u0631\u064a\u062d\u06
27\u062a \u0645\u062c\u062a\u0632\u0623\u0629")); | 895 profile1.SetRawInfo(NAME_FIRST, |
896 profile1.SetInfo(NAME_MIDDLE, WideToUTF16(L"BANK\xcBERF\xc4LLE")); | 896 WideToUTF16(L"\u0623\u0648\u0628\u0627\u0645\u0627 " |
897 profile1.SetInfo(EMAIL_ADDRESS, WideToUTF16(L"\uacbd\uc81c \ub274\uc2a4 \ub354
\ubcf4\uae30@google.com")); | 897 L"\u064a\u0639\u062a\u0630\u0631 " |
898 profile1.SetInfo(ADDRESS_HOME_LINE1, WideToUTF16(L"\uad6d\uc815\uc6d0\xb7\uac8
0\ucc30, \ub178\ubb34\ud604\uc815\ubd80 \ub300\ubd81\uc811\ucd09 \ub2f4\ub2f9 \u
c778\uc0ac\ub4e4 \uc870\uc0ac")); | 898 L"\u0647\u0627\u062a\u0641\u064a\u0627 " |
899 profile1.SetInfo(ADDRESS_HOME_CITY, WideToUTF16(L"\u653f\u5e9c\u4e0d\u6392\u96
64\u7acb\u6cd5\u898f\u7ba1\u5c0e\u904a")); | 899 L"\u0644\u0645\u0648\u0638\u0641\u0629 " |
900 profile1.SetInfo(ADDRESS_HOME_ZIP, WideToUTF16(L"YOHO_54676")); | 900 L"\u0633\u0648\u062f\u0627\u0621 " |
901 profile1.SetInfo(PHONE_HOME_WHOLE_NUMBER, WideToUTF16(L"861088828000")); | 901 L"\u0627\u0633\u062a\u0642\u0627\u0644\u062a " |
902 profile1.SetInfo(ADDRESS_HOME_COUNTRY, WideToUTF16(L"India")); | 902 L"\u0628\u0633\u0628\u0628 " |
| 903 L"\u062a\u0635\u0631\u064a\u062d\u0627\u062a " |
| 904 L"\u0645\u062c\u062a\u0632\u0623\u0629")); |
| 905 profile1.SetRawInfo(NAME_MIDDLE, WideToUTF16(L"BANK\xcBERF\xc4LLE")); |
| 906 profile1.SetRawInfo(EMAIL_ADDRESS, |
| 907 WideToUTF16(L"\uacbd\uc81c \ub274\uc2a4 " |
| 908 L"\ub354\ubcf4\uae30@google.com")); |
| 909 profile1.SetRawInfo(ADDRESS_HOME_LINE1, |
| 910 WideToUTF16(L"\uad6d\uc815\uc6d0\xb7\uac80\ucc30, " |
| 911 L"\ub178\ubb34\ud604\uc815\ubd80 " |
| 912 L"\ub300\ubd81\uc811\ucd09 \ub2f4\ub2f9 " |
| 913 L"\uc778\uc0ac\ub4e4 \uc870\uc0ac")); |
| 914 profile1.SetRawInfo(ADDRESS_HOME_CITY, |
| 915 WideToUTF16(L"\u653f\u5e9c\u4e0d\u6392\u9664\u7acb\u6cd5" |
| 916 L"\u898f\u7ba1\u5c0e\u904a")); |
| 917 profile1.SetRawInfo(ADDRESS_HOME_ZIP, WideToUTF16(L"YOHO_54676")); |
| 918 profile1.SetRawInfo(PHONE_HOME_WHOLE_NUMBER, WideToUTF16(L"861088828000")); |
| 919 profile1.SetRawInfo(ADDRESS_HOME_COUNTRY, WideToUTF16(L"India")); |
903 profiles.push_back(profile1); | 920 profiles.push_back(profile1); |
904 | 921 |
905 AutofillProfile profile2; | 922 AutofillProfile profile2; |
906 profile2.SetInfo(NAME_FIRST, WideToUTF16(L"\u4e0a\u6d77\u5e02\u91d1\u5c71\u533
a \u677e\u9690\u9547\u4ead\u67ab\u516c\u8def1915\u53f7")); | 923 profile2.SetRawInfo(NAME_FIRST, |
907 profile2.SetInfo(NAME_LAST, WideToUTF16(L"aguantó")); | 924 WideToUTF16(L"\u4e0a\u6d77\u5e02\u91d1\u5c71\u533a " |
908 profile2.SetInfo(ADDRESS_HOME_ZIP, WideToUTF16(L"HOME 94043")); | 925 L"\u677e\u9690\u9547\u4ead\u67ab\u516c" |
| 926 L"\u8def1915\u53f7")); |
| 927 profile2.SetRawInfo(NAME_LAST, WideToUTF16(L"aguantó")); |
| 928 profile2.SetRawInfo(ADDRESS_HOME_ZIP, WideToUTF16(L"HOME 94043")); |
909 profiles.push_back(profile2); | 929 profiles.push_back(profile2); |
910 | 930 |
911 AutofillProfile profile3; | 931 AutofillProfile profile3; |
912 profile3.SetInfo(EMAIL_ADDRESS, WideToUTF16(L"sue@example.com")); | 932 profile3.SetRawInfo(EMAIL_ADDRESS, WideToUTF16(L"sue@example.com")); |
913 profile3.SetInfo(COMPANY_NAME, WideToUTF16(L"Company X")); | 933 profile3.SetRawInfo(COMPANY_NAME, WideToUTF16(L"Company X")); |
914 profiles.push_back(profile3); | 934 profiles.push_back(profile3); |
915 | 935 |
916 AutofillProfile profile4; | 936 AutofillProfile profile4; |
917 profile4.SetInfo(NAME_FIRST, WideToUTF16(L"Joe 3254")); | 937 profile4.SetRawInfo(NAME_FIRST, WideToUTF16(L"Joe 3254")); |
918 profile4.SetInfo(NAME_LAST, WideToUTF16(L"\u8bb0\u8d262\u5e74\u591a")); | 938 profile4.SetRawInfo(NAME_LAST, WideToUTF16(L"\u8bb0\u8d262\u5e74\u591a")); |
919 profile4.SetInfo(ADDRESS_HOME_ZIP, WideToUTF16(L"\uff08\u90ae\u7f16\uff1a20150
4\uff09")); | 939 profile4.SetRawInfo(ADDRESS_HOME_ZIP, |
920 profile4.SetInfo(EMAIL_ADDRESS, WideToUTF16(L"télévision@example.com")); | 940 WideToUTF16(L"\uff08\u90ae\u7f16\uff1a201504\uff09")); |
921 profile4.SetInfo(COMPANY_NAME, WideToUTF16(L"\u0907\u0932\u0947\u0915\u093f\u0
91f\u094d\u0930\u0928\u093f\u0915\u094d\u0938, \u0905\u092a\u094b\u0932\u094b \u
091f\u093e\u092f\u0930\u094d\u0938 \u0906\u0926\u093f")); | 941 profile4.SetRawInfo(EMAIL_ADDRESS, WideToUTF16(L"télévision@example.com")); |
| 942 profile4.SetRawInfo(COMPANY_NAME, |
| 943 WideToUTF16(L"\u0907\u0932\u0947\u0915\u093f\u091f\u094d" |
| 944 L"\u0930\u0928\u093f\u0915\u094d\u0938, " |
| 945 L"\u0905\u092a\u094b\u0932\u094b " |
| 946 L"\u091f\u093e\u092f\u0930\u094d\u0938 " |
| 947 L"\u0906\u0926\u093f")); |
922 profiles.push_back(profile4); | 948 profiles.push_back(profile4); |
923 | 949 |
924 AutofillProfile profile5; | 950 AutofillProfile profile5; |
925 profile5.SetInfo(NAME_FIRST, WideToUTF16(L"Larry")); | 951 profile5.SetRawInfo(NAME_FIRST, WideToUTF16(L"Larry")); |
926 profile5.SetInfo(NAME_LAST, WideToUTF16(L"\u0938\u094d\u091f\u093e\u0902\u092a
\u0921\u094d\u092f\u0942\u091f\u0940")); | 952 profile5.SetRawInfo(NAME_LAST, |
927 profile5.SetInfo(ADDRESS_HOME_ZIP, WideToUTF16(L"111111111111110000GOOGLE")); | 953 WideToUTF16(L"\u0938\u094d\u091f\u093e\u0902\u092a " |
928 profile5.SetInfo(EMAIL_ADDRESS, WideToUTF16(L"page@000000.com")); | 954 L"\u0921\u094d\u092f\u0942\u091f\u0940")); |
929 profile5.SetInfo(COMPANY_NAME, WideToUTF16(L"Google")); | 955 profile5.SetRawInfo(ADDRESS_HOME_ZIP, |
| 956 WideToUTF16(L"111111111111110000GOOGLE")); |
| 957 profile5.SetRawInfo(EMAIL_ADDRESS, WideToUTF16(L"page@000000.com")); |
| 958 profile5.SetRawInfo(COMPANY_NAME, WideToUTF16(L"Google")); |
930 profiles.push_back(profile5); | 959 profiles.push_back(profile5); |
931 | 960 |
932 AutofillProfile profile6; | 961 AutofillProfile profile6; |
933 profile6.SetInfo(NAME_FIRST, WideToUTF16(L"\u4e0a\u6d77\u5e02\u91d1\u5c71\u533
a \u677e\u9690\u9547\u4ead\u67ab\u516c\u8def1915\u53f7")); | 962 profile6.SetRawInfo(NAME_FIRST, |
934 profile6.SetInfo(NAME_LAST, WideToUTF16(L"\u0646\u062c\u0627\u0645\u064a\u0646
\u0627 \u062f\u0639\u0645\u0647\u0627 \u0644\u0644\u0631\u0626\u064a\u0633 \u062
7\u0644\u0633\u0648\u062f\u0627\u0646\u064a \u0639\u0645\u0631 \u0627\u0644\u062
8\u0634\u064a\u0631")); | 963 WideToUTF16(L"\u4e0a\u6d77\u5e02\u91d1\u5c71\u533a " |
935 profile6.SetInfo(ADDRESS_HOME_ZIP, WideToUTF16(L"HOME 94043")); | 964 L"\u677e\u9690\u9547\u4ead\u67ab\u516c" |
| 965 L"\u8def1915\u53f7")); |
| 966 profile6.SetRawInfo(NAME_LAST, |
| 967 WideToUTF16(L"\u0646\u062c\u0627\u0645\u064a\u0646\u0627 " |
| 968 L"\u062f\u0639\u0645\u0647\u0627 " |
| 969 L"\u0644\u0644\u0631\u0626\u064a\u0633 " |
| 970 L"\u0627\u0644\u0633\u0648\u062f\u0627\u0646" |
| 971 L"\u064a \u0639\u0645\u0631 " |
| 972 L"\u0627\u0644\u0628\u0634\u064a\u0631")); |
| 973 profile6.SetRawInfo(ADDRESS_HOME_ZIP, WideToUTF16(L"HOME 94043")); |
936 profiles.push_back(profile6); | 974 profiles.push_back(profile6); |
937 | 975 |
938 AutofillProfile profile7; | 976 AutofillProfile profile7; |
939 profile7.SetInfo(NAME_FIRST, WideToUTF16(L"&$%$$$ TESTO *&*&^&^& MOKO")); | 977 profile7.SetRawInfo(NAME_FIRST, WideToUTF16(L"&$%$$$ TESTO *&*&^&^& MOKO")); |
940 profile7.SetInfo(NAME_MIDDLE, WideToUTF16(L"WOHOOOO$$$$$$$$****")); | 978 profile7.SetRawInfo(NAME_MIDDLE, WideToUTF16(L"WOHOOOO$$$$$$$$****")); |
941 profile7.SetInfo(EMAIL_ADDRESS, WideToUTF16(L"yuvu@example.com")); | 979 profile7.SetRawInfo(EMAIL_ADDRESS, WideToUTF16(L"yuvu@example.com")); |
942 profile7.SetInfo(ADDRESS_HOME_LINE1, WideToUTF16(L"34544, anderson ST.(120230)
")); | 980 profile7.SetRawInfo(ADDRESS_HOME_LINE1, |
943 profile7.SetInfo(ADDRESS_HOME_CITY, WideToUTF16(L"Sunnyvale")); | 981 WideToUTF16(L"34544, anderson ST.(120230)")); |
944 profile7.SetInfo(ADDRESS_HOME_STATE, WideToUTF16(L"CA")); | 982 profile7.SetRawInfo(ADDRESS_HOME_CITY, WideToUTF16(L"Sunnyvale")); |
945 profile7.SetInfo(ADDRESS_HOME_ZIP, WideToUTF16(L"94086")); | 983 profile7.SetRawInfo(ADDRESS_HOME_STATE, WideToUTF16(L"CA")); |
946 profile7.SetInfo(PHONE_HOME_WHOLE_NUMBER, WideToUTF16(L"15466784565")); | 984 profile7.SetRawInfo(ADDRESS_HOME_ZIP, WideToUTF16(L"94086")); |
947 profile7.SetInfo(ADDRESS_HOME_COUNTRY, WideToUTF16(L"United States")); | 985 profile7.SetRawInfo(PHONE_HOME_WHOLE_NUMBER, WideToUTF16(L"15466784565")); |
| 986 profile7.SetRawInfo(ADDRESS_HOME_COUNTRY, WideToUTF16(L"United States")); |
948 profiles.push_back(profile7); | 987 profiles.push_back(profile7); |
949 | 988 |
950 SetProfiles(&profiles); | 989 SetProfiles(&profiles); |
951 ASSERT_EQ(profiles.size(), personal_data_manager()->profiles().size()); | 990 ASSERT_EQ(profiles.size(), personal_data_manager()->profiles().size()); |
952 for (size_t i = 0; i < profiles.size(); ++i) | 991 for (size_t i = 0; i < profiles.size(); ++i) |
953 ASSERT_EQ(profiles[i], *personal_data_manager()->profiles()[i]); | 992 ASSERT_EQ(profiles[i], *personal_data_manager()->profiles()[i]); |
954 | 993 |
955 std::vector<CreditCard> cards; | 994 std::vector<CreditCard> cards; |
956 CreditCard card1; | 995 CreditCard card1; |
957 card1.SetInfo(CREDIT_CARD_NAME, WideToUTF16(L"\u751f\u6d3b\u5f88\u6709\u89c4\u
5f8b \u4ee5\u73a9\u4e3a\u4e3b")); | 996 card1.SetRawInfo(CREDIT_CARD_NAME, |
958 card1.SetInfo(CREDIT_CARD_NUMBER, WideToUTF16(L"6011111111111117")); | 997 WideToUTF16(L"\u751f\u6d3b\u5f88\u6709\u89c4\u5f8b " |
959 card1.SetInfo(CREDIT_CARD_EXP_MONTH, WideToUTF16(L"12")); | 998 L"\u4ee5\u73a9\u4e3a\u4e3b")); |
960 card1.SetInfo(CREDIT_CARD_EXP_4_DIGIT_YEAR, WideToUTF16(L"2011")); | 999 card1.SetRawInfo(CREDIT_CARD_NUMBER, WideToUTF16(L"6011111111111117")); |
| 1000 card1.SetRawInfo(CREDIT_CARD_EXP_MONTH, WideToUTF16(L"12")); |
| 1001 card1.SetRawInfo(CREDIT_CARD_EXP_4_DIGIT_YEAR, WideToUTF16(L"2011")); |
961 cards.push_back(card1); | 1002 cards.push_back(card1); |
962 | 1003 |
963 CreditCard card2; | 1004 CreditCard card2; |
964 card2.SetInfo(CREDIT_CARD_NAME, WideToUTF16(L"John Williams")); | 1005 card2.SetRawInfo(CREDIT_CARD_NAME, WideToUTF16(L"John Williams")); |
965 card2.SetInfo(CREDIT_CARD_NUMBER, WideToUTF16(L"WokoAwesome12345")); | 1006 card2.SetRawInfo(CREDIT_CARD_NUMBER, WideToUTF16(L"WokoAwesome12345")); |
966 card2.SetInfo(CREDIT_CARD_EXP_MONTH, WideToUTF16(L"10")); | 1007 card2.SetRawInfo(CREDIT_CARD_EXP_MONTH, WideToUTF16(L"10")); |
967 card2.SetInfo(CREDIT_CARD_EXP_4_DIGIT_YEAR, WideToUTF16(L"2015")); | 1008 card2.SetRawInfo(CREDIT_CARD_EXP_4_DIGIT_YEAR, WideToUTF16(L"2015")); |
968 cards.push_back(card2); | 1009 cards.push_back(card2); |
969 | 1010 |
970 CreditCard card3; | 1011 CreditCard card3; |
971 card3.SetInfo(CREDIT_CARD_NAME, WideToUTF16(L"\u0623\u062d\u0645\u062f\u064a \
u0646\u062c\u0627\u062f \u0644\u0645\u062d\u0627\u0648\u0644\u0647 \u0627\u063a\
u062a\u064a\u0627\u0644 \u0641\u064a \u0645\u062f\u064a\u0646\u0629 \u0647\u0645
\u062f\u0627\u0646 ")); | 1012 card3.SetRawInfo(CREDIT_CARD_NAME, |
972 card3.SetInfo(CREDIT_CARD_NUMBER, WideToUTF16(L"\u092a\u0941\u0928\u0930\u094d
\u091c\u0940\u0935\u093f\u0924 \u0939\u094b\u0917\u093e \u0928\u093e\u0932\u0902
\u0926\u093e")); | 1013 WideToUTF16(L"\u0623\u062d\u0645\u062f\u064a " |
973 card3.SetInfo(CREDIT_CARD_EXP_MONTH, WideToUTF16(L"10")); | 1014 L"\u0646\u062c\u0627\u062f " |
974 card3.SetInfo(CREDIT_CARD_EXP_4_DIGIT_YEAR, WideToUTF16(L"2015")); | 1015 L"\u0644\u0645\u062d\u0627\u0648\u0644\u0647 " |
| 1016 L"\u0627\u063a\u062a\u064a\u0627\u0644 " |
| 1017 L"\u0641\u064a \u0645\u062f\u064a\u0646\u0629 " |
| 1018 L"\u0647\u0645\u062f\u0627\u0646 ")); |
| 1019 card3.SetRawInfo(CREDIT_CARD_NUMBER, |
| 1020 WideToUTF16(L"\u092a\u0941\u0928\u0930\u094d\u091c\u0940" |
| 1021 L"\u0935\u093f\u0924 \u0939\u094b\u0917\u093e " |
| 1022 L"\u0928\u093e\u0932\u0902\u0926\u093e")); |
| 1023 card3.SetRawInfo(CREDIT_CARD_EXP_MONTH, WideToUTF16(L"10")); |
| 1024 card3.SetRawInfo(CREDIT_CARD_EXP_4_DIGIT_YEAR, WideToUTF16(L"2015")); |
975 cards.push_back(card3); | 1025 cards.push_back(card3); |
976 | 1026 |
977 CreditCard card4; | 1027 CreditCard card4; |
978 card4.SetInfo(CREDIT_CARD_NAME, WideToUTF16(L"\u039d\u03ad\u03b5\u03c2 \u03c3\
u03c5\u03b3\u03c7\u03c9\u03bd\u03b5\u03cd\u03c3\u03b5\u03b9\u03c2 \u03ba\u03b1\u
03b9 \u03ba\u03b1\u03c4\u03b1\u03c1\u03b3\u03ae\u03c3\u03b5\u03b9\u03c2")); | 1028 card4.SetRawInfo(CREDIT_CARD_NAME, |
979 card4.SetInfo(CREDIT_CARD_NUMBER, WideToUTF16(L"00000000000000000000000")); | 1029 WideToUTF16(L"\u039d\u03ad\u03b5\u03c2 " |
980 card4.SetInfo(CREDIT_CARD_EXP_MONTH, WideToUTF16(L"01")); | 1030 L"\u03c3\u03c5\u03b3\u03c7\u03c9\u03bd\u03b5" |
981 card4.SetInfo(CREDIT_CARD_EXP_4_DIGIT_YEAR, WideToUTF16(L"2016")); | 1031 L"\u03cd\u03c3\u03b5\u03b9\u03c2 " |
| 1032 L"\u03ba\u03b1\u03b9 " |
| 1033 L"\u03ba\u03b1\u03c4\u03b1\u03c1\u03b3\u03ae" |
| 1034 L"\u03c3\u03b5\u03b9\u03c2")); |
| 1035 card4.SetRawInfo(CREDIT_CARD_NUMBER, WideToUTF16(L"00000000000000000000000")); |
| 1036 card4.SetRawInfo(CREDIT_CARD_EXP_MONTH, WideToUTF16(L"01")); |
| 1037 card4.SetRawInfo(CREDIT_CARD_EXP_4_DIGIT_YEAR, WideToUTF16(L"2016")); |
982 cards.push_back(card4); | 1038 cards.push_back(card4); |
983 | 1039 |
984 SetCards(&cards); | 1040 SetCards(&cards); |
985 ASSERT_EQ(cards.size(), personal_data_manager()->credit_cards().size()); | 1041 ASSERT_EQ(cards.size(), personal_data_manager()->credit_cards().size()); |
986 for (size_t i = 0; i < cards.size(); ++i) | 1042 for (size_t i = 0; i < cards.size(); ++i) |
987 ASSERT_EQ(cards[i], *personal_data_manager()->credit_cards()[i]); | 1043 ASSERT_EQ(cards[i], *personal_data_manager()->credit_cards()[i]); |
988 } | 1044 } |
989 | 1045 |
990 // Test filling in invalid values for profiles are saved as-is. Phone | 1046 // Test filling in invalid values for profiles are saved as-is. Phone |
991 // information entered into the prefs UI is not validated or rejected except for | 1047 // information entered into the prefs UI is not validated or rejected except for |
992 // duplicates. | 1048 // duplicates. |
993 // TODO(isherman): rewrite as WebUI test? | 1049 // TODO(isherman): rewrite as WebUI test? |
994 IN_PROC_BROWSER_TEST_F(AutofillTest, Invalid) { | 1050 IN_PROC_BROWSER_TEST_F(AutofillTest, Invalid) { |
995 // First try profiles with invalid ZIP input. | 1051 // First try profiles with invalid ZIP input. |
996 AutofillProfile without_invalid; | 1052 AutofillProfile without_invalid; |
997 without_invalid.SetInfo(NAME_FIRST, ASCIIToUTF16("Will")); | 1053 without_invalid.SetRawInfo(NAME_FIRST, ASCIIToUTF16("Will")); |
998 without_invalid.SetInfo(ADDRESS_HOME_CITY, ASCIIToUTF16("Sunnyvale")); | 1054 without_invalid.SetRawInfo(ADDRESS_HOME_CITY, ASCIIToUTF16("Sunnyvale")); |
999 without_invalid.SetInfo(ADDRESS_HOME_STATE, ASCIIToUTF16("CA")); | 1055 without_invalid.SetRawInfo(ADDRESS_HOME_STATE, ASCIIToUTF16("CA")); |
1000 without_invalid.SetInfo(ADDRESS_HOME_ZIP, ASCIIToUTF16("my_zip")); | 1056 without_invalid.SetRawInfo(ADDRESS_HOME_ZIP, ASCIIToUTF16("my_zip")); |
1001 without_invalid.SetInfo(ADDRESS_HOME_COUNTRY, ASCIIToUTF16("United States")); | 1057 without_invalid.SetRawInfo(ADDRESS_HOME_COUNTRY, |
| 1058 ASCIIToUTF16("United States")); |
1002 | 1059 |
1003 AutofillProfile with_invalid = without_invalid; | 1060 AutofillProfile with_invalid = without_invalid; |
1004 with_invalid.SetInfo(PHONE_HOME_WHOLE_NUMBER, ASCIIToUTF16("Invalid_Phone_Numb
er")); | 1061 with_invalid.SetRawInfo(PHONE_HOME_WHOLE_NUMBER, |
| 1062 ASCIIToUTF16("Invalid_Phone_Number")); |
1005 SetProfile(with_invalid); | 1063 SetProfile(with_invalid); |
1006 | 1064 |
1007 ASSERT_EQ(1u, personal_data_manager()->profiles().size()); | 1065 ASSERT_EQ(1u, personal_data_manager()->profiles().size()); |
1008 AutofillProfile profile = *personal_data_manager()->profiles()[0]; | 1066 AutofillProfile profile = *personal_data_manager()->profiles()[0]; |
1009 ASSERT_NE(without_invalid.GetInfo(PHONE_HOME_WHOLE_NUMBER), | 1067 ASSERT_NE(without_invalid.GetRawInfo(PHONE_HOME_WHOLE_NUMBER), |
1010 profile.GetInfo(PHONE_HOME_WHOLE_NUMBER)); | 1068 profile.GetRawInfo(PHONE_HOME_WHOLE_NUMBER)); |
1011 } | 1069 } |
1012 | 1070 |
1013 // Test invalid credit card numbers typed in prefs should be saved as-is. | 1071 // Test invalid credit card numbers typed in prefs should be saved as-is. |
1014 // TODO(isherman): rewrite as WebUI test? | 1072 // TODO(isherman): rewrite as WebUI test? |
1015 IN_PROC_BROWSER_TEST_F(AutofillTest, PrefsStringSavedAsIs) { | 1073 IN_PROC_BROWSER_TEST_F(AutofillTest, PrefsStringSavedAsIs) { |
1016 CreditCard card; | 1074 CreditCard card; |
1017 card.SetInfo(CREDIT_CARD_NUMBER, ASCIIToUTF16("Not_0123-5Checked")); | 1075 card.SetRawInfo(CREDIT_CARD_NUMBER, ASCIIToUTF16("Not_0123-5Checked")); |
1018 SetCard(card); | 1076 SetCard(card); |
1019 | 1077 |
1020 ASSERT_EQ(1u, personal_data_manager()->credit_cards().size()); | 1078 ASSERT_EQ(1u, personal_data_manager()->credit_cards().size()); |
1021 ASSERT_EQ(card, *personal_data_manager()->credit_cards()[0]); | 1079 ASSERT_EQ(card, *personal_data_manager()->credit_cards()[0]); |
1022 } | 1080 } |
1023 | 1081 |
1024 // Test credit card info with an invalid number is not aggregated. | 1082 // Test credit card info with an invalid number is not aggregated. |
1025 // When filling out a form with an invalid credit card number (one that does not | 1083 // When filling out a form with an invalid credit card number (one that does not |
1026 // pass the Luhn test) the credit card info should not be saved into Autofill | 1084 // pass the Luhn test) the credit card info should not be saved into Autofill |
1027 // preferences. | 1085 // preferences. |
(...skipping 10 matching lines...) Expand all Loading... |
1038 // Test whitespaces and separator chars are stripped for valid CC numbers. | 1096 // Test whitespaces and separator chars are stripped for valid CC numbers. |
1039 // The credit card numbers used in this test pass the Luhn test. For reference: | 1097 // The credit card numbers used in this test pass the Luhn test. For reference: |
1040 // http://www.merriampark.com/anatomycc.htm | 1098 // http://www.merriampark.com/anatomycc.htm |
1041 IN_PROC_BROWSER_TEST_F(AutofillTest, | 1099 IN_PROC_BROWSER_TEST_F(AutofillTest, |
1042 WhitespacesAndSeparatorCharsStrippedForValidCCNums) { | 1100 WhitespacesAndSeparatorCharsStrippedForValidCCNums) { |
1043 ASSERT_TRUE(test_server()->Start()); | 1101 ASSERT_TRUE(test_server()->Start()); |
1044 SubmitCreditCard("Bob Smith", "4408 0412 3456 7893", "12", "2014"); | 1102 SubmitCreditCard("Bob Smith", "4408 0412 3456 7893", "12", "2014"); |
1045 SubmitCreditCard("Jane Doe", "4417-1234-5678-9113", "10", "2013"); | 1103 SubmitCreditCard("Jane Doe", "4417-1234-5678-9113", "10", "2013"); |
1046 | 1104 |
1047 ASSERT_EQ(2u, personal_data_manager()->credit_cards().size()); | 1105 ASSERT_EQ(2u, personal_data_manager()->credit_cards().size()); |
1048 string16 cc1 = personal_data_manager()->credit_cards()[0]->GetInfo( | 1106 string16 cc1 = personal_data_manager()->credit_cards()[0]->GetRawInfo( |
1049 CREDIT_CARD_NUMBER); | 1107 CREDIT_CARD_NUMBER); |
1050 ASSERT_TRUE(CreditCard::IsValidCreditCardNumber(cc1)); | 1108 ASSERT_TRUE(CreditCard::IsValidCreditCardNumber(cc1)); |
1051 string16 cc2 = personal_data_manager()->credit_cards()[1]->GetInfo( | 1109 string16 cc2 = personal_data_manager()->credit_cards()[1]->GetRawInfo( |
1052 CREDIT_CARD_NUMBER); | 1110 CREDIT_CARD_NUMBER); |
1053 ASSERT_TRUE(CreditCard::IsValidCreditCardNumber(cc2)); | 1111 ASSERT_TRUE(CreditCard::IsValidCreditCardNumber(cc2)); |
1054 } | 1112 } |
1055 | 1113 |
1056 // Test that Autofill aggregates a minimum valid profile. | 1114 // Test that Autofill aggregates a minimum valid profile. |
1057 // The minimum required address fields must be specified: First Name, Last Name, | 1115 // The minimum required address fields must be specified: First Name, Last Name, |
1058 // Address Line 1, City, Zip Code, and State. | 1116 // Address Line 1, City, Zip Code, and State. |
1059 IN_PROC_BROWSER_TEST_F(AutofillTest, AggregatesMinValidProfile) { | 1117 IN_PROC_BROWSER_TEST_F(AutofillTest, AggregatesMinValidProfile) { |
1060 ASSERT_TRUE(test_server()->Start()); | 1118 ASSERT_TRUE(test_server()->Start()); |
1061 FormMap data; | 1119 FormMap data; |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1112 #define MAYBE_ComparePhoneNumbers DISABLED_ComparePhoneNumbers | 1170 #define MAYBE_ComparePhoneNumbers DISABLED_ComparePhoneNumbers |
1113 #endif | 1171 #endif |
1114 // Test phone fields parse correctly from a given profile. | 1172 // Test phone fields parse correctly from a given profile. |
1115 // The high level key presses execute the following: Select the first text | 1173 // The high level key presses execute the following: Select the first text |
1116 // field, invoke the autofill popup list, select the first profile within the | 1174 // field, invoke the autofill popup list, select the first profile within the |
1117 // list, and commit to the profile to populate the form. | 1175 // list, and commit to the profile to populate the form. |
1118 IN_PROC_BROWSER_TEST_F(AutofillTest, MAYBE_ComparePhoneNumbers) { | 1176 IN_PROC_BROWSER_TEST_F(AutofillTest, MAYBE_ComparePhoneNumbers) { |
1119 ASSERT_TRUE(test_server()->Start()); | 1177 ASSERT_TRUE(test_server()->Start()); |
1120 | 1178 |
1121 AutofillProfile profile; | 1179 AutofillProfile profile; |
1122 profile.SetInfo(NAME_FIRST, ASCIIToUTF16("Bob")); | 1180 profile.SetRawInfo(NAME_FIRST, ASCIIToUTF16("Bob")); |
1123 profile.SetInfo(NAME_LAST, ASCIIToUTF16("Smith")); | 1181 profile.SetRawInfo(NAME_LAST, ASCIIToUTF16("Smith")); |
1124 profile.SetInfo(ADDRESS_HOME_LINE1, ASCIIToUTF16("1234 H St.")); | 1182 profile.SetRawInfo(ADDRESS_HOME_LINE1, ASCIIToUTF16("1234 H St.")); |
1125 profile.SetInfo(ADDRESS_HOME_CITY, ASCIIToUTF16("San Jose")); | 1183 profile.SetRawInfo(ADDRESS_HOME_CITY, ASCIIToUTF16("San Jose")); |
1126 profile.SetInfo(ADDRESS_HOME_STATE, ASCIIToUTF16("CA")); | 1184 profile.SetRawInfo(ADDRESS_HOME_STATE, ASCIIToUTF16("CA")); |
1127 profile.SetInfo(ADDRESS_HOME_ZIP, ASCIIToUTF16("95110")); | 1185 profile.SetRawInfo(ADDRESS_HOME_ZIP, ASCIIToUTF16("95110")); |
1128 profile.SetInfo(PHONE_HOME_WHOLE_NUMBER, ASCIIToUTF16("1-408-555-4567")); | 1186 profile.SetRawInfo(PHONE_HOME_WHOLE_NUMBER, ASCIIToUTF16("1-408-555-4567")); |
1129 SetProfile(profile); | 1187 SetProfile(profile); |
1130 | 1188 |
1131 GURL url = test_server()->GetURL("files/autofill/form_phones.html"); | 1189 GURL url = test_server()->GetURL("files/autofill/form_phones.html"); |
1132 ui_test_utils::NavigateToURL(browser(), url); | 1190 ui_test_utils::NavigateToURL(browser(), url); |
1133 PopulateForm("NAME_FIRST"); | 1191 PopulateForm("NAME_FIRST"); |
1134 | 1192 |
1135 ExpectFieldValue(L"NAME_FIRST", "Bob"); | 1193 ExpectFieldValue(L"NAME_FIRST", "Bob"); |
1136 ExpectFieldValue(L"NAME_LAST", "Smith"); | 1194 ExpectFieldValue(L"NAME_LAST", "Smith"); |
1137 ExpectFieldValue(L"ADDRESS_HOME_LINE1", "1234 H St."); | 1195 ExpectFieldValue(L"ADDRESS_HOME_LINE1", "1234 H St."); |
1138 ExpectFieldValue(L"ADDRESS_HOME_CITY", "San Jose"); | 1196 ExpectFieldValue(L"ADDRESS_HOME_CITY", "San Jose"); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1202 data4["ADDRESS_HOME_ZIP"] = "95510"; | 1260 data4["ADDRESS_HOME_ZIP"] = "95510"; |
1203 data4["ADDRESS_HOME_COUNTRY"] = "Germany"; | 1261 data4["ADDRESS_HOME_COUNTRY"] = "Germany"; |
1204 data4["PHONE_HOME_WHOLE_NUMBER"] = "+21 08450 777 777"; | 1262 data4["PHONE_HOME_WHOLE_NUMBER"] = "+21 08450 777 777"; |
1205 profiles.push_back(data4); | 1263 profiles.push_back(data4); |
1206 | 1264 |
1207 for (size_t i = 0; i < profiles.size(); ++i) | 1265 for (size_t i = 0; i < profiles.size(); ++i) |
1208 FillFormAndSubmit("autofill_test_form.html", profiles[i]); | 1266 FillFormAndSubmit("autofill_test_form.html", profiles[i]); |
1209 | 1267 |
1210 ASSERT_EQ(2u, personal_data_manager()->profiles().size()); | 1268 ASSERT_EQ(2u, personal_data_manager()->profiles().size()); |
1211 ASSERT_EQ(ASCIIToUTF16("(408) 871-4567"), | 1269 ASSERT_EQ(ASCIIToUTF16("(408) 871-4567"), |
1212 personal_data_manager()->profiles()[0]->GetInfo( | 1270 personal_data_manager()->profiles()[0]->GetRawInfo( |
1213 PHONE_HOME_WHOLE_NUMBER)); | 1271 PHONE_HOME_WHOLE_NUMBER)); |
1214 ASSERT_EQ(ASCIIToUTF16("+49 40/808179000"), | 1272 ASSERT_EQ(ASCIIToUTF16("+49 40/808179000"), |
1215 personal_data_manager()->profiles()[1]->GetInfo( | 1273 personal_data_manager()->profiles()[1]->GetRawInfo( |
1216 PHONE_HOME_WHOLE_NUMBER)); | 1274 PHONE_HOME_WHOLE_NUMBER)); |
1217 } | 1275 } |
1218 | 1276 |
1219 // Test Autofill appends country codes to aggregated phone numbers. | 1277 // Test Autofill appends country codes to aggregated phone numbers. |
1220 // The country code is added for the following case: | 1278 // The country code is added for the following case: |
1221 // The phone number contains the correct national number size and | 1279 // The phone number contains the correct national number size and |
1222 // is a valid format. | 1280 // is a valid format. |
1223 IN_PROC_BROWSER_TEST_F(AutofillTest, AppendCountryCodeForAggregatedPhones) { | 1281 IN_PROC_BROWSER_TEST_F(AutofillTest, AppendCountryCodeForAggregatedPhones) { |
1224 ASSERT_TRUE(test_server()->Start()); | 1282 ASSERT_TRUE(test_server()->Start()); |
1225 FormMap data; | 1283 FormMap data; |
1226 data["NAME_FIRST"] = "Bob"; | 1284 data["NAME_FIRST"] = "Bob"; |
1227 data["NAME_LAST"] = "Smith"; | 1285 data["NAME_LAST"] = "Smith"; |
1228 data["ADDRESS_HOME_LINE1"] = "1234 H St."; | 1286 data["ADDRESS_HOME_LINE1"] = "1234 H St."; |
1229 data["ADDRESS_HOME_CITY"] = "San Jose"; | 1287 data["ADDRESS_HOME_CITY"] = "San Jose"; |
1230 data["ADDRESS_HOME_STATE"] = "CA"; | 1288 data["ADDRESS_HOME_STATE"] = "CA"; |
1231 data["ADDRESS_HOME_ZIP"] = "95110"; | 1289 data["ADDRESS_HOME_ZIP"] = "95110"; |
1232 data["ADDRESS_HOME_COUNTRY"] = "Germany"; | 1290 data["ADDRESS_HOME_COUNTRY"] = "Germany"; |
1233 data["PHONE_HOME_WHOLE_NUMBER"] = "(08) 450 777-777"; | 1291 data["PHONE_HOME_WHOLE_NUMBER"] = "(08) 450 777-777"; |
1234 FillFormAndSubmit("autofill_test_form.html", data); | 1292 FillFormAndSubmit("autofill_test_form.html", data); |
1235 | 1293 |
1236 ASSERT_EQ(1u, personal_data_manager()->profiles().size()); | 1294 ASSERT_EQ(1u, personal_data_manager()->profiles().size()); |
1237 string16 phone = | 1295 string16 phone = personal_data_manager()->profiles()[0]->GetRawInfo( |
1238 personal_data_manager()->profiles()[0]->GetInfo(PHONE_HOME_WHOLE_NUMBER); | 1296 PHONE_HOME_WHOLE_NUMBER); |
1239 ASSERT_TRUE(StartsWith(phone, ASCIIToUTF16("+49"), true)); | 1297 ASSERT_TRUE(StartsWith(phone, ASCIIToUTF16("+49"), true)); |
1240 } | 1298 } |
1241 | 1299 |
1242 // Test CC info not offered to be saved when autocomplete=off for CC field. | 1300 // Test CC info not offered to be saved when autocomplete=off for CC field. |
1243 // If the credit card number field has autocomplete turned off, then the credit | 1301 // If the credit card number field has autocomplete turned off, then the credit |
1244 // card infobar should not offer to save the credit card info. The credit card | 1302 // card infobar should not offer to save the credit card info. The credit card |
1245 // number must be a valid Luhn number. | 1303 // number must be a valid Luhn number. |
1246 IN_PROC_BROWSER_TEST_F(AutofillTest, CCInfoNotStoredWhenAutocompleteOff) { | 1304 IN_PROC_BROWSER_TEST_F(AutofillTest, CCInfoNotStoredWhenAutocompleteOff) { |
1247 ASSERT_TRUE(test_server()->Start()); | 1305 ASSERT_TRUE(test_server()->Start()); |
1248 FormMap data; | 1306 FormMap data; |
(...skipping 14 matching lines...) Expand all Loading... |
1263 #else | 1321 #else |
1264 #define MAYBE_NoAutofillForReadOnlyFields DISABLED_NoAutofillForReadOnlyFields | 1322 #define MAYBE_NoAutofillForReadOnlyFields DISABLED_NoAutofillForReadOnlyFields |
1265 #endif | 1323 #endif |
1266 // Test that Autofill does not fill in read-only fields. | 1324 // Test that Autofill does not fill in read-only fields. |
1267 IN_PROC_BROWSER_TEST_F(AutofillTest, MAYBE_NoAutofillForReadOnlyFields) { | 1325 IN_PROC_BROWSER_TEST_F(AutofillTest, MAYBE_NoAutofillForReadOnlyFields) { |
1268 ASSERT_TRUE(test_server()->Start()); | 1326 ASSERT_TRUE(test_server()->Start()); |
1269 | 1327 |
1270 std::string addr_line1("1234 H St."); | 1328 std::string addr_line1("1234 H St."); |
1271 | 1329 |
1272 AutofillProfile profile; | 1330 AutofillProfile profile; |
1273 profile.SetInfo(NAME_FIRST, ASCIIToUTF16("Bob")); | 1331 profile.SetRawInfo(NAME_FIRST, ASCIIToUTF16("Bob")); |
1274 profile.SetInfo(NAME_LAST, ASCIIToUTF16("Smith")); | 1332 profile.SetRawInfo(NAME_LAST, ASCIIToUTF16("Smith")); |
1275 profile.SetInfo(EMAIL_ADDRESS, ASCIIToUTF16("bsmith@gmail.com")); | 1333 profile.SetRawInfo(EMAIL_ADDRESS, ASCIIToUTF16("bsmith@gmail.com")); |
1276 profile.SetInfo(ADDRESS_HOME_LINE1, ASCIIToUTF16(addr_line1)); | 1334 profile.SetRawInfo(ADDRESS_HOME_LINE1, ASCIIToUTF16(addr_line1)); |
1277 profile.SetInfo(ADDRESS_HOME_CITY, ASCIIToUTF16("San Jose")); | 1335 profile.SetRawInfo(ADDRESS_HOME_CITY, ASCIIToUTF16("San Jose")); |
1278 profile.SetInfo(ADDRESS_HOME_STATE, ASCIIToUTF16("CA")); | 1336 profile.SetRawInfo(ADDRESS_HOME_STATE, ASCIIToUTF16("CA")); |
1279 profile.SetInfo(ADDRESS_HOME_ZIP, ASCIIToUTF16("95110")); | 1337 profile.SetRawInfo(ADDRESS_HOME_ZIP, ASCIIToUTF16("95110")); |
1280 profile.SetInfo(COMPANY_NAME, ASCIIToUTF16("Company X")); | 1338 profile.SetRawInfo(COMPANY_NAME, ASCIIToUTF16("Company X")); |
1281 profile.SetInfo(PHONE_HOME_WHOLE_NUMBER, ASCIIToUTF16("408-871-4567")); | 1339 profile.SetRawInfo(PHONE_HOME_WHOLE_NUMBER, ASCIIToUTF16("408-871-4567")); |
1282 SetProfile(profile); | 1340 SetProfile(profile); |
1283 | 1341 |
1284 GURL url = test_server()->GetURL("files/autofill/read_only_field_test.html"); | 1342 GURL url = test_server()->GetURL("files/autofill/read_only_field_test.html"); |
1285 ui_test_utils::NavigateToURL(browser(), url); | 1343 ui_test_utils::NavigateToURL(browser(), url); |
1286 PopulateForm("firstname"); | 1344 PopulateForm("firstname"); |
1287 | 1345 |
1288 ExpectFieldValue(L"email", ""); | 1346 ExpectFieldValue(L"email", ""); |
1289 ExpectFieldValue(L"address", addr_line1); | 1347 ExpectFieldValue(L"address", addr_line1); |
1290 } | 1348 } |
1291 | 1349 |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1358 #endif | 1416 #endif |
1359 // Test forms with multiple email addresses are filled properly. | 1417 // Test forms with multiple email addresses are filled properly. |
1360 // Entire form should be filled with one user gesture. | 1418 // Entire form should be filled with one user gesture. |
1361 IN_PROC_BROWSER_TEST_F(AutofillTest, | 1419 IN_PROC_BROWSER_TEST_F(AutofillTest, |
1362 MAYBE_MultipleEmailFilledByOneUserGesture) { | 1420 MAYBE_MultipleEmailFilledByOneUserGesture) { |
1363 ASSERT_TRUE(test_server()->Start()); | 1421 ASSERT_TRUE(test_server()->Start()); |
1364 | 1422 |
1365 std::string email("bsmith@gmail.com"); | 1423 std::string email("bsmith@gmail.com"); |
1366 | 1424 |
1367 AutofillProfile profile; | 1425 AutofillProfile profile; |
1368 profile.SetInfo(NAME_FIRST, ASCIIToUTF16("Bob")); | 1426 profile.SetRawInfo(NAME_FIRST, ASCIIToUTF16("Bob")); |
1369 profile.SetInfo(NAME_LAST, ASCIIToUTF16("Smith")); | 1427 profile.SetRawInfo(NAME_LAST, ASCIIToUTF16("Smith")); |
1370 profile.SetInfo(EMAIL_ADDRESS, ASCIIToUTF16(email)); | 1428 profile.SetRawInfo(EMAIL_ADDRESS, ASCIIToUTF16(email)); |
1371 profile.SetInfo(PHONE_HOME_WHOLE_NUMBER, ASCIIToUTF16("4088714567")); | 1429 profile.SetRawInfo(PHONE_HOME_WHOLE_NUMBER, ASCIIToUTF16("4088714567")); |
1372 SetProfile(profile); | 1430 SetProfile(profile); |
1373 | 1431 |
1374 GURL url = test_server()->GetURL( | 1432 GURL url = test_server()->GetURL( |
1375 "files/autofill/autofill_confirmemail_form.html"); | 1433 "files/autofill/autofill_confirmemail_form.html"); |
1376 ui_test_utils::NavigateToURL(browser(), url); | 1434 ui_test_utils::NavigateToURL(browser(), url); |
1377 PopulateForm("NAME_FIRST"); | 1435 PopulateForm("NAME_FIRST"); |
1378 | 1436 |
1379 ExpectFieldValue(L"EMAIL_CONFIRM", email); | 1437 ExpectFieldValue(L"EMAIL_CONFIRM", email); |
1380 // TODO(isherman): verify entire form. | 1438 // TODO(isherman): verify entire form. |
1381 } | 1439 } |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1428 std::vector<AutofillProfile> profiles; | 1486 std::vector<AutofillProfile> profiles; |
1429 for (int i = 0; i < kNumProfiles; i++) { | 1487 for (int i = 0; i < kNumProfiles; i++) { |
1430 AutofillProfile profile; | 1488 AutofillProfile profile; |
1431 string16 name(base::IntToString16(i)); | 1489 string16 name(base::IntToString16(i)); |
1432 string16 email(name + ASCIIToUTF16("@example.com")); | 1490 string16 email(name + ASCIIToUTF16("@example.com")); |
1433 string16 street = ASCIIToUTF16( | 1491 string16 street = ASCIIToUTF16( |
1434 base::IntToString(base::RandInt(0, 10000)) + " " + | 1492 base::IntToString(base::RandInt(0, 10000)) + " " + |
1435 streets[base::RandInt(0, streets.size() - 1)]); | 1493 streets[base::RandInt(0, streets.size() - 1)]); |
1436 string16 city = ASCIIToUTF16(cities[base::RandInt(0, cities.size() - 1)]); | 1494 string16 city = ASCIIToUTF16(cities[base::RandInt(0, cities.size() - 1)]); |
1437 string16 zip(base::IntToString16(base::RandInt(0, 10000))); | 1495 string16 zip(base::IntToString16(base::RandInt(0, 10000))); |
1438 profile.SetInfo(NAME_FIRST, name); | 1496 profile.SetRawInfo(NAME_FIRST, name); |
1439 profile.SetInfo(EMAIL_ADDRESS, email); | 1497 profile.SetRawInfo(EMAIL_ADDRESS, email); |
1440 profile.SetInfo(ADDRESS_HOME_LINE1, street); | 1498 profile.SetRawInfo(ADDRESS_HOME_LINE1, street); |
1441 profile.SetInfo(ADDRESS_HOME_CITY, city); | 1499 profile.SetRawInfo(ADDRESS_HOME_CITY, city); |
1442 profile.SetInfo(ADDRESS_HOME_STATE, WideToUTF16(L"CA")); | 1500 profile.SetRawInfo(ADDRESS_HOME_STATE, WideToUTF16(L"CA")); |
1443 profile.SetInfo(ADDRESS_HOME_ZIP, zip); | 1501 profile.SetRawInfo(ADDRESS_HOME_ZIP, zip); |
1444 profile.SetInfo(ADDRESS_HOME_COUNTRY, WideToUTF16(L"United States")); | 1502 profile.SetRawInfo(ADDRESS_HOME_COUNTRY, WideToUTF16(L"United States")); |
1445 profiles.push_back(profile); | 1503 profiles.push_back(profile); |
1446 } | 1504 } |
1447 SetProfiles(&profiles); | 1505 SetProfiles(&profiles); |
1448 // TODO(isherman): once we're sure this test doesn't timeout on any bots, this | 1506 // TODO(isherman): once we're sure this test doesn't timeout on any bots, this |
1449 // can be removd. | 1507 // can be removd. |
1450 LOG(INFO) << "Created " << kNumProfiles << " profiles in " << | 1508 LOG(INFO) << "Created " << kNumProfiles << " profiles in " << |
1451 (base::Time::Now() - start_time).InSeconds() << " seconds."; | 1509 (base::Time::Now() - start_time).InSeconds() << " seconds."; |
1452 | 1510 |
1453 GURL url = test_server()->GetURL( | 1511 GURL url = test_server()->GetURL( |
1454 "files/autofill/latency_after_submit_test.html"); | 1512 "files/autofill/latency_after_submit_test.html"); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1496 // TODO(isherman): this looks redundant, consider removing. | 1554 // TODO(isherman): this looks redundant, consider removing. |
1497 // DISABLED: http://crbug.com/150084 | 1555 // DISABLED: http://crbug.com/150084 |
1498 IN_PROC_BROWSER_TEST_F(AutofillTest, | 1556 IN_PROC_BROWSER_TEST_F(AutofillTest, |
1499 DISABLED_MergeAggregatedDuplicatedProfiles) { | 1557 DISABLED_MergeAggregatedDuplicatedProfiles) { |
1500 int num_of_profiles = | 1558 int num_of_profiles = |
1501 AggregateProfilesIntoAutofillPrefs("dataset_no_address.txt"); | 1559 AggregateProfilesIntoAutofillPrefs("dataset_no_address.txt"); |
1502 | 1560 |
1503 ASSERT_GT(num_of_profiles, | 1561 ASSERT_GT(num_of_profiles, |
1504 static_cast<int>(personal_data_manager()->profiles().size())); | 1562 static_cast<int>(personal_data_manager()->profiles().size())); |
1505 } | 1563 } |
OLD | NEW |