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 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
622 | 622 |
623 ASSERT_EQ(2u, personal_data_manager()->GetProfiles().size()); | 623 ASSERT_EQ(2u, personal_data_manager()->GetProfiles().size()); |
624 ASSERT_EQ(ASCIIToUTF16("(408) 871-4567"), | 624 ASSERT_EQ(ASCIIToUTF16("(408) 871-4567"), |
625 personal_data_manager()->GetProfiles()[0]->GetRawInfo( | 625 personal_data_manager()->GetProfiles()[0]->GetRawInfo( |
626 PHONE_HOME_WHOLE_NUMBER)); | 626 PHONE_HOME_WHOLE_NUMBER)); |
627 ASSERT_EQ(ASCIIToUTF16("+49 40 808179000"), | 627 ASSERT_EQ(ASCIIToUTF16("+49 40 808179000"), |
628 personal_data_manager()->GetProfiles()[1]->GetRawInfo( | 628 personal_data_manager()->GetProfiles()[1]->GetRawInfo( |
629 PHONE_HOME_WHOLE_NUMBER)); | 629 PHONE_HOME_WHOLE_NUMBER)); |
630 } | 630 } |
631 | 631 |
632 // Test Autofill appends country codes to aggregated phone numbers. | 632 // Test Autofill does not appends country when the phone number contains the |
Ilya Sherman
2014/07/02 22:23:54
nit: "appends country" -> "append a country code"
| |
633 // The country code is added for the following case: | 633 // correct national number size and is a valid format. |
634 // The phone number contains the correct national number size and | 634 IN_PROC_BROWSER_TEST_F(AutofillTest, KeepValidNationalNumber) { |
635 // is a valid format. | |
636 IN_PROC_BROWSER_TEST_F(AutofillTest, AppendCountryCodeForAggregatedPhones) { | |
637 ASSERT_TRUE(test_server()->Start()); | 635 ASSERT_TRUE(test_server()->Start()); |
638 FormMap data; | 636 FormMap data; |
639 data["NAME_FIRST"] = "Bob"; | 637 data["NAME_FIRST"] = "Bob"; |
640 data["NAME_LAST"] = "Smith"; | 638 data["NAME_LAST"] = "Smith"; |
641 data["ADDRESS_HOME_LINE1"] = "1234 H St."; | 639 data["ADDRESS_HOME_LINE1"] = "1234 H St."; |
642 data["ADDRESS_HOME_CITY"] = "San Jose"; | 640 data["ADDRESS_HOME_CITY"] = "San Jose"; |
643 data["ADDRESS_HOME_STATE"] = "CA"; | 641 data["ADDRESS_HOME_STATE"] = "CA"; |
644 data["ADDRESS_HOME_ZIP"] = "95110"; | 642 data["ADDRESS_HOME_ZIP"] = "95110"; |
645 data["ADDRESS_HOME_COUNTRY"] = "Germany"; | 643 data["ADDRESS_HOME_COUNTRY"] = "Germany"; |
646 data["PHONE_HOME_WHOLE_NUMBER"] = "(08) 450 777-777"; | 644 data["PHONE_HOME_WHOLE_NUMBER"] = "(08) 450 777-777"; |
647 FillFormAndSubmit("autofill_test_form.html", data); | 645 FillFormAndSubmit("autofill_test_form.html", data); |
648 | 646 |
649 ASSERT_EQ(1u, personal_data_manager()->GetProfiles().size()); | 647 ASSERT_EQ(1u, personal_data_manager()->GetProfiles().size()); |
650 base::string16 phone = personal_data_manager()->GetProfiles()[0]->GetRawInfo( | 648 base::string16 phone = personal_data_manager()->GetProfiles()[0]->GetRawInfo( |
651 PHONE_HOME_WHOLE_NUMBER); | 649 PHONE_HOME_WHOLE_NUMBER); |
652 ASSERT_TRUE(StartsWith(phone, ASCIIToUTF16("+49"), true)); | 650 ASSERT_EQ(ASCIIToUTF16("08450 777777"), phone); |
651 } | |
652 | |
653 // Test Autofill uses '+' sign for international numbers. | |
Ilya Sherman
2014/07/02 22:23:54
nit: "Test Autofill" -> "Test that Autofill"
| |
654 // This applies to the following cases: | |
655 // The phone number with a leading '+'. | |
Ilya Sherman
2014/07/02 22:23:54
nit: "The phone number with" -> "The phone number
| |
656 // The phone number without a leading '+'. | |
657 // The phone number with a leading IDD. | |
Ilya Sherman
2014/07/02 22:23:54
I'm not sure what "IDD" stands for. Could you ple
| |
658 // This does not apply to US numbers. For US numbers, '+' is removed. | |
659 IN_PROC_BROWSER_TEST_F(AutofillTest, UsePlusSignForInternaltionalNumber) { | |
660 ASSERT_TRUE(test_server()->Start()); | |
661 std::vector<FormMap> profiles; | |
662 | |
663 FormMap data1; | |
664 data1["NAME_FIRST"] = "Bonnie"; | |
665 data1["NAME_LAST"] = "Smith"; | |
666 data1["ADDRESS_HOME_LINE1"] = "6723 Roadway Rd"; | |
667 data1["ADDRESS_HOME_CITY"] = "Reading"; | |
668 data1["ADDRESS_HOME_STATE"] = "Berkshire"; | |
669 data1["ADDRESS_HOME_ZIP"] = "RG12 3BR"; | |
670 data1["ADDRESS_HOME_COUNTRY"] = "United Kingdom"; | |
671 data1["PHONE_HOME_WHOLE_NUMBER"] = "+44 7624-123456"; | |
672 profiles.push_back(data1); | |
673 | |
674 FormMap data2; | |
675 data2["NAME_FIRST"] = "John"; | |
676 data2["NAME_LAST"] = "Doe"; | |
677 data2["ADDRESS_HOME_LINE1"] = "987 H St"; | |
678 data2["ADDRESS_HOME_CITY"] = "Reading"; | |
679 data2["ADDRESS_HOME_STATE"] = "BerkShire"; | |
680 data2["ADDRESS_HOME_ZIP"] = "RG12 3BR"; | |
681 data2["ADDRESS_HOME_COUNTRY"] = "United Kingdom"; | |
682 data2["PHONE_HOME_WHOLE_NUMBER"] = "44 7624 123456"; | |
683 profiles.push_back(data2); | |
684 | |
685 FormMap data3; | |
686 data3["NAME_FIRST"] = "Jane"; | |
687 data3["NAME_LAST"] = "Doe"; | |
688 data3["ADDRESS_HOME_LINE1"] = "1523 Garcia St"; | |
689 data3["ADDRESS_HOME_CITY"] = "Reading"; | |
690 data3["ADDRESS_HOME_STATE"] = "BerkShire"; | |
691 data3["ADDRESS_HOME_ZIP"] = "RG12 3BR"; | |
692 data3["ADDRESS_HOME_COUNTRY"] = "United Kingdom"; | |
693 data3["PHONE_HOME_WHOLE_NUMBER"] = "0044 7624 123456"; | |
694 profiles.push_back(data3); | |
695 | |
696 FormMap data4; | |
697 data4["NAME_FIRST"] = "Bob"; | |
698 data4["NAME_LAST"] = "Smith"; | |
699 data4["ADDRESS_HOME_LINE1"] = "123 Cherry Ave"; | |
700 data4["ADDRESS_HOME_CITY"] = "Mountain View"; | |
701 data4["ADDRESS_HOME_STATE"] = "CA"; | |
702 data4["ADDRESS_HOME_ZIP"] = "94043"; | |
703 data4["ADDRESS_HOME_COUNTRY"] = "United States"; | |
704 data4["PHONE_HOME_WHOLE_NUMBER"] = "+1 (408) 871-4567"; | |
705 profiles.push_back(data4); | |
706 | |
707 for (size_t i = 0; i < profiles.size(); ++i) | |
708 FillFormAndSubmit("autofill_test_form.html", profiles[i]); | |
709 | |
710 ASSERT_EQ(4u, personal_data_manager()->GetProfiles().size()); | |
711 ASSERT_EQ(ASCIIToUTF16("+447624123456"), | |
712 personal_data_manager()->GetProfiles()[0]->GetInfo( | |
713 AutofillType(PHONE_HOME_WHOLE_NUMBER), "")); | |
714 ASSERT_EQ(ASCIIToUTF16("+447624123456"), | |
715 personal_data_manager()->GetProfiles()[1]->GetInfo( | |
716 AutofillType(PHONE_HOME_WHOLE_NUMBER), "")); | |
717 ASSERT_EQ(ASCIIToUTF16("+447624123456"), | |
718 personal_data_manager()->GetProfiles()[2]->GetInfo( | |
719 AutofillType(PHONE_HOME_WHOLE_NUMBER), "")); | |
720 ASSERT_EQ(ASCIIToUTF16("14088714567"), | |
721 personal_data_manager()->GetProfiles()[3]->GetInfo( | |
722 AutofillType(PHONE_HOME_WHOLE_NUMBER), "")); | |
653 } | 723 } |
654 | 724 |
655 // Test CC info not offered to be saved when autocomplete=off for CC field. | 725 // Test CC info not offered to be saved when autocomplete=off for CC field. |
656 // If the credit card number field has autocomplete turned off, then the credit | 726 // If the credit card number field has autocomplete turned off, then the credit |
657 // card infobar should not offer to save the credit card info. The credit card | 727 // card infobar should not offer to save the credit card info. The credit card |
658 // number must be a valid Luhn number. | 728 // number must be a valid Luhn number. |
659 IN_PROC_BROWSER_TEST_F(AutofillTest, CCInfoNotStoredWhenAutocompleteOff) { | 729 IN_PROC_BROWSER_TEST_F(AutofillTest, CCInfoNotStoredWhenAutocompleteOff) { |
660 #if defined(OS_WIN) && defined(USE_ASH) | 730 #if defined(OS_WIN) && defined(USE_ASH) |
661 // Disable this test in Metro+Ash for now (http://crbug.com/262796). | 731 // Disable this test in Metro+Ash for now (http://crbug.com/262796). |
662 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) | 732 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
725 IN_PROC_BROWSER_TEST_F(AutofillTest, | 795 IN_PROC_BROWSER_TEST_F(AutofillTest, |
726 DISABLED_MergeAggregatedDuplicatedProfiles) { | 796 DISABLED_MergeAggregatedDuplicatedProfiles) { |
727 int num_of_profiles = | 797 int num_of_profiles = |
728 AggregateProfilesIntoAutofillPrefs("dataset_duplicated_profiles.txt"); | 798 AggregateProfilesIntoAutofillPrefs("dataset_duplicated_profiles.txt"); |
729 | 799 |
730 ASSERT_GT(num_of_profiles, | 800 ASSERT_GT(num_of_profiles, |
731 static_cast<int>(personal_data_manager()->GetProfiles().size())); | 801 static_cast<int>(personal_data_manager()->GetProfiles().size())); |
732 } | 802 } |
733 | 803 |
734 } // namespace autofill | 804 } // namespace autofill |
OLD | NEW |