0

Shows masked IBAN value as suggestion instead of nickname

before:
https://screenshot.googleplex.com/8RVvGpLYxQSbJ2z
after:
https://screenshot.googleplex.com/3k6xPYpD6WWdVYq

Bug: 375290875
Change-Id: I9b28c41011a2f20f786e817ed613d3084a04f7dc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5959394
Reviewed-by: Jan Keitel <jkeitel@google.com>
Auto-Submit: Qihui Zhao <qihuizhao@google.com>
Reviewed-by: Olivia Saul <jsaul@google.com>
Code-Coverage: findit-for-me@appspot.gserviceaccount.com <findit-for-me@appspot.gserviceaccount.com>
Commit-Queue: Olivia Saul <jsaul@google.com>
Cr-Commit-Position: refs/heads/main@{#1373419}
This commit is contained in:
Qihui Zhao
2024-10-24 17:39:59 +00:00
committed by Chromium LUCI CQ
parent 340ec9c2a3
commit 81b85a2664
2 changed files with 11 additions and 8 deletions

@ -681,10 +681,13 @@ void AutofillExternalDelegate::DidSelectSuggestion(
/*field_type_used=*/std::nullopt);
break;
case SuggestionType::kIbanEntry:
// Always shows the masked IBAN value as the preview of the suggestion.
manager_->FillOrPreviewField(
mojom::ActionPersistence::kPreview,
mojom::FieldActionType::kReplaceAll, query_form_, query_field_,
suggestion.main_text.value, suggestion.type, IBAN_VALUE);
suggestion.labels.empty() ? suggestion.main_text.value
: suggestion.labels[0][0].value,
suggestion.type, IBAN_VALUE);
break;
case SuggestionType::kMerchantPromoCodeEntry:
manager_->FillOrPreviewField(

@ -1195,10 +1195,10 @@ TEST_F(AutofillExternalDelegateUnitTest, ExternalDelegateFillsIbanEntry) {
_));
std::vector<Suggestion> suggestions;
Iban iban = test::GetLocalIban();
suggestions.emplace_back(
/*main_text=*/iban.GetIdentifierStringForAutofillDisplay(),
SuggestionType::kIbanEntry);
suggestions[0].labels = {{Suggestion::Text(u"My doctor's IBAN")}};
suggestions.emplace_back(/*main_text=*/u"My doctor's IBAN",
SuggestionType::kIbanEntry);
suggestions[0].labels = {
{Suggestion::Text(iban.GetIdentifierStringForAutofillDisplay())}};
suggestions[0].payload = Suggestion::Guid(iban.guid());
OnSuggestionsReturned(queried_field().global_id(), suggestions);
@ -1219,10 +1219,10 @@ TEST_F(AutofillExternalDelegateUnitTest, ExternalDelegateFillsIbanEntry) {
HasQueriedFormId(), HasQueriedFieldId(),
iban.value(), SuggestionType::kIbanEntry,
std::optional(IBAN_VALUE)));
Suggestion suggestion(iban.GetIdentifierStringForAutofillDisplay(),
SuggestionType::kIbanEntry);
Suggestion suggestion(u"My doctor's IBAN", SuggestionType::kIbanEntry);
suggestion.payload = Suggestion::Guid(iban.guid());
suggestion.labels = {{Suggestion::Text(u"My doctor's IBAN")}};
suggestion.labels = {
{Suggestion::Text(iban.GetIdentifierStringForAutofillDisplay())}};
EXPECT_CALL(*client().GetPaymentsAutofillClient()->GetIbanManager(),
OnSingleFieldSuggestionSelected(suggestion));
ON_CALL(*client().GetPaymentsAutofillClient()->GetIbanAccessManager(),