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 <algorithm> | 5 #include <algorithm> |
6 #include <string> | 6 #include <string> |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 1265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1276 EXPECT_TRUE(personal_data_->ImportFormData(form_structure1, | 1276 EXPECT_TRUE(personal_data_->ImportFormData(form_structure1, |
1277 &imported_credit_card)); | 1277 &imported_credit_card)); |
1278 ASSERT_FALSE(imported_credit_card); | 1278 ASSERT_FALSE(imported_credit_card); |
1279 | 1279 |
1280 // Verify that the web database has been updated and the notification sent. | 1280 // Verify that the web database has been updated and the notification sent. |
1281 EXPECT_CALL(personal_data_observer_, OnPersonalDataChanged()) | 1281 EXPECT_CALL(personal_data_observer_, OnPersonalDataChanged()) |
1282 .WillOnce(QuitMainMessageLoop()); | 1282 .WillOnce(QuitMainMessageLoop()); |
1283 base::MessageLoop::current()->Run(); | 1283 base::MessageLoop::current()->Run(); |
1284 | 1284 |
1285 AutofillProfile expected(base::GenerateGUID(), "https://www.example.com"); | 1285 AutofillProfile expected(base::GenerateGUID(), "https://www.example.com"); |
1286 test::SetProfileInfo( | 1286 test::SetProfileInfo(&expected, "George", nullptr, "Washington", |
1287 &expected, "George", NULL, "Washington", "theprez@gmail.com", NULL, | 1287 "theprez@gmail.com", nullptr, "1600 Pennsylvania Avenue", |
1288 "1600 Pennsylvania Avenue", "Suite A", "San Francisco", "California", | 1288 "Suite A", "San Francisco", "California", "94102", |
1289 "94102", NULL, "(650) 555-6666"); | 1289 nullptr, "(650) 555-6666"); |
1290 const std::vector<AutofillProfile*>& results1 = personal_data_->GetProfiles(); | 1290 const std::vector<AutofillProfile*>& results1 = personal_data_->GetProfiles(); |
1291 ASSERT_EQ(1U, results1.size()); | 1291 ASSERT_EQ(1U, results1.size()); |
1292 EXPECT_EQ(0, expected.Compare(*results1[0])); | 1292 EXPECT_EQ(0, expected.Compare(*results1[0])); |
1293 | 1293 |
1294 // Now create an updated profile. | 1294 // Now create an updated profile. |
1295 FormData form2; | 1295 FormData form2; |
1296 test::CreateTestFormField( | 1296 test::CreateTestFormField( |
1297 "First name:", "first_name", "George", "text", &field); | 1297 "First name:", "first_name", "George", "text", &field); |
1298 form2.fields.push_back(field); | 1298 form2.fields.push_back(field); |
1299 test::CreateTestFormField( | 1299 test::CreateTestFormField( |
(...skipping 10 matching lines...) Expand all Loading... |
1310 test::CreateTestFormField("State:", "state", "California", "text", &field); | 1310 test::CreateTestFormField("State:", "state", "California", "text", &field); |
1311 form2.fields.push_back(field); | 1311 form2.fields.push_back(field); |
1312 test::CreateTestFormField("Zip:", "zip", "94102", "text", &field); | 1312 test::CreateTestFormField("Zip:", "zip", "94102", "text", &field); |
1313 form2.fields.push_back(field); | 1313 form2.fields.push_back(field); |
1314 test::CreateTestFormField( | 1314 test::CreateTestFormField( |
1315 "Email:", "email", "theprez@gmail.com", "text", &field); | 1315 "Email:", "email", "theprez@gmail.com", "text", &field); |
1316 form2.fields.push_back(field); | 1316 form2.fields.push_back(field); |
1317 // Country gets added. | 1317 // Country gets added. |
1318 test::CreateTestFormField("Country:", "country", "USA", "text", &field); | 1318 test::CreateTestFormField("Country:", "country", "USA", "text", &field); |
1319 form2.fields.push_back(field); | 1319 form2.fields.push_back(field); |
1320 // Phone gets updated. | 1320 // Same phone number with different formatting doesn't create a new profile. |
1321 test::CreateTestFormField("Phone:", "phone", "6502231234", "text", &field); | 1321 test::CreateTestFormField("Phone:", "phone", "650-555-6666", "text", &field); |
1322 form2.fields.push_back(field); | 1322 form2.fields.push_back(field); |
1323 | 1323 |
1324 FormStructure form_structure2(form2); | 1324 FormStructure form_structure2(form2); |
1325 form_structure2.DetermineHeuristicTypes(); | 1325 form_structure2.DetermineHeuristicTypes(); |
1326 EXPECT_TRUE(personal_data_->ImportFormData(form_structure2, | 1326 EXPECT_TRUE(personal_data_->ImportFormData(form_structure2, |
1327 &imported_credit_card)); | 1327 &imported_credit_card)); |
1328 ASSERT_FALSE(imported_credit_card); | 1328 ASSERT_FALSE(imported_credit_card); |
1329 | 1329 |
1330 // Verify that the web database has been updated and the notification sent. | 1330 // Verify that the web database has been updated and the notification sent. |
1331 EXPECT_CALL(personal_data_observer_, OnPersonalDataChanged()) | 1331 EXPECT_CALL(personal_data_observer_, OnPersonalDataChanged()) |
1332 .WillOnce(QuitMainMessageLoop()); | 1332 .WillOnce(QuitMainMessageLoop()); |
1333 base::MessageLoop::current()->Run(); | 1333 base::MessageLoop::current()->Run(); |
1334 | 1334 |
1335 const std::vector<AutofillProfile*>& results2 = personal_data_->GetProfiles(); | 1335 const std::vector<AutofillProfile*>& results2 = personal_data_->GetProfiles(); |
1336 | 1336 |
1337 // Add multi-valued phone number to expectation. Also, country gets added. | 1337 // Phone formatting is updated. Also, country gets added. |
1338 std::vector<base::string16> values; | 1338 expected.SetRawInfo(PHONE_HOME_WHOLE_NUMBER, ASCIIToUTF16("650-555-6666")); |
1339 expected.GetRawMultiInfo(PHONE_HOME_WHOLE_NUMBER, &values); | |
1340 values.push_back(ASCIIToUTF16("(650) 223-1234")); | |
1341 expected.SetRawMultiInfo(PHONE_HOME_WHOLE_NUMBER, values); | |
1342 expected.SetRawInfo(ADDRESS_HOME_COUNTRY, ASCIIToUTF16("US")); | 1339 expected.SetRawInfo(ADDRESS_HOME_COUNTRY, ASCIIToUTF16("US")); |
1343 ASSERT_EQ(1U, results2.size()); | 1340 ASSERT_EQ(1U, results2.size()); |
1344 EXPECT_EQ(0, expected.Compare(*results2[0])); | 1341 EXPECT_EQ(0, expected.Compare(*results2[0])); |
1345 } | 1342 } |
1346 | 1343 |
1347 TEST_F(PersonalDataManagerTest, AggregateProfileWithMissingInfoInOld) { | 1344 TEST_F(PersonalDataManagerTest, AggregateProfileWithMissingInfoInOld) { |
1348 FormData form1; | 1345 FormData form1; |
1349 FormFieldData field; | 1346 FormFieldData field; |
1350 test::CreateTestFormField( | 1347 test::CreateTestFormField( |
1351 "First name:", "first_name", "George", "text", &field); | 1348 "First name:", "first_name", "George", "text", &field); |
(...skipping 777 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2129 // sure no changes were written out. | 2126 // sure no changes were written out. |
2130 ResetPersonalDataManager(USER_MODE_NORMAL); | 2127 ResetPersonalDataManager(USER_MODE_NORMAL); |
2131 | 2128 |
2132 // Expect that no new card is saved. | 2129 // Expect that no new card is saved. |
2133 const std::vector<CreditCard*>& results2 = personal_data_->GetCreditCards(); | 2130 const std::vector<CreditCard*>& results2 = personal_data_->GetCreditCards(); |
2134 ASSERT_EQ(1U, results2.size()); | 2131 ASSERT_EQ(1U, results2.size()); |
2135 EXPECT_EQ(0, saved_credit_card.Compare(*results2[0])); | 2132 EXPECT_EQ(0, saved_credit_card.Compare(*results2[0])); |
2136 } | 2133 } |
2137 | 2134 |
2138 // Ensure that if a verified profile already exists, aggregated profiles cannot | 2135 // Ensure that if a verified profile already exists, aggregated profiles cannot |
2139 // modify it in any way. | 2136 // modify it in any way. This also checks the profile merging/matching algorithm |
| 2137 // works: if either the full name OR all the non-empty name pieces match, the |
| 2138 // profile is a match. |
2140 TEST_F(PersonalDataManagerTest, AggregateExistingVerifiedProfileWithConflict) { | 2139 TEST_F(PersonalDataManagerTest, AggregateExistingVerifiedProfileWithConflict) { |
2141 // Start with a verified profile. | 2140 // Start with a verified profile. |
2142 AutofillProfile profile(base::GenerateGUID(), "Chrome settings"); | 2141 AutofillProfile profile(base::GenerateGUID(), "Chrome settings"); |
2143 test::SetProfileInfo(&profile, | 2142 test::SetProfileInfo(&profile, |
2144 "Marion", "Mitchell", "Morrison", | 2143 "Marion", "Mitchell", "Morrison", |
2145 "johnwayne@me.xyz", "Fox", "123 Zoo St.", "unit 5", "Hollywood", "CA", | 2144 "johnwayne@me.xyz", "Fox", "123 Zoo St.", "unit 5", "Hollywood", "CA", |
2146 "91601", "US", "12345678910"); | 2145 "91601", "US", "12345678910"); |
2147 EXPECT_TRUE(profile.IsVerified()); | 2146 EXPECT_TRUE(profile.IsVerified()); |
2148 | 2147 |
2149 // Add the profile to the database. | 2148 // Add the profile to the database. |
2150 personal_data_->AddProfile(profile); | 2149 personal_data_->AddProfile(profile); |
2151 | 2150 |
2152 // Verify that the web database has been updated and the notification sent. | 2151 // Verify that the web database has been updated and the notification sent. |
2153 EXPECT_CALL(personal_data_observer_, OnPersonalDataChanged()) | 2152 EXPECT_CALL(personal_data_observer_, OnPersonalDataChanged()) |
2154 .WillOnce(QuitMainMessageLoop()); | 2153 .WillOnce(QuitMainMessageLoop()); |
2155 base::MessageLoop::current()->Run(); | 2154 base::MessageLoop::current()->Run(); |
2156 | 2155 |
2157 // Simulate a form submission with conflicting info. | 2156 // Simulate a form submission with conflicting info. |
2158 FormData form; | 2157 FormData form; |
2159 FormFieldData field; | 2158 FormFieldData field; |
2160 test::CreateTestFormField( | 2159 test::CreateTestFormField("First name:", "first_name", "Marion Mitchell", |
2161 "First name:", "first_name", "Marion", "text", &field); | 2160 "text", &field); |
2162 form.fields.push_back(field); | 2161 form.fields.push_back(field); |
2163 test::CreateTestFormField( | 2162 test::CreateTestFormField( |
2164 "Last name:", "last_name", "Morrison", "text", &field); | 2163 "Last name:", "last_name", "Morrison", "text", &field); |
2165 form.fields.push_back(field); | 2164 form.fields.push_back(field); |
2166 test::CreateTestFormField( | 2165 test::CreateTestFormField("Email:", "email", "johnwayne@me.xyz", "text", |
2167 "Email:", "email", "other.email@example.com", "text", &field); | 2166 &field); |
2168 form.fields.push_back(field); | 2167 form.fields.push_back(field); |
2169 test::CreateTestFormField( | 2168 test::CreateTestFormField( |
2170 "Address:", "address1", "123 Zoo St.", "text", &field); | 2169 "Address:", "address1", "123 Zoo St.", "text", &field); |
2171 form.fields.push_back(field); | 2170 form.fields.push_back(field); |
2172 test::CreateTestFormField("City:", "city", "Hollywood", "text", &field); | 2171 test::CreateTestFormField("City:", "city", "Hollywood", "text", &field); |
2173 form.fields.push_back(field); | 2172 form.fields.push_back(field); |
2174 test::CreateTestFormField("State:", "state", "CA", "text", &field); | 2173 test::CreateTestFormField("State:", "state", "CA", "text", &field); |
2175 form.fields.push_back(field); | 2174 form.fields.push_back(field); |
2176 test::CreateTestFormField("Zip:", "zip", "91601", "text", &field); | 2175 test::CreateTestFormField("Zip:", "zip", "91601", "text", &field); |
2177 form.fields.push_back(field); | 2176 form.fields.push_back(field); |
2178 | 2177 |
2179 FormStructure form_structure(form); | 2178 FormStructure form_structure(form); |
2180 form_structure.DetermineHeuristicTypes(); | 2179 form_structure.DetermineHeuristicTypes(); |
2181 scoped_ptr<CreditCard> imported_credit_card; | 2180 scoped_ptr<CreditCard> imported_credit_card; |
2182 EXPECT_TRUE(personal_data_->ImportFormData(form_structure, | 2181 EXPECT_TRUE(personal_data_->ImportFormData(form_structure, |
2183 &imported_credit_card)); | 2182 &imported_credit_card)); |
2184 EXPECT_FALSE(imported_credit_card); | 2183 EXPECT_FALSE(imported_credit_card); |
2185 | 2184 |
2186 // Wait for the refresh, which in this case is a no-op. | 2185 // Wait for the refresh, which in this case is a no-op. |
2187 EXPECT_CALL(personal_data_observer_, OnPersonalDataChanged()) | 2186 EXPECT_CALL(personal_data_observer_, OnPersonalDataChanged()) |
2188 .WillOnce(QuitMainMessageLoop()); | 2187 .WillOnce(QuitMainMessageLoop()); |
2189 base::MessageLoop::current()->Run(); | 2188 base::MessageLoop::current()->Run(); |
2190 | 2189 |
2191 // Expect that no new profile is saved. | 2190 // Expect that no new profile is saved. |
2192 const std::vector<AutofillProfile*>& results = personal_data_->GetProfiles(); | 2191 const std::vector<AutofillProfile*>& results = personal_data_->GetProfiles(); |
2193 ASSERT_EQ(1U, results.size()); | 2192 ASSERT_EQ(1U, results.size()); |
2194 EXPECT_EQ(0, profile.Compare(*results[0])); | 2193 EXPECT_EQ(0, profile.Compare(*results[0])); |
| 2194 |
| 2195 // Try the same thing, but without "Mitchell". The profiles should still match |
| 2196 // because the non empty name pieces (first and last) match that stored in the |
| 2197 // profile. |
| 2198 test::CreateTestFormField("First name:", "first_name", "Marion", "text", |
| 2199 &field); |
| 2200 form.fields[0] = field; |
| 2201 |
| 2202 FormStructure form_structure2(form); |
| 2203 form_structure2.DetermineHeuristicTypes(); |
| 2204 EXPECT_TRUE( |
| 2205 personal_data_->ImportFormData(form_structure2, &imported_credit_card)); |
| 2206 EXPECT_FALSE(imported_credit_card); |
| 2207 |
| 2208 // Wait for the refresh, which in this case is a no-op. |
| 2209 EXPECT_CALL(personal_data_observer_, OnPersonalDataChanged()) |
| 2210 .WillOnce(QuitMainMessageLoop()); |
| 2211 base::MessageLoop::current()->Run(); |
| 2212 |
| 2213 // Expect that no new profile is saved. |
| 2214 const std::vector<AutofillProfile*>& results2 = personal_data_->GetProfiles(); |
| 2215 ASSERT_EQ(1U, results2.size()); |
| 2216 EXPECT_EQ(0, profile.Compare(*results2[0])); |
2195 } | 2217 } |
2196 | 2218 |
2197 // Ensure that if a verified credit card already exists, aggregated credit cards | 2219 // Ensure that if a verified credit card already exists, aggregated credit cards |
2198 // cannot modify it in any way. | 2220 // cannot modify it in any way. |
2199 TEST_F(PersonalDataManagerTest, | 2221 TEST_F(PersonalDataManagerTest, |
2200 AggregateExistingVerifiedCreditCardWithConflict) { | 2222 AggregateExistingVerifiedCreditCardWithConflict) { |
2201 // Start with a verified credit card. | 2223 // Start with a verified credit card. |
2202 CreditCard credit_card(base::GenerateGUID(), "Chrome settings"); | 2224 CreditCard credit_card(base::GenerateGUID(), "Chrome settings"); |
2203 test::SetCreditCardInfo(&credit_card, | 2225 test::SetCreditCardInfo(&credit_card, |
2204 "Biggie Smalls", "4111 1111 1111 1111" /* Visa */, "01", "2011"); | 2226 "Biggie Smalls", "4111 1111 1111 1111" /* Visa */, "01", "2011"); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2258 personal_data_->AddProfile(profile); | 2280 personal_data_->AddProfile(profile); |
2259 | 2281 |
2260 // Verify that the web database has been updated and the notification sent. | 2282 // Verify that the web database has been updated and the notification sent. |
2261 EXPECT_CALL(personal_data_observer_, OnPersonalDataChanged()) | 2283 EXPECT_CALL(personal_data_observer_, OnPersonalDataChanged()) |
2262 .WillOnce(QuitMainMessageLoop()); | 2284 .WillOnce(QuitMainMessageLoop()); |
2263 base::MessageLoop::current()->Run(); | 2285 base::MessageLoop::current()->Run(); |
2264 | 2286 |
2265 AutofillProfile new_verified_profile = profile; | 2287 AutofillProfile new_verified_profile = profile; |
2266 new_verified_profile.set_guid(base::GenerateGUID()); | 2288 new_verified_profile.set_guid(base::GenerateGUID()); |
2267 new_verified_profile.set_origin("Chrome settings"); | 2289 new_verified_profile.set_origin("Chrome settings"); |
2268 new_verified_profile.SetRawInfo(COMPANY_NAME, ASCIIToUTF16("Fizzbang, Inc.")); | 2290 new_verified_profile.SetRawInfo(PHONE_HOME_WHOLE_NUMBER, |
| 2291 ASCIIToUTF16("1 234 567-8910")); |
2269 EXPECT_TRUE(new_verified_profile.IsVerified()); | 2292 EXPECT_TRUE(new_verified_profile.IsVerified()); |
2270 | 2293 |
2271 personal_data_->SaveImportedProfile(new_verified_profile); | 2294 personal_data_->SaveImportedProfile(new_verified_profile); |
2272 | 2295 |
2273 // Verify that the web database has been updated and the notification sent. | 2296 // Verify that the web database has been updated and the notification sent. |
2274 EXPECT_CALL(personal_data_observer_, OnPersonalDataChanged()) | 2297 EXPECT_CALL(personal_data_observer_, OnPersonalDataChanged()) |
2275 .WillOnce(QuitMainMessageLoop()); | 2298 .WillOnce(QuitMainMessageLoop()); |
2276 base::MessageLoop::current()->Run(); | 2299 base::MessageLoop::current()->Run(); |
2277 | 2300 |
2278 // Expect that the existing profile is not modified, and instead the new | 2301 // The new profile should be merged into the existing one. |
2279 // profile is added. | |
2280 const std::vector<AutofillProfile*>& results = personal_data_->GetProfiles(); | 2302 const std::vector<AutofillProfile*>& results = personal_data_->GetProfiles(); |
2281 ASSERT_EQ(1U, results.size()); | 2303 ASSERT_EQ(1U, results.size()); |
2282 EXPECT_EQ(0, new_verified_profile.Compare(*results[0])); | 2304 EXPECT_EQ(0, new_verified_profile.Compare(*results[0])); |
2283 } | 2305 } |
2284 | 2306 |
2285 // Ensure that verified profiles can be saved via SaveImportedProfile, | 2307 // Ensure that verified profiles can be saved via SaveImportedProfile, |
2286 // overwriting existing verified profiles as well. | 2308 // overwriting existing verified profiles as well. |
2287 TEST_F(PersonalDataManagerTest, SaveImportedProfileWithExistingVerifiedData) { | 2309 TEST_F(PersonalDataManagerTest, SaveImportedProfileWithExistingVerifiedData) { |
2288 // Start with a verified profile. | 2310 // Start with a verified profile. |
2289 AutofillProfile profile(base::GenerateGUID(), "Chrome settings"); | 2311 AutofillProfile profile(base::GenerateGUID(), "Chrome settings"); |
2290 test::SetProfileInfo(&profile, | 2312 test::SetProfileInfo(&profile, |
2291 "Marion", "Mitchell", "Morrison", | 2313 "Marion", "Mitchell", "Morrison", |
2292 "johnwayne@me.xyz", "Fox", "123 Zoo St.", "unit 5", "Hollywood", "CA", | 2314 "johnwayne@me.xyz", "Fox", "123 Zoo St.", "unit 5", "Hollywood", "CA", |
2293 "91601", "US", "12345678910"); | 2315 "91601", "US", "12345678910"); |
2294 EXPECT_TRUE(profile.IsVerified()); | 2316 EXPECT_TRUE(profile.IsVerified()); |
2295 | 2317 |
2296 // Add the profile to the database. | 2318 // Add the profile to the database. |
2297 personal_data_->AddProfile(profile); | 2319 personal_data_->AddProfile(profile); |
2298 | 2320 |
2299 // Verify that the web database has been updated and the notification sent. | 2321 // Verify that the web database has been updated and the notification sent. |
2300 EXPECT_CALL(personal_data_observer_, OnPersonalDataChanged()) | 2322 EXPECT_CALL(personal_data_observer_, OnPersonalDataChanged()) |
2301 .WillOnce(QuitMainMessageLoop()); | 2323 .WillOnce(QuitMainMessageLoop()); |
2302 base::MessageLoop::current()->Run(); | 2324 base::MessageLoop::current()->Run(); |
2303 | 2325 |
2304 AutofillProfile new_verified_profile = profile; | 2326 AutofillProfile new_verified_profile = profile; |
2305 new_verified_profile.set_guid(base::GenerateGUID()); | 2327 new_verified_profile.set_guid(base::GenerateGUID()); |
2306 new_verified_profile.SetRawInfo(COMPANY_NAME, ASCIIToUTF16("Fizzbang, Inc.")); | 2328 new_verified_profile.SetRawInfo(PHONE_HOME_WHOLE_NUMBER, |
| 2329 ASCIIToUTF16("1 234 567-8910")); |
2307 EXPECT_TRUE(new_verified_profile.IsVerified()); | 2330 EXPECT_TRUE(new_verified_profile.IsVerified()); |
2308 | 2331 |
2309 personal_data_->SaveImportedProfile(new_verified_profile); | 2332 personal_data_->SaveImportedProfile(new_verified_profile); |
2310 | 2333 |
2311 // Verify that the web database has been updated and the notification sent. | 2334 // Verify that the web database has been updated and the notification sent. |
2312 EXPECT_CALL(personal_data_observer_, OnPersonalDataChanged()) | 2335 EXPECT_CALL(personal_data_observer_, OnPersonalDataChanged()) |
2313 .WillOnce(QuitMainMessageLoop()); | 2336 .WillOnce(QuitMainMessageLoop()); |
2314 base::MessageLoop::current()->Run(); | 2337 base::MessageLoop::current()->Run(); |
2315 | 2338 |
2316 // The new profile should be merged into the existing one. | 2339 // The new profile should be merged into the existing one. |
2317 AutofillProfile expected_profile = profile; | |
2318 expected_profile.SetRawInfo(COMPANY_NAME, ASCIIToUTF16("Fizzbang, Inc.")); | |
2319 const std::vector<AutofillProfile*>& results = personal_data_->GetProfiles(); | 2340 const std::vector<AutofillProfile*>& results = personal_data_->GetProfiles(); |
2320 ASSERT_EQ(1U, results.size()); | 2341 ASSERT_EQ(1U, results.size()); |
2321 EXPECT_EQ(expected_profile, *results[0]); | 2342 EXPECT_EQ(0, new_verified_profile.Compare(*results[0])); |
2322 } | 2343 } |
2323 | 2344 |
2324 // Ensure that verified credit cards can be saved via SaveImportedCreditCard. | 2345 // Ensure that verified credit cards can be saved via SaveImportedCreditCard. |
2325 TEST_F(PersonalDataManagerTest, SaveImportedCreditCardWithVerifiedData) { | 2346 TEST_F(PersonalDataManagerTest, SaveImportedCreditCardWithVerifiedData) { |
2326 // Start with a verified credit card. | 2347 // Start with a verified credit card. |
2327 CreditCard credit_card(base::GenerateGUID(), "Chrome settings"); | 2348 CreditCard credit_card(base::GenerateGUID(), "Chrome settings"); |
2328 test::SetCreditCardInfo(&credit_card, | 2349 test::SetCreditCardInfo(&credit_card, |
2329 "Biggie Smalls", "4111 1111 1111 1111" /* Visa */, "01", "2011"); | 2350 "Biggie Smalls", "4111 1111 1111 1111" /* Visa */, "01", "2011"); |
2330 EXPECT_TRUE(credit_card.IsVerified()); | 2351 EXPECT_TRUE(credit_card.IsVerified()); |
2331 | 2352 |
(...skipping 842 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3174 form2.fields.push_back(field); | 3195 form2.fields.push_back(field); |
3175 | 3196 |
3176 FormStructure form_structure2(form2); | 3197 FormStructure form_structure2(form2); |
3177 form_structure2.DetermineHeuristicTypes(); | 3198 form_structure2.DetermineHeuristicTypes(); |
3178 EXPECT_FALSE( | 3199 EXPECT_FALSE( |
3179 personal_data_->ImportFormData(form_structure2, &imported_credit_card)); | 3200 personal_data_->ImportFormData(form_structure2, &imported_credit_card)); |
3180 EXPECT_FALSE(imported_credit_card); | 3201 EXPECT_FALSE(imported_credit_card); |
3181 } | 3202 } |
3182 | 3203 |
3183 } // namespace autofill | 3204 } // namespace autofill |
OLD | NEW |