| 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/guid.h" | 8 #include "base/guid.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 | 244 |
| 245 // Add two test credit cards to the database. | 245 // Add two test credit cards to the database. |
| 246 personal_data_->AddCreditCard(credit_card0); | 246 personal_data_->AddCreditCard(credit_card0); |
| 247 personal_data_->AddCreditCard(credit_card1); | 247 personal_data_->AddCreditCard(credit_card1); |
| 248 | 248 |
| 249 // Verify that the web database has been updated and the notification sent. | 249 // Verify that the web database has been updated and the notification sent. |
| 250 EXPECT_CALL(personal_data_observer_, | 250 EXPECT_CALL(personal_data_observer_, |
| 251 OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); | 251 OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); |
| 252 MessageLoop::current()->Run(); | 252 MessageLoop::current()->Run(); |
| 253 | 253 |
| 254 const std::vector<CreditCard*>& results1 = personal_data_->credit_cards(); | 254 const std::vector<CreditCard*>& results1 = personal_data_->GetCreditCards(); |
| 255 ASSERT_EQ(2U, results1.size()); | 255 ASSERT_EQ(2U, results1.size()); |
| 256 EXPECT_EQ(0, credit_card0.Compare(*results1[0])); | 256 EXPECT_EQ(0, credit_card0.Compare(*results1[0])); |
| 257 EXPECT_EQ(0, credit_card1.Compare(*results1[1])); | 257 EXPECT_EQ(0, credit_card1.Compare(*results1[1])); |
| 258 | 258 |
| 259 // Update, remove, and add. | 259 // Update, remove, and add. |
| 260 credit_card0.SetRawInfo(CREDIT_CARD_NAME, ASCIIToUTF16("Joe")); | 260 credit_card0.SetRawInfo(CREDIT_CARD_NAME, ASCIIToUTF16("Joe")); |
| 261 personal_data_->UpdateCreditCard(credit_card0); | 261 personal_data_->UpdateCreditCard(credit_card0); |
| 262 personal_data_->RemoveByGUID(credit_card1.guid()); | 262 personal_data_->RemoveByGUID(credit_card1.guid()); |
| 263 personal_data_->AddCreditCard(credit_card2); | 263 personal_data_->AddCreditCard(credit_card2); |
| 264 | 264 |
| 265 // Verify that the web database has been updated and the notification sent. | 265 // Verify that the web database has been updated and the notification sent. |
| 266 EXPECT_CALL(personal_data_observer_, | 266 EXPECT_CALL(personal_data_observer_, |
| 267 OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); | 267 OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); |
| 268 MessageLoop::current()->Run(); | 268 MessageLoop::current()->Run(); |
| 269 | 269 |
| 270 const std::vector<CreditCard*>& results2 = personal_data_->credit_cards(); | 270 const std::vector<CreditCard*>& results2 = personal_data_->GetCreditCards(); |
| 271 ASSERT_EQ(2U, results2.size()); | 271 ASSERT_EQ(2U, results2.size()); |
| 272 EXPECT_EQ(credit_card0, *results2[0]); | 272 EXPECT_EQ(credit_card0, *results2[0]); |
| 273 EXPECT_EQ(credit_card2, *results2[1]); | 273 EXPECT_EQ(credit_card2, *results2[1]); |
| 274 | 274 |
| 275 // Reset the PersonalDataManager. This tests that the personal data was saved | 275 // Reset the PersonalDataManager. This tests that the personal data was saved |
| 276 // to the web database, and that we can load the credit cards from the web | 276 // to the web database, and that we can load the credit cards from the web |
| 277 // database. | 277 // database. |
| 278 ResetPersonalDataManager(); | 278 ResetPersonalDataManager(); |
| 279 | 279 |
| 280 // Verify that we've loaded the credit cards from the web database. | 280 // Verify that we've loaded the credit cards from the web database. |
| 281 const std::vector<CreditCard*>& results3 = personal_data_->credit_cards(); | 281 const std::vector<CreditCard*>& results3 = personal_data_->GetCreditCards(); |
| 282 ASSERT_EQ(2U, results3.size()); | 282 ASSERT_EQ(2U, results3.size()); |
| 283 EXPECT_EQ(credit_card0, *results3[0]); | 283 EXPECT_EQ(credit_card0, *results3[0]); |
| 284 EXPECT_EQ(credit_card2, *results3[1]); | 284 EXPECT_EQ(credit_card2, *results3[1]); |
| 285 } | 285 } |
| 286 | 286 |
| 287 TEST_F(PersonalDataManagerTest, UpdateUnverifiedProfilesAndCreditCards) { | 287 TEST_F(PersonalDataManagerTest, UpdateUnverifiedProfilesAndCreditCards) { |
| 288 // Start with unverified data. | 288 // Start with unverified data. |
| 289 AutofillProfile profile; | 289 AutofillProfile profile; |
| 290 profile.set_origin("https://www.example.com/"); | 290 profile.set_origin("https://www.example.com/"); |
| 291 test::SetProfileInfo(&profile, | 291 test::SetProfileInfo(&profile, |
| (...skipping 12 matching lines...) Expand all Loading... |
| 304 personal_data_->AddProfile(profile); | 304 personal_data_->AddProfile(profile); |
| 305 personal_data_->AddCreditCard(credit_card); | 305 personal_data_->AddCreditCard(credit_card); |
| 306 | 306 |
| 307 // Verify that the web database has been updated and the notification sent. | 307 // Verify that the web database has been updated and the notification sent. |
| 308 EXPECT_CALL(personal_data_observer_, | 308 EXPECT_CALL(personal_data_observer_, |
| 309 OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); | 309 OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); |
| 310 MessageLoop::current()->Run(); | 310 MessageLoop::current()->Run(); |
| 311 | 311 |
| 312 const std::vector<AutofillProfile*>& profiles1 = | 312 const std::vector<AutofillProfile*>& profiles1 = |
| 313 personal_data_->GetProfiles(); | 313 personal_data_->GetProfiles(); |
| 314 const std::vector<CreditCard*>& cards1 = personal_data_->credit_cards(); | 314 const std::vector<CreditCard*>& cards1 = personal_data_->GetCreditCards(); |
| 315 ASSERT_EQ(1U, profiles1.size()); | 315 ASSERT_EQ(1U, profiles1.size()); |
| 316 ASSERT_EQ(1U, cards1.size()); | 316 ASSERT_EQ(1U, cards1.size()); |
| 317 EXPECT_EQ(0, profile.Compare(*profiles1[0])); | 317 EXPECT_EQ(0, profile.Compare(*profiles1[0])); |
| 318 EXPECT_EQ(0, credit_card.Compare(*cards1[0])); | 318 EXPECT_EQ(0, credit_card.Compare(*cards1[0])); |
| 319 | 319 |
| 320 // Try to update with just the origin changed. | 320 // Try to update with just the origin changed. |
| 321 AutofillProfile original_profile(profile); | 321 AutofillProfile original_profile(profile); |
| 322 CreditCard original_credit_card(credit_card); | 322 CreditCard original_credit_card(credit_card); |
| 323 profile.set_origin("Chrome settings"); | 323 profile.set_origin("Chrome settings"); |
| 324 credit_card.set_origin("Chrome settings"); | 324 credit_card.set_origin("Chrome settings"); |
| 325 | 325 |
| 326 EXPECT_TRUE(profile.IsVerified()); | 326 EXPECT_TRUE(profile.IsVerified()); |
| 327 EXPECT_TRUE(credit_card.IsVerified()); | 327 EXPECT_TRUE(credit_card.IsVerified()); |
| 328 | 328 |
| 329 personal_data_->UpdateProfile(profile); | 329 personal_data_->UpdateProfile(profile); |
| 330 personal_data_->UpdateCreditCard(credit_card); | 330 personal_data_->UpdateCreditCard(credit_card); |
| 331 | 331 |
| 332 // Note: No refresh, as no update is expected. | 332 // Note: No refresh, as no update is expected. |
| 333 | 333 |
| 334 const std::vector<AutofillProfile*>& profiles2 = | 334 const std::vector<AutofillProfile*>& profiles2 = |
| 335 personal_data_->GetProfiles(); | 335 personal_data_->GetProfiles(); |
| 336 const std::vector<CreditCard*>& cards2 = personal_data_->credit_cards(); | 336 const std::vector<CreditCard*>& cards2 = personal_data_->GetCreditCards(); |
| 337 ASSERT_EQ(1U, profiles2.size()); | 337 ASSERT_EQ(1U, profiles2.size()); |
| 338 ASSERT_EQ(1U, cards2.size()); | 338 ASSERT_EQ(1U, cards2.size()); |
| 339 EXPECT_NE(profile.origin(), profiles2[0]->origin()); | 339 EXPECT_NE(profile.origin(), profiles2[0]->origin()); |
| 340 EXPECT_NE(credit_card.origin(), cards2[0]->origin()); | 340 EXPECT_NE(credit_card.origin(), cards2[0]->origin()); |
| 341 // TODO(isherman): Verify that the origins match once they are saved and read | 341 // TODO(isherman): Verify that the origins match once they are saved and read |
| 342 // from the database. http://crbug.com/170401 | 342 // from the database. http://crbug.com/170401 |
| 343 // EXPECT_EQ(original_profile.origin(), profiles2[0]->origin()); | 343 // EXPECT_EQ(original_profile.origin(), profiles2[0]->origin()); |
| 344 // EXPECT_EQ(original_credit_card.origin(), cards2[0]->origin()); | 344 // EXPECT_EQ(original_credit_card.origin(), cards2[0]->origin()); |
| 345 | 345 |
| 346 // Try to update with data changed as well. | 346 // Try to update with data changed as well. |
| 347 profile.SetRawInfo(NAME_FIRST, ASCIIToUTF16("John")); | 347 profile.SetRawInfo(NAME_FIRST, ASCIIToUTF16("John")); |
| 348 credit_card.SetRawInfo(CREDIT_CARD_NAME, ASCIIToUTF16("Joe")); | 348 credit_card.SetRawInfo(CREDIT_CARD_NAME, ASCIIToUTF16("Joe")); |
| 349 | 349 |
| 350 personal_data_->UpdateProfile(profile); | 350 personal_data_->UpdateProfile(profile); |
| 351 personal_data_->UpdateCreditCard(credit_card); | 351 personal_data_->UpdateCreditCard(credit_card); |
| 352 | 352 |
| 353 // Verify that the web database has been updated and the notification sent. | 353 // Verify that the web database has been updated and the notification sent. |
| 354 EXPECT_CALL(personal_data_observer_, | 354 EXPECT_CALL(personal_data_observer_, |
| 355 OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); | 355 OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); |
| 356 MessageLoop::current()->Run(); | 356 MessageLoop::current()->Run(); |
| 357 | 357 |
| 358 const std::vector<AutofillProfile*>& profiles3 = | 358 const std::vector<AutofillProfile*>& profiles3 = |
| 359 personal_data_->GetProfiles(); | 359 personal_data_->GetProfiles(); |
| 360 const std::vector<CreditCard*>& cards3 = personal_data_->credit_cards(); | 360 const std::vector<CreditCard*>& cards3 = personal_data_->GetCreditCards(); |
| 361 ASSERT_EQ(1U, profiles3.size()); | 361 ASSERT_EQ(1U, profiles3.size()); |
| 362 ASSERT_EQ(1U, cards3.size()); | 362 ASSERT_EQ(1U, cards3.size()); |
| 363 EXPECT_EQ(0, profile.Compare(*profiles3[0])); | 363 EXPECT_EQ(0, profile.Compare(*profiles3[0])); |
| 364 EXPECT_EQ(0, credit_card.Compare(*cards3[0])); | 364 EXPECT_EQ(0, credit_card.Compare(*cards3[0])); |
| 365 // TODO(isherman): Verify that the origins match once they are saved and read | 365 // TODO(isherman): Verify that the origins match once they are saved and read |
| 366 // from the database. http://crbug.com/170401 | 366 // from the database. http://crbug.com/170401 |
| 367 // EXPECT_EQ(profile.origin(), profiles3[0]->origin()); | 367 // EXPECT_EQ(profile.origin(), profiles3[0]->origin()); |
| 368 // EXPECT_EQ(credit_card.origin(), cards3[0]->origin()); | 368 // EXPECT_EQ(credit_card.origin(), cards3[0]->origin()); |
| 369 } | 369 } |
| 370 | 370 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 405 | 405 |
| 406 // Add two test credit cards to the database. | 406 // Add two test credit cards to the database. |
| 407 personal_data_->AddCreditCard(credit_card0); | 407 personal_data_->AddCreditCard(credit_card0); |
| 408 personal_data_->AddCreditCard(credit_card1); | 408 personal_data_->AddCreditCard(credit_card1); |
| 409 | 409 |
| 410 // Verify that the web database has been updated and the notification sent. | 410 // Verify that the web database has been updated and the notification sent. |
| 411 EXPECT_CALL(personal_data_observer_, | 411 EXPECT_CALL(personal_data_observer_, |
| 412 OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); | 412 OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); |
| 413 MessageLoop::current()->Run(); | 413 MessageLoop::current()->Run(); |
| 414 | 414 |
| 415 const std::vector<CreditCard*>& results2 = personal_data_->credit_cards(); | 415 const std::vector<CreditCard*>& results2 = personal_data_->GetCreditCards(); |
| 416 ASSERT_EQ(2U, results2.size()); | 416 ASSERT_EQ(2U, results2.size()); |
| 417 EXPECT_EQ(credit_card0, *results2[0]); | 417 EXPECT_EQ(credit_card0, *results2[0]); |
| 418 EXPECT_EQ(credit_card1, *results2[1]); | 418 EXPECT_EQ(credit_card1, *results2[1]); |
| 419 | 419 |
| 420 // Determine uniqueness by inserting all of the GUIDs into a set and verifying | 420 // Determine uniqueness by inserting all of the GUIDs into a set and verifying |
| 421 // the size of the set matches the number of GUIDs. | 421 // the size of the set matches the number of GUIDs. |
| 422 std::set<std::string> guids; | 422 std::set<std::string> guids; |
| 423 guids.insert(profile0.guid()); | 423 guids.insert(profile0.guid()); |
| 424 guids.insert(profile1.guid()); | 424 guids.insert(profile1.guid()); |
| 425 guids.insert(credit_card0.guid()); | 425 guids.insert(credit_card0.guid()); |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 494 personal_data_->AddCreditCard(credit_card0); | 494 personal_data_->AddCreditCard(credit_card0); |
| 495 | 495 |
| 496 // Note: no refresh here. | 496 // Note: no refresh here. |
| 497 | 497 |
| 498 // Reset the PersonalDataManager. This tests that the personal data was saved | 498 // Reset the PersonalDataManager. This tests that the personal data was saved |
| 499 // to the web database, and that we can load the credit cards from the web | 499 // to the web database, and that we can load the credit cards from the web |
| 500 // database. | 500 // database. |
| 501 ResetPersonalDataManager(); | 501 ResetPersonalDataManager(); |
| 502 | 502 |
| 503 // Verify that we've loaded the credit cards from the web database. | 503 // Verify that we've loaded the credit cards from the web database. |
| 504 const std::vector<CreditCard*>& results2 = personal_data_->credit_cards(); | 504 const std::vector<CreditCard*>& results2 = personal_data_->GetCreditCards(); |
| 505 ASSERT_EQ(0U, results2.size()); | 505 ASSERT_EQ(0U, results2.size()); |
| 506 } | 506 } |
| 507 | 507 |
| 508 TEST_F(PersonalDataManagerTest, Refresh) { | 508 TEST_F(PersonalDataManagerTest, Refresh) { |
| 509 AutofillProfile profile0; | 509 AutofillProfile profile0; |
| 510 test::SetProfileInfo(&profile0, | 510 test::SetProfileInfo(&profile0, |
| 511 "Marion", "Mitchell", "Morrison", | 511 "Marion", "Mitchell", "Morrison", |
| 512 "johnwayne@me.xyz", "Fox", "123 Zoo St.", "unit 5", "Hollywood", "CA", | 512 "johnwayne@me.xyz", "Fox", "123 Zoo St.", "unit 5", "Hollywood", "CA", |
| 513 "91601", "US", "12345678910"); | 513 "91601", "US", "12345678910"); |
| 514 | 514 |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 739 form.fields.push_back(field); | 739 form.fields.push_back(field); |
| 740 FormStructure form_structure(form, std::string()); | 740 FormStructure form_structure(form, std::string()); |
| 741 form_structure.DetermineHeuristicTypes(TestAutofillMetrics()); | 741 form_structure.DetermineHeuristicTypes(TestAutofillMetrics()); |
| 742 const CreditCard* imported_credit_card; | 742 const CreditCard* imported_credit_card; |
| 743 EXPECT_FALSE(personal_data_->ImportFormData(form_structure, | 743 EXPECT_FALSE(personal_data_->ImportFormData(form_structure, |
| 744 &imported_credit_card)); | 744 &imported_credit_card)); |
| 745 ASSERT_FALSE(imported_credit_card); | 745 ASSERT_FALSE(imported_credit_card); |
| 746 | 746 |
| 747 const std::vector<AutofillProfile*>& profiles = personal_data_->GetProfiles(); | 747 const std::vector<AutofillProfile*>& profiles = personal_data_->GetProfiles(); |
| 748 ASSERT_EQ(0U, profiles.size()); | 748 ASSERT_EQ(0U, profiles.size()); |
| 749 const std::vector<CreditCard*>& credit_cards = personal_data_->credit_cards(); | 749 const std::vector<CreditCard*>& cards = personal_data_->GetCreditCards(); |
| 750 ASSERT_EQ(0U, credit_cards.size()); | 750 ASSERT_EQ(0U, cards.size()); |
| 751 } | 751 } |
| 752 | 752 |
| 753 TEST_F(PersonalDataManagerTest, ImportFormMinimumAddressUSA) { | 753 TEST_F(PersonalDataManagerTest, ImportFormMinimumAddressUSA) { |
| 754 // United States addresses must specifiy one address line, a city, state and | 754 // United States addresses must specifiy one address line, a city, state and |
| 755 // zip code. | 755 // zip code. |
| 756 FormData form; | 756 FormData form; |
| 757 FormFieldData field; | 757 FormFieldData field; |
| 758 test::CreateTestFormField("Name:", "name", "Barack Obama", "text", &field); | 758 test::CreateTestFormField("Name:", "name", "Barack Obama", "text", &field); |
| 759 form.fields.push_back(field); | 759 form.fields.push_back(field); |
| 760 test::CreateTestFormField( | 760 test::CreateTestFormField( |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 897 personal_data_->AddCreditCard(credit_card2); | 897 personal_data_->AddCreditCard(credit_card2); |
| 898 personal_data_->AddCreditCard(credit_card3); | 898 personal_data_->AddCreditCard(credit_card3); |
| 899 personal_data_->AddCreditCard(credit_card4); | 899 personal_data_->AddCreditCard(credit_card4); |
| 900 personal_data_->AddCreditCard(credit_card5); | 900 personal_data_->AddCreditCard(credit_card5); |
| 901 | 901 |
| 902 // Reset the PersonalDataManager. This tests that the personal data was saved | 902 // Reset the PersonalDataManager. This tests that the personal data was saved |
| 903 // to the web database, and that we can load the credit cards from the web | 903 // to the web database, and that we can load the credit cards from the web |
| 904 // database. | 904 // database. |
| 905 ResetPersonalDataManager(); | 905 ResetPersonalDataManager(); |
| 906 | 906 |
| 907 const std::vector<CreditCard*>& results = personal_data_->credit_cards(); | 907 const std::vector<CreditCard*>& results = personal_data_->GetCreditCards(); |
| 908 ASSERT_EQ(6U, results.size()); | 908 ASSERT_EQ(6U, results.size()); |
| 909 EXPECT_EQ(credit_card0.guid(), results[0]->guid()); | 909 EXPECT_EQ(credit_card0.guid(), results[0]->guid()); |
| 910 EXPECT_EQ(credit_card1.guid(), results[1]->guid()); | 910 EXPECT_EQ(credit_card1.guid(), results[1]->guid()); |
| 911 EXPECT_EQ(credit_card2.guid(), results[2]->guid()); | 911 EXPECT_EQ(credit_card2.guid(), results[2]->guid()); |
| 912 EXPECT_EQ(credit_card3.guid(), results[3]->guid()); | 912 EXPECT_EQ(credit_card3.guid(), results[3]->guid()); |
| 913 EXPECT_EQ(credit_card4.guid(), results[4]->guid()); | 913 EXPECT_EQ(credit_card4.guid(), results[4]->guid()); |
| 914 EXPECT_EQ(credit_card5.guid(), results[5]->guid()); | 914 EXPECT_EQ(credit_card5.guid(), results[5]->guid()); |
| 915 } | 915 } |
| 916 | 916 |
| 917 TEST_F(PersonalDataManagerTest, AggregateTwoDifferentProfiles) { | 917 TEST_F(PersonalDataManagerTest, AggregateTwoDifferentProfiles) { |
| (...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1381 EXPECT_FALSE(personal_data_->ImportFormData(form_structure1, | 1381 EXPECT_FALSE(personal_data_->ImportFormData(form_structure1, |
| 1382 &imported_credit_card)); | 1382 &imported_credit_card)); |
| 1383 ASSERT_FALSE(imported_credit_card); | 1383 ASSERT_FALSE(imported_credit_card); |
| 1384 | 1384 |
| 1385 // Since no refresh is expected, reload the data from the database to make | 1385 // Since no refresh is expected, reload the data from the database to make |
| 1386 // sure no changes were written out. | 1386 // sure no changes were written out. |
| 1387 ResetPersonalDataManager(); | 1387 ResetPersonalDataManager(); |
| 1388 | 1388 |
| 1389 const std::vector<AutofillProfile*>& profiles = personal_data_->GetProfiles(); | 1389 const std::vector<AutofillProfile*>& profiles = personal_data_->GetProfiles(); |
| 1390 ASSERT_EQ(0U, profiles.size()); | 1390 ASSERT_EQ(0U, profiles.size()); |
| 1391 const std::vector<CreditCard*>& credit_cards = personal_data_->credit_cards(); | 1391 const std::vector<CreditCard*>& cards = personal_data_->GetCreditCards(); |
| 1392 ASSERT_EQ(0U, credit_cards.size()); | 1392 ASSERT_EQ(0U, cards.size()); |
| 1393 } | 1393 } |
| 1394 | 1394 |
| 1395 TEST_F(PersonalDataManagerTest, AggregateExistingAuxiliaryProfile) { | 1395 TEST_F(PersonalDataManagerTest, AggregateExistingAuxiliaryProfile) { |
| 1396 // Simulate having access to an auxiliary profile. | 1396 // Simulate having access to an auxiliary profile. |
| 1397 // |auxiliary_profile| will be owned by |personal_data_|. | 1397 // |auxiliary_profile| will be owned by |personal_data_|. |
| 1398 AutofillProfile* auxiliary_profile = new AutofillProfile; | 1398 AutofillProfile* auxiliary_profile = new AutofillProfile; |
| 1399 test::SetProfileInfo(auxiliary_profile, | 1399 test::SetProfileInfo(auxiliary_profile, |
| 1400 "Tester", "Frederick", "McAddressBookTesterson", | 1400 "Tester", "Frederick", "McAddressBookTesterson", |
| 1401 "tester@example.com", "Acme Inc.", "1 Main", "Apt A", "San Francisco", | 1401 "tester@example.com", "Acme Inc.", "1 Main", "Apt A", "San Francisco", |
| 1402 "CA", "94102", "US", "1.415.888.9999"); | 1402 "CA", "94102", "US", "1.415.888.9999"); |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1471 delete imported_credit_card; | 1471 delete imported_credit_card; |
| 1472 | 1472 |
| 1473 // Verify that the web database has been updated and the notification sent. | 1473 // Verify that the web database has been updated and the notification sent. |
| 1474 EXPECT_CALL(personal_data_observer_, | 1474 EXPECT_CALL(personal_data_observer_, |
| 1475 OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); | 1475 OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); |
| 1476 MessageLoop::current()->Run(); | 1476 MessageLoop::current()->Run(); |
| 1477 | 1477 |
| 1478 CreditCard expected; | 1478 CreditCard expected; |
| 1479 test::SetCreditCardInfo(&expected, | 1479 test::SetCreditCardInfo(&expected, |
| 1480 "Biggie Smalls", "4111111111111111", "01", "2011"); | 1480 "Biggie Smalls", "4111111111111111", "01", "2011"); |
| 1481 const std::vector<CreditCard*>& results = personal_data_->credit_cards(); | 1481 const std::vector<CreditCard*>& results = personal_data_->GetCreditCards(); |
| 1482 ASSERT_EQ(1U, results.size()); | 1482 ASSERT_EQ(1U, results.size()); |
| 1483 EXPECT_EQ(0, expected.Compare(*results[0])); | 1483 EXPECT_EQ(0, expected.Compare(*results[0])); |
| 1484 | 1484 |
| 1485 // Add a second different valid credit card. | 1485 // Add a second different valid credit card. |
| 1486 FormData form2; | 1486 FormData form2; |
| 1487 test::CreateTestFormField( | 1487 test::CreateTestFormField( |
| 1488 "Name on card:", "name_on_card", "", "text", &field); | 1488 "Name on card:", "name_on_card", "", "text", &field); |
| 1489 form2.fields.push_back(field); | 1489 form2.fields.push_back(field); |
| 1490 test::CreateTestFormField( | 1490 test::CreateTestFormField( |
| 1491 "Card Number:", "card_number", "5500 0000 0000 0004", "text", &field); | 1491 "Card Number:", "card_number", "5500 0000 0000 0004", "text", &field); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1503 personal_data_->SaveImportedCreditCard(*imported_credit_card); | 1503 personal_data_->SaveImportedCreditCard(*imported_credit_card); |
| 1504 delete imported_credit_card; | 1504 delete imported_credit_card; |
| 1505 | 1505 |
| 1506 // Verify that the web database has been updated and the notification sent. | 1506 // Verify that the web database has been updated and the notification sent. |
| 1507 EXPECT_CALL(personal_data_observer_, | 1507 EXPECT_CALL(personal_data_observer_, |
| 1508 OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); | 1508 OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); |
| 1509 MessageLoop::current()->Run(); | 1509 MessageLoop::current()->Run(); |
| 1510 | 1510 |
| 1511 CreditCard expected2; | 1511 CreditCard expected2; |
| 1512 test::SetCreditCardInfo(&expected2,"", "5500000000000004", "02", "2012"); | 1512 test::SetCreditCardInfo(&expected2,"", "5500000000000004", "02", "2012"); |
| 1513 const std::vector<CreditCard*>& results2 = personal_data_->credit_cards(); | 1513 const std::vector<CreditCard*>& results2 = personal_data_->GetCreditCards(); |
| 1514 ASSERT_EQ(2U, results2.size()); | 1514 ASSERT_EQ(2U, results2.size()); |
| 1515 EXPECT_EQ(0, expected.Compare(*results2[0])); | 1515 EXPECT_EQ(0, expected.Compare(*results2[0])); |
| 1516 EXPECT_EQ(0, expected2.Compare(*results2[1])); | 1516 EXPECT_EQ(0, expected2.Compare(*results2[1])); |
| 1517 } | 1517 } |
| 1518 | 1518 |
| 1519 TEST_F(PersonalDataManagerTest, AggregateInvalidCreditCard) { | 1519 TEST_F(PersonalDataManagerTest, AggregateInvalidCreditCard) { |
| 1520 FormData form1; | 1520 FormData form1; |
| 1521 | 1521 |
| 1522 // Start with a single valid credit card form. | 1522 // Start with a single valid credit card form. |
| 1523 FormFieldData field; | 1523 FormFieldData field; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 1542 delete imported_credit_card; | 1542 delete imported_credit_card; |
| 1543 | 1543 |
| 1544 // Verify that the web database has been updated and the notification sent. | 1544 // Verify that the web database has been updated and the notification sent. |
| 1545 EXPECT_CALL(personal_data_observer_, | 1545 EXPECT_CALL(personal_data_observer_, |
| 1546 OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); | 1546 OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); |
| 1547 MessageLoop::current()->Run(); | 1547 MessageLoop::current()->Run(); |
| 1548 | 1548 |
| 1549 CreditCard expected; | 1549 CreditCard expected; |
| 1550 test::SetCreditCardInfo(&expected, | 1550 test::SetCreditCardInfo(&expected, |
| 1551 "Biggie Smalls", "4111111111111111", "01", "2011"); | 1551 "Biggie Smalls", "4111111111111111", "01", "2011"); |
| 1552 const std::vector<CreditCard*>& results = personal_data_->credit_cards(); | 1552 const std::vector<CreditCard*>& results = personal_data_->GetCreditCards(); |
| 1553 ASSERT_EQ(1U, results.size()); | 1553 ASSERT_EQ(1U, results.size()); |
| 1554 EXPECT_EQ(0, expected.Compare(*results[0])); | 1554 EXPECT_EQ(0, expected.Compare(*results[0])); |
| 1555 | 1555 |
| 1556 // Add a second different invalid credit card. | 1556 // Add a second different invalid credit card. |
| 1557 FormData form2; | 1557 FormData form2; |
| 1558 test::CreateTestFormField( | 1558 test::CreateTestFormField( |
| 1559 "Name on card:", "name_on_card", "Jim Johansen", "text", &field); | 1559 "Name on card:", "name_on_card", "Jim Johansen", "text", &field); |
| 1560 form2.fields.push_back(field); | 1560 form2.fields.push_back(field); |
| 1561 test::CreateTestFormField( | 1561 test::CreateTestFormField( |
| 1562 "Card Number:", "card_number", "1000000000000000", "text", &field); | 1562 "Card Number:", "card_number", "1000000000000000", "text", &field); |
| 1563 form2.fields.push_back(field); | 1563 form2.fields.push_back(field); |
| 1564 test::CreateTestFormField("Exp Month:", "exp_month", "02", "text", &field); | 1564 test::CreateTestFormField("Exp Month:", "exp_month", "02", "text", &field); |
| 1565 form2.fields.push_back(field); | 1565 form2.fields.push_back(field); |
| 1566 test::CreateTestFormField("Exp Year:", "exp_year", "2012", "text", &field); | 1566 test::CreateTestFormField("Exp Year:", "exp_year", "2012", "text", &field); |
| 1567 form2.fields.push_back(field); | 1567 form2.fields.push_back(field); |
| 1568 | 1568 |
| 1569 FormStructure form_structure2(form2, std::string()); | 1569 FormStructure form_structure2(form2, std::string()); |
| 1570 form_structure2.DetermineHeuristicTypes(TestAutofillMetrics()); | 1570 form_structure2.DetermineHeuristicTypes(TestAutofillMetrics()); |
| 1571 EXPECT_FALSE(personal_data_->ImportFormData(form_structure2, | 1571 EXPECT_FALSE(personal_data_->ImportFormData(form_structure2, |
| 1572 &imported_credit_card)); | 1572 &imported_credit_card)); |
| 1573 ASSERT_FALSE(imported_credit_card); | 1573 ASSERT_FALSE(imported_credit_card); |
| 1574 | 1574 |
| 1575 // Since no refresh is expected, reload the data from the database to make | 1575 // Since no refresh is expected, reload the data from the database to make |
| 1576 // sure no changes were written out. | 1576 // sure no changes were written out. |
| 1577 ResetPersonalDataManager(); | 1577 ResetPersonalDataManager(); |
| 1578 | 1578 |
| 1579 const std::vector<CreditCard*>& results2 = personal_data_->credit_cards(); | 1579 const std::vector<CreditCard*>& results2 = personal_data_->GetCreditCards(); |
| 1580 ASSERT_EQ(1U, results2.size()); | 1580 ASSERT_EQ(1U, results2.size()); |
| 1581 EXPECT_EQ(0, expected.Compare(*results2[0])); | 1581 EXPECT_EQ(0, expected.Compare(*results2[0])); |
| 1582 } | 1582 } |
| 1583 | 1583 |
| 1584 TEST_F(PersonalDataManagerTest, AggregateSameCreditCardWithConflict) { | 1584 TEST_F(PersonalDataManagerTest, AggregateSameCreditCardWithConflict) { |
| 1585 FormData form1; | 1585 FormData form1; |
| 1586 | 1586 |
| 1587 // Start with a single valid credit card form. | 1587 // Start with a single valid credit card form. |
| 1588 FormFieldData field; | 1588 FormFieldData field; |
| 1589 test::CreateTestFormField( | 1589 test::CreateTestFormField( |
| (...skipping 17 matching lines...) Expand all Loading... |
| 1607 delete imported_credit_card; | 1607 delete imported_credit_card; |
| 1608 | 1608 |
| 1609 // Verify that the web database has been updated and the notification sent. | 1609 // Verify that the web database has been updated and the notification sent. |
| 1610 EXPECT_CALL(personal_data_observer_, | 1610 EXPECT_CALL(personal_data_observer_, |
| 1611 OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); | 1611 OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); |
| 1612 MessageLoop::current()->Run(); | 1612 MessageLoop::current()->Run(); |
| 1613 | 1613 |
| 1614 CreditCard expected; | 1614 CreditCard expected; |
| 1615 test::SetCreditCardInfo(&expected, | 1615 test::SetCreditCardInfo(&expected, |
| 1616 "Biggie Smalls", "4111111111111111", "01", "2011"); | 1616 "Biggie Smalls", "4111111111111111", "01", "2011"); |
| 1617 const std::vector<CreditCard*>& results = personal_data_->credit_cards(); | 1617 const std::vector<CreditCard*>& results = personal_data_->GetCreditCards(); |
| 1618 ASSERT_EQ(1U, results.size()); | 1618 ASSERT_EQ(1U, results.size()); |
| 1619 EXPECT_EQ(0, expected.Compare(*results[0])); | 1619 EXPECT_EQ(0, expected.Compare(*results[0])); |
| 1620 | 1620 |
| 1621 // Add a second different valid credit card where the year is different but | 1621 // Add a second different valid credit card where the year is different but |
| 1622 // the credit card number matches. | 1622 // the credit card number matches. |
| 1623 FormData form2; | 1623 FormData form2; |
| 1624 test::CreateTestFormField( | 1624 test::CreateTestFormField( |
| 1625 "Name on card:", "name_on_card", "Biggie Smalls", "text", &field); | 1625 "Name on card:", "name_on_card", "Biggie Smalls", "text", &field); |
| 1626 form2.fields.push_back(field); | 1626 form2.fields.push_back(field); |
| 1627 test::CreateTestFormField( | 1627 test::CreateTestFormField( |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1641 // Verify that the web database has been updated and the notification sent. | 1641 // Verify that the web database has been updated and the notification sent. |
| 1642 EXPECT_CALL(personal_data_observer_, | 1642 EXPECT_CALL(personal_data_observer_, |
| 1643 OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); | 1643 OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); |
| 1644 MessageLoop::current()->Run(); | 1644 MessageLoop::current()->Run(); |
| 1645 | 1645 |
| 1646 // Expect that the newer information is saved. In this case the year is | 1646 // Expect that the newer information is saved. In this case the year is |
| 1647 // updated to "2012". | 1647 // updated to "2012". |
| 1648 CreditCard expected2; | 1648 CreditCard expected2; |
| 1649 test::SetCreditCardInfo(&expected2, | 1649 test::SetCreditCardInfo(&expected2, |
| 1650 "Biggie Smalls", "4111111111111111", "01", "2012"); | 1650 "Biggie Smalls", "4111111111111111", "01", "2012"); |
| 1651 const std::vector<CreditCard*>& results2 = personal_data_->credit_cards(); | 1651 const std::vector<CreditCard*>& results2 = personal_data_->GetCreditCards(); |
| 1652 ASSERT_EQ(1U, results2.size()); | 1652 ASSERT_EQ(1U, results2.size()); |
| 1653 EXPECT_EQ(0, expected2.Compare(*results2[0])); | 1653 EXPECT_EQ(0, expected2.Compare(*results2[0])); |
| 1654 } | 1654 } |
| 1655 | 1655 |
| 1656 TEST_F(PersonalDataManagerTest, AggregateEmptyCreditCardWithConflict) { | 1656 TEST_F(PersonalDataManagerTest, AggregateEmptyCreditCardWithConflict) { |
| 1657 FormData form1; | 1657 FormData form1; |
| 1658 | 1658 |
| 1659 // Start with a single valid credit card form. | 1659 // Start with a single valid credit card form. |
| 1660 FormFieldData field; | 1660 FormFieldData field; |
| 1661 test::CreateTestFormField( | 1661 test::CreateTestFormField( |
| (...skipping 17 matching lines...) Expand all Loading... |
| 1679 delete imported_credit_card; | 1679 delete imported_credit_card; |
| 1680 | 1680 |
| 1681 // Verify that the web database has been updated and the notification sent. | 1681 // Verify that the web database has been updated and the notification sent. |
| 1682 EXPECT_CALL(personal_data_observer_, | 1682 EXPECT_CALL(personal_data_observer_, |
| 1683 OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); | 1683 OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); |
| 1684 MessageLoop::current()->Run(); | 1684 MessageLoop::current()->Run(); |
| 1685 | 1685 |
| 1686 CreditCard expected; | 1686 CreditCard expected; |
| 1687 test::SetCreditCardInfo(&expected, | 1687 test::SetCreditCardInfo(&expected, |
| 1688 "Biggie Smalls", "4111111111111111", "01", "2011"); | 1688 "Biggie Smalls", "4111111111111111", "01", "2011"); |
| 1689 const std::vector<CreditCard*>& results = personal_data_->credit_cards(); | 1689 const std::vector<CreditCard*>& results = personal_data_->GetCreditCards(); |
| 1690 ASSERT_EQ(1U, results.size()); | 1690 ASSERT_EQ(1U, results.size()); |
| 1691 EXPECT_EQ(0, expected.Compare(*results[0])); | 1691 EXPECT_EQ(0, expected.Compare(*results[0])); |
| 1692 | 1692 |
| 1693 // Add a second credit card with no number. | 1693 // Add a second credit card with no number. |
| 1694 FormData form2; | 1694 FormData form2; |
| 1695 test::CreateTestFormField( | 1695 test::CreateTestFormField( |
| 1696 "Name on card:", "name_on_card", "Biggie Smalls", "text", &field); | 1696 "Name on card:", "name_on_card", "Biggie Smalls", "text", &field); |
| 1697 form2.fields.push_back(field); | 1697 form2.fields.push_back(field); |
| 1698 test::CreateTestFormField("Exp Month:", "exp_month", "01", "text", &field); | 1698 test::CreateTestFormField("Exp Month:", "exp_month", "01", "text", &field); |
| 1699 form2.fields.push_back(field); | 1699 form2.fields.push_back(field); |
| 1700 test::CreateTestFormField("Exp Year:", "exp_year", "2012", "text", &field); | 1700 test::CreateTestFormField("Exp Year:", "exp_year", "2012", "text", &field); |
| 1701 form2.fields.push_back(field); | 1701 form2.fields.push_back(field); |
| 1702 | 1702 |
| 1703 FormStructure form_structure2(form2, std::string()); | 1703 FormStructure form_structure2(form2, std::string()); |
| 1704 form_structure2.DetermineHeuristicTypes(TestAutofillMetrics()); | 1704 form_structure2.DetermineHeuristicTypes(TestAutofillMetrics()); |
| 1705 EXPECT_FALSE(personal_data_->ImportFormData(form_structure2, | 1705 EXPECT_FALSE(personal_data_->ImportFormData(form_structure2, |
| 1706 &imported_credit_card)); | 1706 &imported_credit_card)); |
| 1707 EXPECT_FALSE(imported_credit_card); | 1707 EXPECT_FALSE(imported_credit_card); |
| 1708 | 1708 |
| 1709 // Since no refresh is expected, reload the data from the database to make | 1709 // Since no refresh is expected, reload the data from the database to make |
| 1710 // sure no changes were written out. | 1710 // sure no changes were written out. |
| 1711 ResetPersonalDataManager(); | 1711 ResetPersonalDataManager(); |
| 1712 | 1712 |
| 1713 // No change is expected. | 1713 // No change is expected. |
| 1714 CreditCard expected2; | 1714 CreditCard expected2; |
| 1715 test::SetCreditCardInfo(&expected2, | 1715 test::SetCreditCardInfo(&expected2, |
| 1716 "Biggie Smalls", "4111111111111111", "01", "2011"); | 1716 "Biggie Smalls", "4111111111111111", "01", "2011"); |
| 1717 const std::vector<CreditCard*>& results2 = personal_data_->credit_cards(); | 1717 const std::vector<CreditCard*>& results2 = personal_data_->GetCreditCards(); |
| 1718 ASSERT_EQ(1U, results2.size()); | 1718 ASSERT_EQ(1U, results2.size()); |
| 1719 EXPECT_EQ(0, expected2.Compare(*results2[0])); | 1719 EXPECT_EQ(0, expected2.Compare(*results2[0])); |
| 1720 } | 1720 } |
| 1721 | 1721 |
| 1722 TEST_F(PersonalDataManagerTest, AggregateCreditCardWithMissingInfoInNew) { | 1722 TEST_F(PersonalDataManagerTest, AggregateCreditCardWithMissingInfoInNew) { |
| 1723 FormData form1; | 1723 FormData form1; |
| 1724 | 1724 |
| 1725 // Start with a single valid credit card form. | 1725 // Start with a single valid credit card form. |
| 1726 FormFieldData field; | 1726 FormFieldData field; |
| 1727 test::CreateTestFormField( | 1727 test::CreateTestFormField( |
| (...skipping 17 matching lines...) Expand all Loading... |
| 1745 delete imported_credit_card; | 1745 delete imported_credit_card; |
| 1746 | 1746 |
| 1747 // Verify that the web database has been updated and the notification sent. | 1747 // Verify that the web database has been updated and the notification sent. |
| 1748 EXPECT_CALL(personal_data_observer_, | 1748 EXPECT_CALL(personal_data_observer_, |
| 1749 OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); | 1749 OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); |
| 1750 MessageLoop::current()->Run(); | 1750 MessageLoop::current()->Run(); |
| 1751 | 1751 |
| 1752 CreditCard expected; | 1752 CreditCard expected; |
| 1753 test::SetCreditCardInfo(&expected, | 1753 test::SetCreditCardInfo(&expected, |
| 1754 "Biggie Smalls", "4111111111111111", "01", "2011"); | 1754 "Biggie Smalls", "4111111111111111", "01", "2011"); |
| 1755 const std::vector<CreditCard*>& results = personal_data_->credit_cards(); | 1755 const std::vector<CreditCard*>& results = personal_data_->GetCreditCards(); |
| 1756 ASSERT_EQ(1U, results.size()); | 1756 ASSERT_EQ(1U, results.size()); |
| 1757 EXPECT_EQ(0, expected.Compare(*results[0])); | 1757 EXPECT_EQ(0, expected.Compare(*results[0])); |
| 1758 | 1758 |
| 1759 // Add a second different valid credit card where the name is missing but | 1759 // Add a second different valid credit card where the name is missing but |
| 1760 // the credit card number matches. | 1760 // the credit card number matches. |
| 1761 FormData form2; | 1761 FormData form2; |
| 1762 // Note missing name. | 1762 // Note missing name. |
| 1763 test::CreateTestFormField( | 1763 test::CreateTestFormField( |
| 1764 "Card Number:", "card_number", "4111111111111111", "text", &field); | 1764 "Card Number:", "card_number", "4111111111111111", "text", &field); |
| 1765 form2.fields.push_back(field); | 1765 form2.fields.push_back(field); |
| 1766 test::CreateTestFormField("Exp Month:", "exp_month", "01", "text", &field); | 1766 test::CreateTestFormField("Exp Month:", "exp_month", "01", "text", &field); |
| 1767 form2.fields.push_back(field); | 1767 form2.fields.push_back(field); |
| 1768 test::CreateTestFormField("Exp Year:", "exp_year", "2011", "text", &field); | 1768 test::CreateTestFormField("Exp Year:", "exp_year", "2011", "text", &field); |
| 1769 form2.fields.push_back(field); | 1769 form2.fields.push_back(field); |
| 1770 | 1770 |
| 1771 FormStructure form_structure2(form2, std::string()); | 1771 FormStructure form_structure2(form2, std::string()); |
| 1772 form_structure2.DetermineHeuristicTypes(TestAutofillMetrics()); | 1772 form_structure2.DetermineHeuristicTypes(TestAutofillMetrics()); |
| 1773 EXPECT_TRUE(personal_data_->ImportFormData(form_structure2, | 1773 EXPECT_TRUE(personal_data_->ImportFormData(form_structure2, |
| 1774 &imported_credit_card)); | 1774 &imported_credit_card)); |
| 1775 EXPECT_FALSE(imported_credit_card); | 1775 EXPECT_FALSE(imported_credit_card); |
| 1776 | 1776 |
| 1777 // Since no refresh is expected, reload the data from the database to make | 1777 // Since no refresh is expected, reload the data from the database to make |
| 1778 // sure no changes were written out. | 1778 // sure no changes were written out. |
| 1779 ResetPersonalDataManager(); | 1779 ResetPersonalDataManager(); |
| 1780 | 1780 |
| 1781 // No change is expected. | 1781 // No change is expected. |
| 1782 CreditCard expected2; | 1782 CreditCard expected2; |
| 1783 test::SetCreditCardInfo(&expected2, | 1783 test::SetCreditCardInfo(&expected2, |
| 1784 "Biggie Smalls", "4111111111111111", "01", "2011"); | 1784 "Biggie Smalls", "4111111111111111", "01", "2011"); |
| 1785 const std::vector<CreditCard*>& results2 = personal_data_->credit_cards(); | 1785 const std::vector<CreditCard*>& results2 = personal_data_->GetCreditCards(); |
| 1786 ASSERT_EQ(1U, results2.size()); | 1786 ASSERT_EQ(1U, results2.size()); |
| 1787 EXPECT_EQ(0, expected2.Compare(*results2[0])); | 1787 EXPECT_EQ(0, expected2.Compare(*results2[0])); |
| 1788 | 1788 |
| 1789 // Add a third credit card where the expiration date is missing. | 1789 // Add a third credit card where the expiration date is missing. |
| 1790 FormData form3; | 1790 FormData form3; |
| 1791 test::CreateTestFormField( | 1791 test::CreateTestFormField( |
| 1792 "Name on card:", "name_on_card", "Johnny McEnroe", "text", &field); | 1792 "Name on card:", "name_on_card", "Johnny McEnroe", "text", &field); |
| 1793 form3.fields.push_back(field); | 1793 form3.fields.push_back(field); |
| 1794 test::CreateTestFormField( | 1794 test::CreateTestFormField( |
| 1795 "Card Number:", "card_number", "5555555555554444", "text", &field); | 1795 "Card Number:", "card_number", "5555555555554444", "text", &field); |
| 1796 form3.fields.push_back(field); | 1796 form3.fields.push_back(field); |
| 1797 // Note missing expiration month and year.. | 1797 // Note missing expiration month and year.. |
| 1798 | 1798 |
| 1799 FormStructure form_structure3(form3, std::string()); | 1799 FormStructure form_structure3(form3, std::string()); |
| 1800 form_structure3.DetermineHeuristicTypes(TestAutofillMetrics()); | 1800 form_structure3.DetermineHeuristicTypes(TestAutofillMetrics()); |
| 1801 EXPECT_FALSE(personal_data_->ImportFormData(form_structure3, | 1801 EXPECT_FALSE(personal_data_->ImportFormData(form_structure3, |
| 1802 &imported_credit_card)); | 1802 &imported_credit_card)); |
| 1803 ASSERT_FALSE(imported_credit_card); | 1803 ASSERT_FALSE(imported_credit_card); |
| 1804 | 1804 |
| 1805 // Since no refresh is expected, reload the data from the database to make | 1805 // Since no refresh is expected, reload the data from the database to make |
| 1806 // sure no changes were written out. | 1806 // sure no changes were written out. |
| 1807 ResetPersonalDataManager(); | 1807 ResetPersonalDataManager(); |
| 1808 | 1808 |
| 1809 // No change is expected. | 1809 // No change is expected. |
| 1810 CreditCard expected3; | 1810 CreditCard expected3; |
| 1811 test::SetCreditCardInfo(&expected3, | 1811 test::SetCreditCardInfo(&expected3, |
| 1812 "Biggie Smalls", "4111111111111111", "01", "2011"); | 1812 "Biggie Smalls", "4111111111111111", "01", "2011"); |
| 1813 const std::vector<CreditCard*>& results3 = personal_data_->credit_cards(); | 1813 const std::vector<CreditCard*>& results3 = personal_data_->GetCreditCards(); |
| 1814 ASSERT_EQ(1U, results3.size()); | 1814 ASSERT_EQ(1U, results3.size()); |
| 1815 EXPECT_EQ(0, expected3.Compare(*results3[0])); | 1815 EXPECT_EQ(0, expected3.Compare(*results3[0])); |
| 1816 } | 1816 } |
| 1817 | 1817 |
| 1818 TEST_F(PersonalDataManagerTest, AggregateCreditCardWithMissingInfoInOld) { | 1818 TEST_F(PersonalDataManagerTest, AggregateCreditCardWithMissingInfoInOld) { |
| 1819 // Start with a single valid credit card stored via the preferences. | 1819 // Start with a single valid credit card stored via the preferences. |
| 1820 // Note the empty name. | 1820 // Note the empty name. |
| 1821 CreditCard saved_credit_card; | 1821 CreditCard saved_credit_card; |
| 1822 test::SetCreditCardInfo(&saved_credit_card, | 1822 test::SetCreditCardInfo(&saved_credit_card, |
| 1823 "", "4111111111111111" /* Visa */, "01", "2011"); | 1823 "", "4111111111111111" /* Visa */, "01", "2011"); |
| 1824 personal_data_->AddCreditCard(saved_credit_card); | 1824 personal_data_->AddCreditCard(saved_credit_card); |
| 1825 | 1825 |
| 1826 // Verify that the web database has been updated and the notification sent. | 1826 // Verify that the web database has been updated and the notification sent. |
| 1827 EXPECT_CALL(personal_data_observer_, | 1827 EXPECT_CALL(personal_data_observer_, |
| 1828 OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); | 1828 OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); |
| 1829 MessageLoop::current()->Run(); | 1829 MessageLoop::current()->Run(); |
| 1830 | 1830 |
| 1831 const std::vector<CreditCard*>& results1 = personal_data_->credit_cards(); | 1831 const std::vector<CreditCard*>& results1 = personal_data_->GetCreditCards(); |
| 1832 ASSERT_EQ(1U, results1.size()); | 1832 ASSERT_EQ(1U, results1.size()); |
| 1833 EXPECT_EQ(saved_credit_card, *results1[0]); | 1833 EXPECT_EQ(saved_credit_card, *results1[0]); |
| 1834 | 1834 |
| 1835 | 1835 |
| 1836 // Add a second different valid credit card where the year is different but | 1836 // Add a second different valid credit card where the year is different but |
| 1837 // the credit card number matches. | 1837 // the credit card number matches. |
| 1838 FormData form; | 1838 FormData form; |
| 1839 FormFieldData field; | 1839 FormFieldData field; |
| 1840 test::CreateTestFormField( | 1840 test::CreateTestFormField( |
| 1841 "Name on card:", "name_on_card", "Biggie Smalls", "text", &field); | 1841 "Name on card:", "name_on_card", "Biggie Smalls", "text", &field); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 1858 // Verify that the web database has been updated and the notification sent. | 1858 // Verify that the web database has been updated and the notification sent. |
| 1859 EXPECT_CALL(personal_data_observer_, | 1859 EXPECT_CALL(personal_data_observer_, |
| 1860 OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); | 1860 OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); |
| 1861 MessageLoop::current()->Run(); | 1861 MessageLoop::current()->Run(); |
| 1862 | 1862 |
| 1863 // Expect that the newer information is saved. In this case the year is | 1863 // Expect that the newer information is saved. In this case the year is |
| 1864 // added to the existing credit card. | 1864 // added to the existing credit card. |
| 1865 CreditCard expected2; | 1865 CreditCard expected2; |
| 1866 test::SetCreditCardInfo(&expected2, | 1866 test::SetCreditCardInfo(&expected2, |
| 1867 "Biggie Smalls", "4111111111111111", "01", "2012"); | 1867 "Biggie Smalls", "4111111111111111", "01", "2012"); |
| 1868 const std::vector<CreditCard*>& results2 = personal_data_->credit_cards(); | 1868 const std::vector<CreditCard*>& results2 = personal_data_->GetCreditCards(); |
| 1869 ASSERT_EQ(1U, results2.size()); | 1869 ASSERT_EQ(1U, results2.size()); |
| 1870 EXPECT_EQ(0, expected2.Compare(*results2[0])); | 1870 EXPECT_EQ(0, expected2.Compare(*results2[0])); |
| 1871 } | 1871 } |
| 1872 | 1872 |
| 1873 // We allow the user to store a credit card number with separators via the UI. | 1873 // We allow the user to store a credit card number with separators via the UI. |
| 1874 // We should not try to re-aggregate the same card with the separators stripped. | 1874 // We should not try to re-aggregate the same card with the separators stripped. |
| 1875 TEST_F(PersonalDataManagerTest, AggregateSameCreditCardWithSeparators) { | 1875 TEST_F(PersonalDataManagerTest, AggregateSameCreditCardWithSeparators) { |
| 1876 // Start with a single valid credit card stored via the preferences. | 1876 // Start with a single valid credit card stored via the preferences. |
| 1877 // Note the separators in the credit card number. | 1877 // Note the separators in the credit card number. |
| 1878 CreditCard saved_credit_card; | 1878 CreditCard saved_credit_card; |
| 1879 test::SetCreditCardInfo(&saved_credit_card, | 1879 test::SetCreditCardInfo(&saved_credit_card, |
| 1880 "Biggie Smalls", "4111 1111 1111 1111" /* Visa */, "01", "2011"); | 1880 "Biggie Smalls", "4111 1111 1111 1111" /* Visa */, "01", "2011"); |
| 1881 personal_data_->AddCreditCard(saved_credit_card); | 1881 personal_data_->AddCreditCard(saved_credit_card); |
| 1882 | 1882 |
| 1883 // Verify that the web database has been updated and the notification sent. | 1883 // Verify that the web database has been updated and the notification sent. |
| 1884 EXPECT_CALL(personal_data_observer_, | 1884 EXPECT_CALL(personal_data_observer_, |
| 1885 OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); | 1885 OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); |
| 1886 MessageLoop::current()->Run(); | 1886 MessageLoop::current()->Run(); |
| 1887 | 1887 |
| 1888 const std::vector<CreditCard*>& results1 = personal_data_->credit_cards(); | 1888 const std::vector<CreditCard*>& results1 = personal_data_->GetCreditCards(); |
| 1889 ASSERT_EQ(1U, results1.size()); | 1889 ASSERT_EQ(1U, results1.size()); |
| 1890 EXPECT_EQ(0, saved_credit_card.Compare(*results1[0])); | 1890 EXPECT_EQ(0, saved_credit_card.Compare(*results1[0])); |
| 1891 | 1891 |
| 1892 // Import the same card info, but with different separators in the number. | 1892 // Import the same card info, but with different separators in the number. |
| 1893 FormData form; | 1893 FormData form; |
| 1894 FormFieldData field; | 1894 FormFieldData field; |
| 1895 test::CreateTestFormField( | 1895 test::CreateTestFormField( |
| 1896 "Name on card:", "name_on_card", "Biggie Smalls", "text", &field); | 1896 "Name on card:", "name_on_card", "Biggie Smalls", "text", &field); |
| 1897 form.fields.push_back(field); | 1897 form.fields.push_back(field); |
| 1898 test::CreateTestFormField( | 1898 test::CreateTestFormField( |
| 1899 "Card Number:", "card_number", "4111-1111-1111-1111", "text", &field); | 1899 "Card Number:", "card_number", "4111-1111-1111-1111", "text", &field); |
| 1900 form.fields.push_back(field); | 1900 form.fields.push_back(field); |
| 1901 test::CreateTestFormField("Exp Month:", "exp_month", "01", "text", &field); | 1901 test::CreateTestFormField("Exp Month:", "exp_month", "01", "text", &field); |
| 1902 form.fields.push_back(field); | 1902 form.fields.push_back(field); |
| 1903 test::CreateTestFormField("Exp Year:", "exp_year", "2011", "text", &field); | 1903 test::CreateTestFormField("Exp Year:", "exp_year", "2011", "text", &field); |
| 1904 form.fields.push_back(field); | 1904 form.fields.push_back(field); |
| 1905 | 1905 |
| 1906 FormStructure form_structure(form, std::string()); | 1906 FormStructure form_structure(form, std::string()); |
| 1907 form_structure.DetermineHeuristicTypes(TestAutofillMetrics()); | 1907 form_structure.DetermineHeuristicTypes(TestAutofillMetrics()); |
| 1908 const CreditCard* imported_credit_card; | 1908 const CreditCard* imported_credit_card; |
| 1909 EXPECT_TRUE(personal_data_->ImportFormData(form_structure, | 1909 EXPECT_TRUE(personal_data_->ImportFormData(form_structure, |
| 1910 &imported_credit_card)); | 1910 &imported_credit_card)); |
| 1911 EXPECT_FALSE(imported_credit_card); | 1911 EXPECT_FALSE(imported_credit_card); |
| 1912 | 1912 |
| 1913 // Since no refresh is expected, reload the data from the database to make | 1913 // Since no refresh is expected, reload the data from the database to make |
| 1914 // sure no changes were written out. | 1914 // sure no changes were written out. |
| 1915 ResetPersonalDataManager(); | 1915 ResetPersonalDataManager(); |
| 1916 | 1916 |
| 1917 // Expect that no new card is saved. | 1917 // Expect that no new card is saved. |
| 1918 const std::vector<CreditCard*>& results2 = personal_data_->credit_cards(); | 1918 const std::vector<CreditCard*>& results2 = personal_data_->GetCreditCards(); |
| 1919 ASSERT_EQ(1U, results2.size()); | 1919 ASSERT_EQ(1U, results2.size()); |
| 1920 EXPECT_EQ(0, saved_credit_card.Compare(*results2[0])); | 1920 EXPECT_EQ(0, saved_credit_card.Compare(*results2[0])); |
| 1921 } | 1921 } |
| 1922 | 1922 |
| 1923 // Ensure that if a verified profile already exists, aggregated profiles cannot | 1923 // Ensure that if a verified profile already exists, aggregated profiles cannot |
| 1924 // modify it in any way. | 1924 // modify it in any way. |
| 1925 // TODO(isherman): Enable this test once origins are saved and read from the | 1925 // TODO(isherman): Enable this test once origins are saved and read from the |
| 1926 // database. http://crbug.com/170401 | 1926 // database. http://crbug.com/170401 |
| 1927 TEST_F(PersonalDataManagerTest, | 1927 TEST_F(PersonalDataManagerTest, |
| 1928 DISABLED_AggregateExistingVerifiedProfileWithConflict) { | 1928 DISABLED_AggregateExistingVerifiedProfileWithConflict) { |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2023 const CreditCard* imported_credit_card; | 2023 const CreditCard* imported_credit_card; |
| 2024 EXPECT_TRUE(personal_data_->ImportFormData(form_structure, | 2024 EXPECT_TRUE(personal_data_->ImportFormData(form_structure, |
| 2025 &imported_credit_card)); | 2025 &imported_credit_card)); |
| 2026 ASSERT_FALSE(imported_credit_card); | 2026 ASSERT_FALSE(imported_credit_card); |
| 2027 | 2027 |
| 2028 // Since no refresh is expected, reload the data from the database to make | 2028 // Since no refresh is expected, reload the data from the database to make |
| 2029 // sure no changes were written out. | 2029 // sure no changes were written out. |
| 2030 ResetPersonalDataManager(); | 2030 ResetPersonalDataManager(); |
| 2031 | 2031 |
| 2032 // Expect that the saved credit card is not modified. | 2032 // Expect that the saved credit card is not modified. |
| 2033 const std::vector<CreditCard*>& results = personal_data_->credit_cards(); | 2033 const std::vector<CreditCard*>& results = personal_data_->GetCreditCards(); |
| 2034 ASSERT_EQ(1U, results.size()); | 2034 ASSERT_EQ(1U, results.size()); |
| 2035 EXPECT_EQ(0, credit_card.Compare(*results[0])); | 2035 EXPECT_EQ(0, credit_card.Compare(*results[0])); |
| 2036 } | 2036 } |
| 2037 | 2037 |
| 2038 TEST_F(PersonalDataManagerTest, GetNonEmptyTypes) { | 2038 TEST_F(PersonalDataManagerTest, GetNonEmptyTypes) { |
| 2039 // Check that there are no available types with no profiles stored. | 2039 // Check that there are no available types with no profiles stored. |
| 2040 FieldTypeSet non_empty_types; | 2040 FieldTypeSet non_empty_types; |
| 2041 personal_data_->GetNonEmptyTypes(&non_empty_types); | 2041 personal_data_->GetNonEmptyTypes(&non_empty_types); |
| 2042 EXPECT_EQ(0U, non_empty_types.size()); | 2042 EXPECT_EQ(0U, non_empty_types.size()); |
| 2043 | 2043 |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2244 expected.GetRawMultiInfo(PHONE_HOME_WHOLE_NUMBER, &values); | 2244 expected.GetRawMultiInfo(PHONE_HOME_WHOLE_NUMBER, &values); |
| 2245 values.push_back(ASCIIToUTF16("(214) 555-1234")); | 2245 values.push_back(ASCIIToUTF16("(214) 555-1234")); |
| 2246 expected.SetRawMultiInfo(PHONE_HOME_WHOLE_NUMBER, values); | 2246 expected.SetRawMultiInfo(PHONE_HOME_WHOLE_NUMBER, values); |
| 2247 | 2247 |
| 2248 ASSERT_EQ(1U, results2.size()); | 2248 ASSERT_EQ(1U, results2.size()); |
| 2249 EXPECT_EQ(0, expected.Compare(*results2[0])); | 2249 EXPECT_EQ(0, expected.Compare(*results2[0])); |
| 2250 } | 2250 } |
| 2251 | 2251 |
| 2252 TEST_F(PersonalDataManagerTest, IncognitoReadOnly) { | 2252 TEST_F(PersonalDataManagerTest, IncognitoReadOnly) { |
| 2253 ASSERT_TRUE(personal_data_->GetProfiles().empty()); | 2253 ASSERT_TRUE(personal_data_->GetProfiles().empty()); |
| 2254 ASSERT_TRUE(personal_data_->credit_cards().empty()); | 2254 ASSERT_TRUE(personal_data_->GetCreditCards().empty()); |
| 2255 | 2255 |
| 2256 AutofillProfile steve_jobs; | 2256 AutofillProfile steve_jobs; |
| 2257 test::SetProfileInfo(&steve_jobs, "Steven", "Paul", "Jobs", "sjobs@apple.com", | 2257 test::SetProfileInfo(&steve_jobs, "Steven", "Paul", "Jobs", "sjobs@apple.com", |
| 2258 "Apple Computer, Inc.", "1 Infinite Loop", "", "Cupertino", "CA", "95014", | 2258 "Apple Computer, Inc.", "1 Infinite Loop", "", "Cupertino", "CA", "95014", |
| 2259 "US", "(800) 275-2273"); | 2259 "US", "(800) 275-2273"); |
| 2260 personal_data_->AddProfile(steve_jobs); | 2260 personal_data_->AddProfile(steve_jobs); |
| 2261 | 2261 |
| 2262 CreditCard bill_gates; | 2262 CreditCard bill_gates; |
| 2263 test::SetCreditCardInfo( | 2263 test::SetCreditCardInfo( |
| 2264 &bill_gates, "William H. Gates", "5555555555554444", "1", "2020"); | 2264 &bill_gates, "William H. Gates", "5555555555554444", "1", "2020"); |
| 2265 personal_data_->AddCreditCard(bill_gates); | 2265 personal_data_->AddCreditCard(bill_gates); |
| 2266 | 2266 |
| 2267 ResetPersonalDataManager(); | 2267 ResetPersonalDataManager(); |
| 2268 ASSERT_EQ(1U, personal_data_->GetProfiles().size()); | 2268 ASSERT_EQ(1U, personal_data_->GetProfiles().size()); |
| 2269 ASSERT_EQ(1U, personal_data_->credit_cards().size()); | 2269 ASSERT_EQ(1U, personal_data_->GetCreditCards().size()); |
| 2270 | 2270 |
| 2271 // After this point no adds, saves, or updates should take effect. | 2271 // After this point no adds, saves, or updates should take effect. |
| 2272 MakeProfileIncognito(); | 2272 MakeProfileIncognito(); |
| 2273 EXPECT_CALL(personal_data_observer_, OnPersonalDataChanged()).Times(0); | 2273 EXPECT_CALL(personal_data_observer_, OnPersonalDataChanged()).Times(0); |
| 2274 | 2274 |
| 2275 // Add profiles or credit card shouldn't work. | 2275 // Add profiles or credit card shouldn't work. |
| 2276 personal_data_->AddProfile(test::GetFullProfile()); | 2276 personal_data_->AddProfile(test::GetFullProfile()); |
| 2277 | 2277 |
| 2278 CreditCard larry_page; | 2278 CreditCard larry_page; |
| 2279 test::SetCreditCardInfo( | 2279 test::SetCreditCardInfo( |
| 2280 &larry_page, "Lawrence Page", "4111111111111111", "10", "2025"); | 2280 &larry_page, "Lawrence Page", "4111111111111111", "10", "2025"); |
| 2281 personal_data_->AddCreditCard(larry_page); | 2281 personal_data_->AddCreditCard(larry_page); |
| 2282 | 2282 |
| 2283 ResetPersonalDataManager(); | 2283 ResetPersonalDataManager(); |
| 2284 EXPECT_EQ(1U, personal_data_->GetProfiles().size()); | 2284 EXPECT_EQ(1U, personal_data_->GetProfiles().size()); |
| 2285 EXPECT_EQ(1U, personal_data_->credit_cards().size()); | 2285 EXPECT_EQ(1U, personal_data_->GetCreditCards().size()); |
| 2286 | 2286 |
| 2287 // Saving or creating profiles from imported profiles shouldn't work. | 2287 // Saving or creating profiles from imported profiles shouldn't work. |
| 2288 steve_jobs.SetRawInfo(NAME_FIRST, ASCIIToUTF16("Steve")); | 2288 steve_jobs.SetRawInfo(NAME_FIRST, ASCIIToUTF16("Steve")); |
| 2289 personal_data_->SaveImportedProfile(steve_jobs); | 2289 personal_data_->SaveImportedProfile(steve_jobs); |
| 2290 | 2290 |
| 2291 bill_gates.SetRawInfo(CREDIT_CARD_NAME, ASCIIToUTF16("Bill Gates")); | 2291 bill_gates.SetRawInfo(CREDIT_CARD_NAME, ASCIIToUTF16("Bill Gates")); |
| 2292 personal_data_->SaveImportedCreditCard(bill_gates); | 2292 personal_data_->SaveImportedCreditCard(bill_gates); |
| 2293 | 2293 |
| 2294 ResetPersonalDataManager(); | 2294 ResetPersonalDataManager(); |
| 2295 EXPECT_EQ(ASCIIToUTF16("Steven"), | 2295 EXPECT_EQ(ASCIIToUTF16("Steven"), |
| 2296 personal_data_->GetProfiles()[0]->GetRawInfo(NAME_FIRST)); | 2296 personal_data_->GetProfiles()[0]->GetRawInfo(NAME_FIRST)); |
| 2297 EXPECT_EQ(ASCIIToUTF16("William H. Gates"), | 2297 EXPECT_EQ(ASCIIToUTF16("William H. Gates"), |
| 2298 personal_data_->credit_cards()[0]->GetRawInfo(CREDIT_CARD_NAME)); | 2298 personal_data_->GetCreditCards()[0]->GetRawInfo(CREDIT_CARD_NAME)); |
| 2299 | 2299 |
| 2300 // Updating existing profiles shouldn't work. | 2300 // Updating existing profiles shouldn't work. |
| 2301 steve_jobs.SetRawInfo(NAME_FIRST, ASCIIToUTF16("Steve")); | 2301 steve_jobs.SetRawInfo(NAME_FIRST, ASCIIToUTF16("Steve")); |
| 2302 personal_data_->UpdateProfile(steve_jobs); | 2302 personal_data_->UpdateProfile(steve_jobs); |
| 2303 | 2303 |
| 2304 bill_gates.SetRawInfo(CREDIT_CARD_NAME, ASCIIToUTF16("Bill Gates")); | 2304 bill_gates.SetRawInfo(CREDIT_CARD_NAME, ASCIIToUTF16("Bill Gates")); |
| 2305 personal_data_->UpdateCreditCard(bill_gates); | 2305 personal_data_->UpdateCreditCard(bill_gates); |
| 2306 | 2306 |
| 2307 ResetPersonalDataManager(); | 2307 ResetPersonalDataManager(); |
| 2308 EXPECT_EQ(ASCIIToUTF16("Steven"), | 2308 EXPECT_EQ(ASCIIToUTF16("Steven"), |
| 2309 personal_data_->GetProfiles()[0]->GetRawInfo(NAME_FIRST)); | 2309 personal_data_->GetProfiles()[0]->GetRawInfo(NAME_FIRST)); |
| 2310 EXPECT_EQ(ASCIIToUTF16("William H. Gates"), | 2310 EXPECT_EQ(ASCIIToUTF16("William H. Gates"), |
| 2311 personal_data_->credit_cards()[0]->GetRawInfo(CREDIT_CARD_NAME)); | 2311 personal_data_->GetCreditCards()[0]->GetRawInfo(CREDIT_CARD_NAME)); |
| 2312 | 2312 |
| 2313 // Removing shouldn't work. | 2313 // Removing shouldn't work. |
| 2314 personal_data_->RemoveByGUID(steve_jobs.guid()); | 2314 personal_data_->RemoveByGUID(steve_jobs.guid()); |
| 2315 personal_data_->RemoveByGUID(bill_gates.guid()); | 2315 personal_data_->RemoveByGUID(bill_gates.guid()); |
| 2316 | 2316 |
| 2317 ResetPersonalDataManager(); | 2317 ResetPersonalDataManager(); |
| 2318 EXPECT_EQ(1U, personal_data_->GetProfiles().size()); | 2318 EXPECT_EQ(1U, personal_data_->GetProfiles().size()); |
| 2319 EXPECT_EQ(1U, personal_data_->credit_cards().size()); | 2319 EXPECT_EQ(1U, personal_data_->GetCreditCards().size()); |
| 2320 } | 2320 } |
| 2321 | 2321 |
| 2322 } // namespace autofill | 2322 } // namespace autofill |
| OLD | NEW |