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 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
492 // Disable this test in Metro+Ash for now (http://crbug.com/262796). | 492 // Disable this test in Metro+Ash for now (http://crbug.com/262796). |
493 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) | 493 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) |
494 return; | 494 return; |
495 #endif | 495 #endif |
496 | 496 |
497 ASSERT_TRUE(test_server()->Start()); | 497 ASSERT_TRUE(test_server()->Start()); |
498 SubmitCreditCard("Bob Smith", "4408 0412 3456 7893", "12", "2014"); | 498 SubmitCreditCard("Bob Smith", "4408 0412 3456 7893", "12", "2014"); |
499 SubmitCreditCard("Jane Doe", "4417-1234-5678-9113", "10", "2013"); | 499 SubmitCreditCard("Jane Doe", "4417-1234-5678-9113", "10", "2013"); |
500 | 500 |
501 ASSERT_EQ(2u, personal_data_manager()->GetCreditCards().size()); | 501 ASSERT_EQ(2u, personal_data_manager()->GetCreditCards().size()); |
502 string16 cc1 = personal_data_manager()->GetCreditCards()[0]->GetRawInfo( | 502 base::string16 cc1 = personal_data_manager()->GetCreditCards()[0]->GetRawInfo( |
503 CREDIT_CARD_NUMBER); | 503 CREDIT_CARD_NUMBER); |
504 ASSERT_TRUE(autofill::IsValidCreditCardNumber(cc1)); | 504 ASSERT_TRUE(autofill::IsValidCreditCardNumber(cc1)); |
505 string16 cc2 = personal_data_manager()->GetCreditCards()[1]->GetRawInfo( | 505 base::string16 cc2 = personal_data_manager()->GetCreditCards()[1]->GetRawInfo( |
506 CREDIT_CARD_NUMBER); | 506 CREDIT_CARD_NUMBER); |
507 ASSERT_TRUE(autofill::IsValidCreditCardNumber(cc2)); | 507 ASSERT_TRUE(autofill::IsValidCreditCardNumber(cc2)); |
508 } | 508 } |
509 | 509 |
510 // Test that Autofill aggregates a minimum valid profile. | 510 // Test that Autofill aggregates a minimum valid profile. |
511 // The minimum required address fields must be specified: First Name, Last Name, | 511 // The minimum required address fields must be specified: First Name, Last Name, |
512 // Address Line 1, City, Zip Code, and State. | 512 // Address Line 1, City, Zip Code, and State. |
513 IN_PROC_BROWSER_TEST_F(AutofillTest, AggregatesMinValidProfile) { | 513 IN_PROC_BROWSER_TEST_F(AutofillTest, AggregatesMinValidProfile) { |
514 ASSERT_TRUE(test_server()->Start()); | 514 ASSERT_TRUE(test_server()->Start()); |
515 FormMap data; | 515 FormMap data; |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
633 data["NAME_LAST"] = "Smith"; | 633 data["NAME_LAST"] = "Smith"; |
634 data["ADDRESS_HOME_LINE1"] = "1234 H St."; | 634 data["ADDRESS_HOME_LINE1"] = "1234 H St."; |
635 data["ADDRESS_HOME_CITY"] = "San Jose"; | 635 data["ADDRESS_HOME_CITY"] = "San Jose"; |
636 data["ADDRESS_HOME_STATE"] = "CA"; | 636 data["ADDRESS_HOME_STATE"] = "CA"; |
637 data["ADDRESS_HOME_ZIP"] = "95110"; | 637 data["ADDRESS_HOME_ZIP"] = "95110"; |
638 data["ADDRESS_HOME_COUNTRY"] = "Germany"; | 638 data["ADDRESS_HOME_COUNTRY"] = "Germany"; |
639 data["PHONE_HOME_WHOLE_NUMBER"] = "(08) 450 777-777"; | 639 data["PHONE_HOME_WHOLE_NUMBER"] = "(08) 450 777-777"; |
640 FillFormAndSubmit("autofill_test_form.html", data); | 640 FillFormAndSubmit("autofill_test_form.html", data); |
641 | 641 |
642 ASSERT_EQ(1u, personal_data_manager()->GetProfiles().size()); | 642 ASSERT_EQ(1u, personal_data_manager()->GetProfiles().size()); |
643 string16 phone = personal_data_manager()->GetProfiles()[0]->GetRawInfo( | 643 base::string16 phone = personal_data_manager()->GetProfiles()[0]->GetRawInfo( |
644 PHONE_HOME_WHOLE_NUMBER); | 644 PHONE_HOME_WHOLE_NUMBER); |
645 ASSERT_TRUE(StartsWith(phone, ASCIIToUTF16("+49"), true)); | 645 ASSERT_TRUE(StartsWith(phone, ASCIIToUTF16("+49"), true)); |
646 } | 646 } |
647 | 647 |
648 // Test CC info not offered to be saved when autocomplete=off for CC field. | 648 // Test CC info not offered to be saved when autocomplete=off for CC field. |
649 // If the credit card number field has autocomplete turned off, then the credit | 649 // If the credit card number field has autocomplete turned off, then the credit |
650 // card infobar should not offer to save the credit card info. The credit card | 650 // card infobar should not offer to save the credit card info. The credit card |
651 // number must be a valid Luhn number. | 651 // number must be a valid Luhn number. |
652 IN_PROC_BROWSER_TEST_F(AutofillTest, CCInfoNotStoredWhenAutocompleteOff) { | 652 IN_PROC_BROWSER_TEST_F(AutofillTest, CCInfoNotStoredWhenAutocompleteOff) { |
653 #if defined(OS_WIN) && defined(USE_ASH) | 653 #if defined(OS_WIN) && defined(USE_ASH) |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
719 IN_PROC_BROWSER_TEST_F(AutofillTest, | 719 IN_PROC_BROWSER_TEST_F(AutofillTest, |
720 DISABLED_MergeAggregatedDuplicatedProfiles) { | 720 DISABLED_MergeAggregatedDuplicatedProfiles) { |
721 int num_of_profiles = | 721 int num_of_profiles = |
722 AggregateProfilesIntoAutofillPrefs("dataset_duplicated_profiles.txt"); | 722 AggregateProfilesIntoAutofillPrefs("dataset_duplicated_profiles.txt"); |
723 | 723 |
724 ASSERT_GT(num_of_profiles, | 724 ASSERT_GT(num_of_profiles, |
725 static_cast<int>(personal_data_manager()->GetProfiles().size())); | 725 static_cast<int>(personal_data_manager()->GetProfiles().size())); |
726 } | 726 } |
727 | 727 |
728 } // namespace autofill | 728 } // namespace autofill |
OLD | NEW |