Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(166)

Unified Diff: components/autofill/core/browser/webdata/autofill_profile_syncable_service_unittest.cc

Issue 347183005: autofill names - dont parse when calling SetRawInfo(FULL_NAME) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix android test expectation Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/autofill/core/browser/personal_data_manager_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/autofill/core/browser/webdata/autofill_profile_syncable_service_unittest.cc
diff --git a/components/autofill/core/browser/webdata/autofill_profile_syncable_service_unittest.cc b/components/autofill/core/browser/webdata/autofill_profile_syncable_service_unittest.cc
index 9b92208b6c222b08f39aa85bca0bec92f663129e..3a7b9b1d270ae1ad49d7df40abe0b02df353fa0f 100644
--- a/components/autofill/core/browser/webdata/autofill_profile_syncable_service_unittest.cc
+++ b/components/autofill/core/browser/webdata/autofill_profile_syncable_service_unittest.cc
@@ -137,6 +137,18 @@ scoped_ptr<AutofillProfile> ConstructCompleteProfile() {
names.push_back(ASCIIToUTF16("John K. Doe, Jr."));
names.push_back(ASCIIToUTF16("Jane Luise Smith MD"));
profile->SetRawMultiInfo(NAME_FULL, names);
+ names.clear();
+ names.push_back(ASCIIToUTF16("John"));
+ names.push_back(ASCIIToUTF16("Jane"));
+ profile->SetRawMultiInfo(NAME_FIRST, names);
+ names.clear();
+ names.push_back(ASCIIToUTF16("K."));
+ names.push_back(ASCIIToUTF16("Luise"));
+ profile->SetRawMultiInfo(NAME_MIDDLE, names);
+ names.clear();
+ names.push_back(ASCIIToUTF16("Doe"));
+ names.push_back(ASCIIToUTF16("Smith"));
+ profile->SetRawMultiInfo(NAME_LAST, names);
std::vector<base::string16> emails;
emails.push_back(ASCIIToUTF16("user@example.com"));
@@ -448,7 +460,7 @@ TEST_F(AutofillProfileSyncableServiceTest, MergeDataEmptyOrigins) {
autofill_specifics->add_name_first("John");
autofill_specifics->add_name_middle(std::string());
autofill_specifics->add_name_last(std::string());
- autofill_specifics->add_name_full("John");
+ autofill_specifics->add_name_full(std::string());
autofill_specifics->add_email_address(std::string());
autofill_specifics->add_phone_home_whole_number(std::string());
autofill_specifics->set_address_home_line1("1 1st st");
@@ -893,7 +905,7 @@ TEST_F(AutofillProfileSyncableServiceTest, EmptySyncPreservesOrigin) {
autofill_specifics->add_name_first("John");
autofill_specifics->add_name_middle(std::string());
autofill_specifics->add_name_last(std::string());
- autofill_specifics->add_name_full("John");
+ autofill_specifics->add_name_full(std::string());
autofill_specifics->add_email_address(std::string());
autofill_specifics->add_phone_home_whole_number(std::string());
EXPECT_FALSE(autofill_specifics->has_origin());
@@ -1059,7 +1071,7 @@ TEST_F(AutofillProfileSyncableServiceTest, EmptySyncPreservesLanguageCode) {
autofill_specifics->add_name_first("John");
autofill_specifics->add_name_middle(std::string());
autofill_specifics->add_name_last(std::string());
- autofill_specifics->add_name_full("John");
+ autofill_specifics->add_name_full(std::string());
autofill_specifics->add_email_address(std::string());
autofill_specifics->add_phone_home_whole_number(std::string());
EXPECT_FALSE(autofill_specifics->has_address_home_language_code());
@@ -1145,7 +1157,8 @@ TEST_F(AutofillProfileSyncableServiceTest, EmptySyncPreservesFullName) {
// Local autofill profile has a full name.
AutofillProfile profile(kGuid1, kHttpsOrigin);
- profile.SetRawInfo(NAME_FULL, ASCIIToUTF16("John Jacob Smith, Jr"));
+ profile.SetInfo(AutofillType(NAME_FULL),
+ ASCIIToUTF16("John Jacob Smith, Jr"), "en-US");
profiles_from_web_db.push_back(new AutofillProfile(profile));
// Remote data does not have a full name value.
@@ -1166,7 +1179,9 @@ TEST_F(AutofillProfileSyncableServiceTest, EmptySyncPreservesFullName) {
// Expect local autofill profile to still have the same full name after sync.
MockAutofillProfileSyncableService::DataBundle expected_bundle;
AutofillProfile expected_profile(profile.guid(), profile.origin());
- expected_profile.SetRawInfo(NAME_FULL, ASCIIToUTF16("John Jacob Smith, Jr"));
+ expected_profile.SetInfo(AutofillType(NAME_FULL),
+ ASCIIToUTF16("John Jacob Smith, Jr"),
+ "en-US");
expected_bundle.profiles_to_update.push_back(&expected_profile);
// Expect no changes to remote data.
« no previous file with comments | « components/autofill/core/browser/personal_data_manager_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698