summaryrefslogtreecommitdiffstats
path: root/chrome/browser/autofill
diff options
context:
space:
mode:
authorisherman@chromium.org <isherman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-05 01:30:28 +0000
committerisherman@chromium.org <isherman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-05 01:30:28 +0000
commit91b073dd6145b74b191ee8dff524762d51a8c4e1 (patch)
treeb63a0234beb44bb6dcf4a1c2fdbe39739746d05e /chrome/browser/autofill
parente039ea2ab2116e179e6183d6ed8059875093fced (diff)
downloadchromium_src-91b073dd6145b74b191ee8dff524762d51a8c4e1.zip
chromium_src-91b073dd6145b74b191ee8dff524762d51a8c4e1.tar.gz
chromium_src-91b073dd6145b74b191ee8dff524762d51a8c4e1.tar.bz2
[Autofill] Update unit tests to use country codes when setting raw address info.
BUG=100845 Review URL: https://chromiumcodereview.appspot.com/11635039 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@175254 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/autofill')
-rw-r--r--chrome/browser/autofill/address_unittest.cc26
-rw-r--r--chrome/browser/autofill/autofill_browsertest.cc11
-rw-r--r--chrome/browser/autofill/autofill_manager_unittest.cc9
-rw-r--r--chrome/browser/autofill/autofill_metrics_unittest.cc4
-rw-r--r--chrome/browser/autofill/autofill_profile_unittest.cc2
-rw-r--r--chrome/browser/autofill/personal_data_manager_unittest.cc6
6 files changed, 29 insertions, 29 deletions
diff --git a/chrome/browser/autofill/address_unittest.cc b/chrome/browser/autofill/address_unittest.cc
index 9dcda2a..f3be2fc 100644
--- a/chrome/browser/autofill/address_unittest.cc
+++ b/chrome/browser/autofill/address_unittest.cc
@@ -45,15 +45,15 @@ TEST_F(AddressTest, GetCountry) {
EXPECT_EQ(std::string(), address.country_code());
// Make sure that nothing breaks when the country code is missing.
- string16 country = address.GetRawInfo(ADDRESS_HOME_COUNTRY);
+ string16 country = address.GetInfo(ADDRESS_HOME_COUNTRY, "en-US");
EXPECT_EQ(string16(), country);
address.set_country_code("US");
- country = address.GetRawInfo(ADDRESS_HOME_COUNTRY);
+ country = address.GetInfo(ADDRESS_HOME_COUNTRY, "en-US");
EXPECT_EQ(ASCIIToUTF16("United States"), country);
address.set_country_code("CA");
- country = address.GetRawInfo(ADDRESS_HOME_COUNTRY);
+ country = address.GetInfo(ADDRESS_HOME_COUNTRY, "en-US");
EXPECT_EQ(ASCIIToUTF16("Canada"), country);
}
@@ -63,32 +63,32 @@ TEST_F(AddressTest, SetCountry) {
EXPECT_EQ(std::string(), address.country_code());
// Test basic conversion.
- address.SetRawInfo(ADDRESS_HOME_COUNTRY, ASCIIToUTF16("United States"));
- string16 country = address.GetRawInfo(ADDRESS_HOME_COUNTRY);
+ address.SetInfo(ADDRESS_HOME_COUNTRY, ASCIIToUTF16("United States"), "en-US");
+ string16 country = address.GetInfo(ADDRESS_HOME_COUNTRY, "en-US");
EXPECT_EQ("US", address.country_code());
EXPECT_EQ(ASCIIToUTF16("United States"), country);
// Test basic synonym detection.
- address.SetRawInfo(ADDRESS_HOME_COUNTRY, ASCIIToUTF16("USA"));
- country = address.GetRawInfo(ADDRESS_HOME_COUNTRY);
+ address.SetInfo(ADDRESS_HOME_COUNTRY, ASCIIToUTF16("USA"), "en-US");
+ country = address.GetInfo(ADDRESS_HOME_COUNTRY, "en-US");
EXPECT_EQ("US", address.country_code());
EXPECT_EQ(ASCIIToUTF16("United States"), country);
// Test case-insensitivity.
- address.SetRawInfo(ADDRESS_HOME_COUNTRY, ASCIIToUTF16("canADA"));
- country = address.GetRawInfo(ADDRESS_HOME_COUNTRY);
+ address.SetInfo(ADDRESS_HOME_COUNTRY, ASCIIToUTF16("canADA"), "en-US");
+ country = address.GetInfo(ADDRESS_HOME_COUNTRY, "en-US");
EXPECT_EQ("CA", address.country_code());
EXPECT_EQ(ASCIIToUTF16("Canada"), country);
// Test country code detection.
- address.SetRawInfo(ADDRESS_HOME_COUNTRY, ASCIIToUTF16("JP"));
- country = address.GetRawInfo(ADDRESS_HOME_COUNTRY);
+ address.SetInfo(ADDRESS_HOME_COUNTRY, ASCIIToUTF16("JP"), "en-US");
+ country = address.GetInfo(ADDRESS_HOME_COUNTRY, "en-US");
EXPECT_EQ("JP", address.country_code());
EXPECT_EQ(ASCIIToUTF16("Japan"), country);
// Test that we ignore unknown countries.
- address.SetRawInfo(ADDRESS_HOME_COUNTRY, ASCIIToUTF16("Unknown"));
- country = address.GetRawInfo(ADDRESS_HOME_COUNTRY);
+ address.SetInfo(ADDRESS_HOME_COUNTRY, ASCIIToUTF16("Unknown"), "en-US");
+ country = address.GetInfo(ADDRESS_HOME_COUNTRY, "en-US");
EXPECT_EQ(std::string(), address.country_code());
EXPECT_EQ(string16(), country);
}
diff --git a/chrome/browser/autofill/autofill_browsertest.cc b/chrome/browser/autofill/autofill_browsertest.cc
index 0c045d8..ccfc94a03 100644
--- a/chrome/browser/autofill/autofill_browsertest.cc
+++ b/chrome/browser/autofill/autofill_browsertest.cc
@@ -907,7 +907,7 @@ IN_PROC_BROWSER_TEST_F(AutofillTest, FillProfileCrazyCharacters) {
L"\u898f\u7ba1\u5c0e\u904a"));
profile1.SetRawInfo(ADDRESS_HOME_ZIP, WideToUTF16(L"YOHO_54676"));
profile1.SetRawInfo(PHONE_HOME_WHOLE_NUMBER, WideToUTF16(L"861088828000"));
- profile1.SetRawInfo(ADDRESS_HOME_COUNTRY, WideToUTF16(L"India"));
+ profile1.SetInfo(ADDRESS_HOME_COUNTRY, WideToUTF16(L"India"), "en-US");
profiles.push_back(profile1);
AutofillProfile profile2;
@@ -974,7 +974,8 @@ IN_PROC_BROWSER_TEST_F(AutofillTest, FillProfileCrazyCharacters) {
profile7.SetRawInfo(ADDRESS_HOME_STATE, WideToUTF16(L"CA"));
profile7.SetRawInfo(ADDRESS_HOME_ZIP, WideToUTF16(L"94086"));
profile7.SetRawInfo(PHONE_HOME_WHOLE_NUMBER, WideToUTF16(L"15466784565"));
- profile7.SetRawInfo(ADDRESS_HOME_COUNTRY, WideToUTF16(L"United States"));
+ profile7.SetInfo(ADDRESS_HOME_COUNTRY, WideToUTF16(L"United States"),
+ "en-US");
profiles.push_back(profile7);
SetProfiles(&profiles);
@@ -1045,8 +1046,8 @@ IN_PROC_BROWSER_TEST_F(AutofillTest, Invalid) {
without_invalid.SetRawInfo(ADDRESS_HOME_CITY, ASCIIToUTF16("Sunnyvale"));
without_invalid.SetRawInfo(ADDRESS_HOME_STATE, ASCIIToUTF16("CA"));
without_invalid.SetRawInfo(ADDRESS_HOME_ZIP, ASCIIToUTF16("my_zip"));
- without_invalid.SetRawInfo(ADDRESS_HOME_COUNTRY,
- ASCIIToUTF16("United States"));
+ without_invalid.SetInfo(ADDRESS_HOME_COUNTRY, ASCIIToUTF16("United States"),
+ "en-US");
AutofillProfile with_invalid = without_invalid;
with_invalid.SetRawInfo(PHONE_HOME_WHOLE_NUMBER,
@@ -1490,7 +1491,7 @@ IN_PROC_BROWSER_TEST_F(AutofillTest, MAYBE_FormFillLatencyAfterSubmit) {
profile.SetRawInfo(ADDRESS_HOME_CITY, city);
profile.SetRawInfo(ADDRESS_HOME_STATE, WideToUTF16(L"CA"));
profile.SetRawInfo(ADDRESS_HOME_ZIP, zip);
- profile.SetRawInfo(ADDRESS_HOME_COUNTRY, WideToUTF16(L"United States"));
+ profile.SetRawInfo(ADDRESS_HOME_COUNTRY, WideToUTF16(L"US"));
profiles.push_back(profile);
}
SetProfiles(&profiles);
diff --git a/chrome/browser/autofill/autofill_manager_unittest.cc b/chrome/browser/autofill/autofill_manager_unittest.cc
index 6c03030..cedc7a5 100644
--- a/chrome/browser/autofill/autofill_manager_unittest.cc
+++ b/chrome/browser/autofill/autofill_manager_unittest.cc
@@ -160,7 +160,7 @@ class TestPersonalDataManager : public PersonalDataManager {
autofill_test::SetProfileInfo(profile, "Elvis", "Aaron",
"Presley", "theking@gmail.com", "RCA",
"3734 Elvis Presley Blvd.", "Apt. 10",
- "Memphis", "Tennessee", "38116", "USA",
+ "Memphis", "Tennessee", "38116", "US",
"12345678901");
profile->set_guid("00000000-0000-0000-0000-000000000001");
profiles->push_back(profile);
@@ -168,7 +168,7 @@ class TestPersonalDataManager : public PersonalDataManager {
autofill_test::SetProfileInfo(profile, "Charles", "Hardin",
"Holley", "buddy@gmail.com", "Decca",
"123 Apple St.", "unit 6", "Lubbock",
- "Texas", "79401", "USA", "23456789012");
+ "Texas", "79401", "US", "23456789012");
profile->set_guid("00000000-0000-0000-0000-000000000002");
profiles->push_back(profile);
profile = new AutofillProfile;
@@ -2421,8 +2421,7 @@ TEST_F(AutofillManagerTest, FillPhoneNumber) {
// We should not be able to fill prefix and suffix fields for international
// numbers.
- work_profile->SetRawInfo(ADDRESS_HOME_COUNTRY,
- ASCIIToUTF16("United Kingdom"));
+ work_profile->SetRawInfo(ADDRESS_HOME_COUNTRY, ASCIIToUTF16("GB"));
work_profile->SetRawInfo(PHONE_HOME_WHOLE_NUMBER,
ASCIIToUTF16("447700954321"));
page_id = 3;
@@ -2461,7 +2460,7 @@ TEST_F(AutofillManagerTest, FillPhoneNumber) {
std::vector<string16> phone_variants;
phone_variants.push_back(ASCIIToUTF16("16505554567"));
phone_variants.push_back(ASCIIToUTF16("18887771234"));
- work_profile->SetRawInfo(ADDRESS_HOME_COUNTRY, ASCIIToUTF16("United States"));
+ work_profile->SetRawInfo(ADDRESS_HOME_COUNTRY, ASCIIToUTF16("US"));
work_profile->SetRawMultiInfo(PHONE_HOME_WHOLE_NUMBER, phone_variants);
page_id = 5;
diff --git a/chrome/browser/autofill/autofill_metrics_unittest.cc b/chrome/browser/autofill/autofill_metrics_unittest.cc
index c0e1cc9..7b6c2e0 100644
--- a/chrome/browser/autofill/autofill_metrics_unittest.cc
+++ b/chrome/browser/autofill/autofill_metrics_unittest.cc
@@ -125,7 +125,7 @@ class TestPersonalDataManager : public PersonalDataManager {
autofill_test::SetProfileInfo(profile, "Elvis", "Aaron",
"Presley", "theking@gmail.com", "RCA",
"3734 Elvis Presley Blvd.", "Apt. 10",
- "Memphis", "Tennessee", "38116", "USA",
+ "Memphis", "Tennessee", "38116", "US",
"12345678901");
profile->set_guid("00000000-0000-0000-0000-000000000001");
profiles->push_back(profile);
@@ -133,7 +133,7 @@ class TestPersonalDataManager : public PersonalDataManager {
autofill_test::SetProfileInfo(profile, "Charles", "Hardin",
"Holley", "buddy@gmail.com", "Decca",
"123 Apple St.", "unit 6", "Lubbock",
- "Texas", "79401", "USA", "2345678901");
+ "Texas", "79401", "US", "2345678901");
profile->set_guid("00000000-0000-0000-0000-000000000002");
profiles->push_back(profile);
}
diff --git a/chrome/browser/autofill/autofill_profile_unittest.cc b/chrome/browser/autofill/autofill_profile_unittest.cc
index 54b2438..ba9ce7e 100644
--- a/chrome/browser/autofill/autofill_profile_unittest.cc
+++ b/chrome/browser/autofill/autofill_profile_unittest.cc
@@ -758,7 +758,7 @@ TEST(AutofillProfileTest, AddressCountryAbbrev) {
field.option_contents = options;
AutofillProfile profile;
- profile.SetRawInfo(ADDRESS_HOME_COUNTRY, ASCIIToUTF16("Canada"));
+ profile.SetInfo(ADDRESS_HOME_COUNTRY, ASCIIToUTF16("Canada"), "en-US");
profile.FillSelectControl(ADDRESS_HOME_COUNTRY, &field);
EXPECT_EQ(ASCIIToUTF16("CA"), field.value);
}
diff --git a/chrome/browser/autofill/personal_data_manager_unittest.cc b/chrome/browser/autofill/personal_data_manager_unittest.cc
index d73ca36..17a9ee1 100644
--- a/chrome/browser/autofill/personal_data_manager_unittest.cc
+++ b/chrome/browser/autofill/personal_data_manager_unittest.cc
@@ -111,7 +111,7 @@ TEST_F(PersonalDataManagerTest, AddProfile) {
autofill_test::SetProfileInfo(&profile0,
"John", "Mitchell", "Smith",
"j@s.com", "Acme Inc.", "1 Main", "Apt A", "San Francisco", "CA",
- "94102", "USA", "4158889999");
+ "94102", "US", "4158889999");
// Add profile0 to the database.
personal_data_->AddProfile(profile0);
@@ -981,7 +981,7 @@ TEST_F(PersonalDataManagerTest, AggregateSameProfileWithConflict) {
expected.GetRawMultiInfo(PHONE_HOME_WHOLE_NUMBER, &values);
values.push_back(ASCIIToUTF16("(650) 223-1234"));
expected.SetRawMultiInfo(PHONE_HOME_WHOLE_NUMBER, values);
- expected.SetRawInfo(ADDRESS_HOME_COUNTRY, ASCIIToUTF16("United States"));
+ expected.SetRawInfo(ADDRESS_HOME_COUNTRY, ASCIIToUTF16("US"));
ASSERT_EQ(1U, results2.size());
EXPECT_EQ(0, expected.Compare(*results2[0]));
}
@@ -1208,7 +1208,7 @@ TEST_F(PersonalDataManagerTest, AggregateExistingAuxiliaryProfile) {
autofill_test::SetProfileInfo(auxiliary_profile,
"Tester", "Frederick", "McAddressBookTesterson",
"tester@example.com", "Acme Inc.", "1 Main", "Apt A", "San Francisco",
- "CA", "94102", "USA", "1.415.888.9999");
+ "CA", "94102", "US", "1.415.888.9999");
ScopedVector<AutofillProfile>& auxiliary_profiles =
personal_data_->auxiliary_profiles_;
auxiliary_profiles.push_back(auxiliary_profile);