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 641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
652 EXPECT_EQ(ASCIIToUTF16("+49 8450 777777"), | 652 EXPECT_EQ(ASCIIToUTF16("+49 8450 777777"), |
653 personal_data_manager()->GetProfiles()[0]->GetRawInfo( | 653 personal_data_manager()->GetProfiles()[0]->GetRawInfo( |
654 PHONE_HOME_WHOLE_NUMBER)); | 654 PHONE_HOME_WHOLE_NUMBER)); |
655 | 655 |
656 FillFormAndSubmit("autofill_test_form.html", data); | 656 FillFormAndSubmit("autofill_test_form.html", data); |
657 EXPECT_EQ(ASCIIToUTF16("08450 777777"), | 657 EXPECT_EQ(ASCIIToUTF16("08450 777777"), |
658 personal_data_manager()->GetProfiles()[1]->GetRawInfo( | 658 personal_data_manager()->GetProfiles()[1]->GetRawInfo( |
659 PHONE_HOME_WHOLE_NUMBER)); | 659 PHONE_HOME_WHOLE_NUMBER)); |
660 } | 660 } |
661 | 661 |
| 662 // Test that Autofill uses '+' sign for international numbers. |
| 663 // This applies to the following cases: |
| 664 // The phone number has a leading '+'. |
| 665 // The phone number does not have a leading '+'. |
| 666 // The phone number has a leading international direct dialing (IDD) code. |
| 667 // This does not apply to US numbers. For US numbers, '+' is removed. |
| 668 IN_PROC_BROWSER_TEST_F(AutofillTest, UsePlusSignForInternaltionalNumber) { |
| 669 ASSERT_TRUE(test_server()->Start()); |
| 670 std::vector<FormMap> profiles; |
| 671 |
| 672 FormMap data1; |
| 673 data1["NAME_FIRST"] = "Bonnie"; |
| 674 data1["NAME_LAST"] = "Smith"; |
| 675 data1["ADDRESS_HOME_LINE1"] = "6723 Roadway Rd"; |
| 676 data1["ADDRESS_HOME_CITY"] = "Reading"; |
| 677 data1["ADDRESS_HOME_STATE"] = "Berkshire"; |
| 678 data1["ADDRESS_HOME_ZIP"] = "RG12 3BR"; |
| 679 data1["ADDRESS_HOME_COUNTRY"] = "United Kingdom"; |
| 680 data1["PHONE_HOME_WHOLE_NUMBER"] = "+44 7624-123456"; |
| 681 profiles.push_back(data1); |
| 682 |
| 683 FormMap data2; |
| 684 data2["NAME_FIRST"] = "John"; |
| 685 data2["NAME_LAST"] = "Doe"; |
| 686 data2["ADDRESS_HOME_LINE1"] = "987 H St"; |
| 687 data2["ADDRESS_HOME_CITY"] = "Reading"; |
| 688 data2["ADDRESS_HOME_STATE"] = "BerkShire"; |
| 689 data2["ADDRESS_HOME_ZIP"] = "RG12 3BR"; |
| 690 data2["ADDRESS_HOME_COUNTRY"] = "United Kingdom"; |
| 691 data2["PHONE_HOME_WHOLE_NUMBER"] = "44 7624 123456"; |
| 692 profiles.push_back(data2); |
| 693 |
| 694 FormMap data3; |
| 695 data3["NAME_FIRST"] = "Jane"; |
| 696 data3["NAME_LAST"] = "Doe"; |
| 697 data3["ADDRESS_HOME_LINE1"] = "1523 Garcia St"; |
| 698 data3["ADDRESS_HOME_CITY"] = "Reading"; |
| 699 data3["ADDRESS_HOME_STATE"] = "BerkShire"; |
| 700 data3["ADDRESS_HOME_ZIP"] = "RG12 3BR"; |
| 701 data3["ADDRESS_HOME_COUNTRY"] = "United Kingdom"; |
| 702 data3["PHONE_HOME_WHOLE_NUMBER"] = "0044 7624 123456"; |
| 703 profiles.push_back(data3); |
| 704 |
| 705 FormMap data4; |
| 706 data4["NAME_FIRST"] = "Bob"; |
| 707 data4["NAME_LAST"] = "Smith"; |
| 708 data4["ADDRESS_HOME_LINE1"] = "123 Cherry Ave"; |
| 709 data4["ADDRESS_HOME_CITY"] = "Mountain View"; |
| 710 data4["ADDRESS_HOME_STATE"] = "CA"; |
| 711 data4["ADDRESS_HOME_ZIP"] = "94043"; |
| 712 data4["ADDRESS_HOME_COUNTRY"] = "United States"; |
| 713 data4["PHONE_HOME_WHOLE_NUMBER"] = "+1 (408) 871-4567"; |
| 714 profiles.push_back(data4); |
| 715 |
| 716 for (size_t i = 0; i < profiles.size(); ++i) |
| 717 FillFormAndSubmit("autofill_test_form.html", profiles[i]); |
| 718 |
| 719 ASSERT_EQ(4u, personal_data_manager()->GetProfiles().size()); |
| 720 ASSERT_EQ(ASCIIToUTF16("+447624123456"), |
| 721 personal_data_manager()->GetProfiles()[0]->GetInfo( |
| 722 AutofillType(PHONE_HOME_WHOLE_NUMBER), "")); |
| 723 ASSERT_EQ(ASCIIToUTF16("+447624123456"), |
| 724 personal_data_manager()->GetProfiles()[1]->GetInfo( |
| 725 AutofillType(PHONE_HOME_WHOLE_NUMBER), "")); |
| 726 ASSERT_EQ(ASCIIToUTF16("+447624123456"), |
| 727 personal_data_manager()->GetProfiles()[2]->GetInfo( |
| 728 AutofillType(PHONE_HOME_WHOLE_NUMBER), "")); |
| 729 ASSERT_EQ(ASCIIToUTF16("14088714567"), |
| 730 personal_data_manager()->GetProfiles()[3]->GetInfo( |
| 731 AutofillType(PHONE_HOME_WHOLE_NUMBER), "")); |
| 732 } |
| 733 |
662 // Test CC info not offered to be saved when autocomplete=off for CC field. | 734 // Test CC info not offered to be saved when autocomplete=off for CC field. |
663 // If the credit card number field has autocomplete turned off, then the credit | 735 // If the credit card number field has autocomplete turned off, then the credit |
664 // card infobar should not offer to save the credit card info. The credit card | 736 // card infobar should not offer to save the credit card info. The credit card |
665 // number must be a valid Luhn number. | 737 // number must be a valid Luhn number. |
666 IN_PROC_BROWSER_TEST_F(AutofillTest, CCInfoNotStoredWhenAutocompleteOff) { | 738 IN_PROC_BROWSER_TEST_F(AutofillTest, CCInfoNotStoredWhenAutocompleteOff) { |
667 #if defined(OS_WIN) && defined(USE_ASH) | 739 #if defined(OS_WIN) && defined(USE_ASH) |
668 // Disable this test in Metro+Ash for now (http://crbug.com/262796). | 740 // Disable this test in Metro+Ash for now (http://crbug.com/262796). |
669 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) | 741 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) |
670 return; | 742 return; |
671 #endif | 743 #endif |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
732 IN_PROC_BROWSER_TEST_F(AutofillTest, | 804 IN_PROC_BROWSER_TEST_F(AutofillTest, |
733 DISABLED_MergeAggregatedDuplicatedProfiles) { | 805 DISABLED_MergeAggregatedDuplicatedProfiles) { |
734 int num_of_profiles = | 806 int num_of_profiles = |
735 AggregateProfilesIntoAutofillPrefs("dataset_duplicated_profiles.txt"); | 807 AggregateProfilesIntoAutofillPrefs("dataset_duplicated_profiles.txt"); |
736 | 808 |
737 ASSERT_GT(num_of_profiles, | 809 ASSERT_GT(num_of_profiles, |
738 static_cast<int>(personal_data_manager()->GetProfiles().size())); | 810 static_cast<int>(personal_data_manager()->GetProfiles().size())); |
739 } | 811 } |
740 | 812 |
741 } // namespace autofill | 813 } // namespace autofill |
OLD | NEW |