| 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/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 372 profile7.SetRawInfo(ADDRESS_HOME_ZIP, WideToUTF16(L"94086")); | 372 profile7.SetRawInfo(ADDRESS_HOME_ZIP, WideToUTF16(L"94086")); |
| 373 profile7.SetRawInfo(PHONE_HOME_WHOLE_NUMBER, WideToUTF16(L"15466784565")); | 373 profile7.SetRawInfo(PHONE_HOME_WHOLE_NUMBER, WideToUTF16(L"15466784565")); |
| 374 profile7.SetInfo( | 374 profile7.SetInfo( |
| 375 AutofillType(ADDRESS_HOME_COUNTRY), WideToUTF16(L"United States"), | 375 AutofillType(ADDRESS_HOME_COUNTRY), WideToUTF16(L"United States"), |
| 376 "en-US"); | 376 "en-US"); |
| 377 profiles.push_back(profile7); | 377 profiles.push_back(profile7); |
| 378 | 378 |
| 379 SetProfiles(&profiles); | 379 SetProfiles(&profiles); |
| 380 ASSERT_EQ(profiles.size(), personal_data_manager()->GetProfiles().size()); | 380 ASSERT_EQ(profiles.size(), personal_data_manager()->GetProfiles().size()); |
| 381 for (size_t i = 0; i < profiles.size(); ++i) | 381 for (size_t i = 0; i < profiles.size(); ++i) |
| 382 ASSERT_EQ(profiles[i], *personal_data_manager()->GetProfiles()[i]); | 382 EXPECT_EQ(profiles[i], *personal_data_manager()->GetProfiles()[i]); |
| 383 | 383 |
| 384 std::vector<CreditCard> cards; | 384 std::vector<CreditCard> cards; |
| 385 CreditCard card1; | 385 CreditCard card1; |
| 386 card1.SetRawInfo(CREDIT_CARD_NAME, | 386 card1.SetRawInfo(CREDIT_CARD_NAME, |
| 387 WideToUTF16(L"\u751f\u6d3b\u5f88\u6709\u89c4\u5f8b " | 387 WideToUTF16(L"\u751f\u6d3b\u5f88\u6709\u89c4\u5f8b " |
| 388 L"\u4ee5\u73a9\u4e3a\u4e3b")); | 388 L"\u4ee5\u73a9\u4e3a\u4e3b")); |
| 389 card1.SetRawInfo(CREDIT_CARD_NUMBER, WideToUTF16(L"6011111111111117")); | 389 card1.SetRawInfo(CREDIT_CARD_NUMBER, WideToUTF16(L"6011111111111117")); |
| 390 card1.SetRawInfo(CREDIT_CARD_EXP_MONTH, WideToUTF16(L"12")); | 390 card1.SetRawInfo(CREDIT_CARD_EXP_MONTH, WideToUTF16(L"12")); |
| 391 card1.SetRawInfo(CREDIT_CARD_EXP_4_DIGIT_YEAR, WideToUTF16(L"2011")); | 391 card1.SetRawInfo(CREDIT_CARD_EXP_4_DIGIT_YEAR, WideToUTF16(L"2011")); |
| 392 cards.push_back(card1); | 392 cards.push_back(card1); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 423 L"\u03ba\u03b1\u03c4\u03b1\u03c1\u03b3\u03ae" | 423 L"\u03ba\u03b1\u03c4\u03b1\u03c1\u03b3\u03ae" |
| 424 L"\u03c3\u03b5\u03b9\u03c2")); | 424 L"\u03c3\u03b5\u03b9\u03c2")); |
| 425 card4.SetRawInfo(CREDIT_CARD_NUMBER, WideToUTF16(L"00000000000000000000000")); | 425 card4.SetRawInfo(CREDIT_CARD_NUMBER, WideToUTF16(L"00000000000000000000000")); |
| 426 card4.SetRawInfo(CREDIT_CARD_EXP_MONTH, WideToUTF16(L"01")); | 426 card4.SetRawInfo(CREDIT_CARD_EXP_MONTH, WideToUTF16(L"01")); |
| 427 card4.SetRawInfo(CREDIT_CARD_EXP_4_DIGIT_YEAR, WideToUTF16(L"2016")); | 427 card4.SetRawInfo(CREDIT_CARD_EXP_4_DIGIT_YEAR, WideToUTF16(L"2016")); |
| 428 cards.push_back(card4); | 428 cards.push_back(card4); |
| 429 | 429 |
| 430 SetCards(&cards); | 430 SetCards(&cards); |
| 431 ASSERT_EQ(cards.size(), personal_data_manager()->GetCreditCards().size()); | 431 ASSERT_EQ(cards.size(), personal_data_manager()->GetCreditCards().size()); |
| 432 for (size_t i = 0; i < cards.size(); ++i) | 432 for (size_t i = 0; i < cards.size(); ++i) |
| 433 ASSERT_EQ(cards[i], *personal_data_manager()->GetCreditCards()[i]); | 433 EXPECT_EQ(cards[i], *personal_data_manager()->GetCreditCards()[i]); |
| 434 } | 434 } |
| 435 | 435 |
| 436 // Test filling in invalid values for profiles are saved as-is. Phone | 436 // Test filling in invalid values for profiles are saved as-is. Phone |
| 437 // information entered into the prefs UI is not validated or rejected except for | 437 // information entered into the prefs UI is not validated or rejected except for |
| 438 // duplicates. | 438 // duplicates. |
| 439 // TODO(isherman): rewrite as WebUI test? | 439 // TODO(isherman): rewrite as WebUI test? |
| 440 IN_PROC_BROWSER_TEST_F(AutofillTest, Invalid) { | 440 IN_PROC_BROWSER_TEST_F(AutofillTest, Invalid) { |
| 441 // First try profiles with invalid ZIP input. | 441 // First try profiles with invalid ZIP input. |
| 442 AutofillProfile without_invalid; | 442 AutofillProfile without_invalid; |
| 443 without_invalid.SetRawInfo(NAME_FIRST, ASCIIToUTF16("Will")); | 443 without_invalid.SetRawInfo(NAME_FIRST, ASCIIToUTF16("Will")); |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 725 IN_PROC_BROWSER_TEST_F(AutofillTest, | 725 IN_PROC_BROWSER_TEST_F(AutofillTest, |
| 726 DISABLED_MergeAggregatedDuplicatedProfiles) { | 726 DISABLED_MergeAggregatedDuplicatedProfiles) { |
| 727 int num_of_profiles = | 727 int num_of_profiles = |
| 728 AggregateProfilesIntoAutofillPrefs("dataset_duplicated_profiles.txt"); | 728 AggregateProfilesIntoAutofillPrefs("dataset_duplicated_profiles.txt"); |
| 729 | 729 |
| 730 ASSERT_GT(num_of_profiles, | 730 ASSERT_GT(num_of_profiles, |
| 731 static_cast<int>(personal_data_manager()->GetProfiles().size())); | 731 static_cast<int>(personal_data_manager()->GetProfiles().size())); |
| 732 } | 732 } |
| 733 | 733 |
| 734 } // namespace autofill | 734 } // namespace autofill |
| OLD | NEW |