| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/autofill/autofill_ie_toolbar_import_win.h" | 5 #include "chrome/browser/autofill/autofill_ie_toolbar_import_win.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/string16.h" | 8 #include "base/string16.h" |
| 9 #include "base/win/registry.h" | 9 #include "base/win/registry.h" |
| 10 #include "chrome/browser/autofill/autofill_profile.h" | 10 #include "chrome/browser/autofill/autofill_profile.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 { L"phone_home_number", L"555-5555" }, | 46 { L"phone_home_number", L"555-5555" }, |
| 47 { L"phone_home_city_code", L"650" }, | 47 { L"phone_home_city_code", L"650" }, |
| 48 { L"phone_home_country_code", L"1" }, | 48 { L"phone_home_country_code", L"1" }, |
| 49 }; | 49 }; |
| 50 | 50 |
| 51 ValueDescription profile2[] = { | 51 ValueDescription profile2[] = { |
| 52 { L"name_first", L"Jane" }, | 52 { L"name_first", L"Jane" }, |
| 53 { L"name_last", L"Doe" }, | 53 { L"name_last", L"Doe" }, |
| 54 { L"email", L"janedoe@test.com" }, | 54 { L"email", L"janedoe@test.com" }, |
| 55 { L"company_name", L"Testcompany" }, | 55 { L"company_name", L"Testcompany" }, |
| 56 { L"phone_fax_number", L"555-6666" }, | |
| 57 { L"phone_fax_city_code", L"812" }, | |
| 58 { L"phone_fax_country_code", L"7" }, | |
| 59 }; | 56 }; |
| 60 | 57 |
| 61 ValueDescription credit_card[] = { | 58 ValueDescription credit_card[] = { |
| 62 { L"credit_card_name", L"Tommy Gun" }, | 59 { L"credit_card_name", L"Tommy Gun" }, |
| 63 // "4111111111111111" encrypted: | 60 // "4111111111111111" encrypted: |
| 64 { L"credit_card_number", L"\xE53F\x19AB\xC1BF\xC9EB\xECCC\x9BDA\x8515" | 61 { L"credit_card_number", L"\xE53F\x19AB\xC1BF\xC9EB\xECCC\x9BDA\x8515" |
| 65 L"\xE14D\x6852\x80A8\x50A3\x4375\xFD9F\x1E07" | 62 L"\xE14D\x6852\x80A8\x50A3\x4375\xFD9F\x1E07" |
| 66 L"\x790E\x7336\xB773\xAF33\x93EA\xB846\xEC89" | 63 L"\x790E\x7336\xB773\xAF33\x93EA\xB846\xEC89" |
| 67 L"\x265C\xD0E6\x4E23\xB75F\x7983" }, | 64 L"\x265C\xD0E6\x4E23\xB75F\x7983" }, |
| 68 { L"credit_card_exp_month", L"11" }, | 65 { L"credit_card_exp_month", L"11" }, |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 EXPECT_EQ(profile1[4].value, profiles[1].GetInfo(COMPANY_NAME)); | 167 EXPECT_EQ(profile1[4].value, profiles[1].GetInfo(COMPANY_NAME)); |
| 171 EXPECT_EQ(profile1[7].value, profiles[1].GetInfo(PHONE_HOME_COUNTRY_CODE)); | 168 EXPECT_EQ(profile1[7].value, profiles[1].GetInfo(PHONE_HOME_COUNTRY_CODE)); |
| 172 EXPECT_EQ(profile1[6].value, profiles[1].GetInfo(PHONE_HOME_CITY_CODE)); | 169 EXPECT_EQ(profile1[6].value, profiles[1].GetInfo(PHONE_HOME_CITY_CODE)); |
| 173 EXPECT_EQ(L"5555555", profiles[1].GetInfo(PHONE_HOME_NUMBER)); | 170 EXPECT_EQ(L"5555555", profiles[1].GetInfo(PHONE_HOME_NUMBER)); |
| 174 EXPECT_EQ(L"+1 650-555-5555", profiles[1].GetInfo(PHONE_HOME_WHOLE_NUMBER)); | 171 EXPECT_EQ(L"+1 650-555-5555", profiles[1].GetInfo(PHONE_HOME_WHOLE_NUMBER)); |
| 175 | 172 |
| 176 EXPECT_EQ(profile2[0].value, profiles[0].GetInfo(NAME_FIRST)); | 173 EXPECT_EQ(profile2[0].value, profiles[0].GetInfo(NAME_FIRST)); |
| 177 EXPECT_EQ(profile2[1].value, profiles[0].GetInfo(NAME_LAST)); | 174 EXPECT_EQ(profile2[1].value, profiles[0].GetInfo(NAME_LAST)); |
| 178 EXPECT_EQ(profile2[2].value, profiles[0].GetInfo(EMAIL_ADDRESS)); | 175 EXPECT_EQ(profile2[2].value, profiles[0].GetInfo(EMAIL_ADDRESS)); |
| 179 EXPECT_EQ(profile2[3].value, profiles[0].GetInfo(COMPANY_NAME)); | 176 EXPECT_EQ(profile2[3].value, profiles[0].GetInfo(COMPANY_NAME)); |
| 180 EXPECT_EQ(profile2[6].value, profiles[0].GetInfo(PHONE_FAX_COUNTRY_CODE)); | |
| 181 EXPECT_EQ(profile2[5].value, profiles[0].GetInfo(PHONE_FAX_CITY_CODE)); | |
| 182 EXPECT_EQ(L"5556666", profiles[0].GetInfo(PHONE_FAX_NUMBER)); | |
| 183 EXPECT_EQ(L"+7 812 555-66-66", profiles[0].GetInfo(PHONE_FAX_WHOLE_NUMBER)); | |
| 184 | 177 |
| 185 ASSERT_EQ(1U, credit_cards.size()); | 178 ASSERT_EQ(1U, credit_cards.size()); |
| 186 EXPECT_EQ(credit_card[0].value, credit_cards[0].GetInfo(CREDIT_CARD_NAME)); | 179 EXPECT_EQ(credit_card[0].value, credit_cards[0].GetInfo(CREDIT_CARD_NAME)); |
| 187 EXPECT_EQ(L"4111111111111111", credit_cards[0].GetInfo(CREDIT_CARD_NUMBER)); | 180 EXPECT_EQ(L"4111111111111111", credit_cards[0].GetInfo(CREDIT_CARD_NUMBER)); |
| 188 EXPECT_EQ(credit_card[2].value, | 181 EXPECT_EQ(credit_card[2].value, |
| 189 credit_cards[0].GetInfo(CREDIT_CARD_EXP_MONTH)); | 182 credit_cards[0].GetInfo(CREDIT_CARD_EXP_MONTH)); |
| 190 EXPECT_EQ(credit_card[3].value, | 183 EXPECT_EQ(credit_card[3].value, |
| 191 credit_cards[0].GetInfo(CREDIT_CARD_EXP_4_DIGIT_YEAR)); | 184 credit_cards[0].GetInfo(CREDIT_CARD_EXP_4_DIGIT_YEAR)); |
| 192 | 185 |
| 193 // Mock password encrypted cc. | 186 // Mock password encrypted cc. |
| 194 cc_key.Open(HKEY_CURRENT_USER, kCreditCardKey, KEY_ALL_ACCESS); | 187 cc_key.Open(HKEY_CURRENT_USER, kCreditCardKey, KEY_ALL_ACCESS); |
| 195 EXPECT_TRUE(cc_key.Valid()); | 188 EXPECT_TRUE(cc_key.Valid()); |
| 196 EncryptAndWrite(&cc_key, &protected_password); | 189 EncryptAndWrite(&cc_key, &protected_password); |
| 197 EncryptAndWrite(&cc_key, &protected_salt); | 190 EncryptAndWrite(&cc_key, &protected_salt); |
| 198 cc_key.Close(); | 191 cc_key.Close(); |
| 199 | 192 |
| 200 profiles.clear(); | 193 profiles.clear(); |
| 201 credit_cards.clear(); | 194 credit_cards.clear(); |
| 202 EXPECT_TRUE(ImportCurrentUserProfiles(&profiles, &credit_cards)); | 195 EXPECT_TRUE(ImportCurrentUserProfiles(&profiles, &credit_cards)); |
| 203 // Profiles are not protected. | 196 // Profiles are not protected. |
| 204 EXPECT_EQ(2U, profiles.size()); | 197 EXPECT_EQ(2U, profiles.size()); |
| 205 // Credit cards are. | 198 // Credit cards are. |
| 206 EXPECT_EQ(0U, credit_cards.size()); | 199 EXPECT_EQ(0U, credit_cards.size()); |
| 207 } | 200 } |
| 208 | 201 |
| OLD | NEW |