Commit c853dbe3 authored by sebsg's avatar sebsg Committed by Commit bot

[Autofill] Use user's email for converted wallet addresses.

Since Wallet addresses don't have an email address, the signed-in
user's email address should be used if the Wallet address is not
merged into an existing local profile.

BUG=680182

Review-Url: https://codereview.chromium.org/2671813005
Cr-Commit-Position: refs/heads/master@{#448008}
parent 792b8e63
......@@ -1918,6 +1918,15 @@ std::string PersonalDataManager::MergeServerAddressesIntoProfiles(
// Set the profile as being local.
existing_profiles->back().set_record_type(AutofillProfile::LOCAL_PROFILE);
existing_profiles->back().set_modification_date(AutofillClock::Now());
// Wallet addresses don't have an email address, use the one from the
// currently signed-in account.
std::string account_id = signin_manager_->GetAuthenticatedAccountId();
base::string16 email =
base::UTF8ToUTF16(account_tracker_->GetAccountInfo(account_id).email);
if (!email.empty())
existing_profiles->back().SetRawInfo(EMAIL_ADDRESS, email);
AutofillMetrics::LogWalletAddressConversionType(
AutofillMetrics::CONVERTED_ADDRESS_ADDED);
}
......
......@@ -5741,6 +5741,11 @@ TEST_F(PersonalDataManagerTest,
personal_data_->GetCreditCards()[0]->billing_address_id());
EXPECT_EQ(profiles[0]->guid(),
personal_data_->GetCreditCards()[1]->billing_address_id());
// Make sure that the added address has the email address of the currently
// signed-in user.
EXPECT_EQ(UTF8ToUTF16("syncuser@example.com"),
profiles[0]->GetRawInfo(EMAIL_ADDRESS));
}
// Tests that the converted wallet address is merged into an existing local
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment