Show manual fallback suggestions for striked fields
This was a bug in the current implementation. We are supposed to only
suppress automatic suggestions and not manual fallback ones, which need
to be the recovery mechanism of suppression.
Bug: 322910752
Change-Id: Ic144fabb387143e5020f08389c7626c4cdc83f1e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5489220
Auto-Submit: Jihad Hanna <jihadghanna@google.com>
Reviewed-by: Florian Leimgruber <fleimgruber@google.com>
Commit-Queue: Jihad Hanna <jihadghanna@google.com>
Cr-Commit-Position: refs/heads/main@{#1292745}
diff --git a/components/autofill/core/browser/browser_autofill_manager.cc b/components/autofill/core/browser/browser_autofill_manager.cc
index da8dfa8..f4c0b5e 100644
--- a/components/autofill/core/browser/browser_autofill_manager.cc
+++ b/components/autofill/core/browser/browser_autofill_manager.cc
@@ -2241,7 +2241,9 @@
const AutofillField* trigger_autofill_field,
AutofillSuggestionTriggerSource trigger_source) const {
#if !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_IOS)
- if (client()
+ if (trigger_source !=
+ AutofillSuggestionTriggerSource::kManualFallbackAddress &&
+ client()
.GetPersonalDataManager()
->address_data_manager()
.AreAddressSuggestionsBlocked(
diff --git a/components/autofill/core/browser/browser_autofill_manager_unittest.cc b/components/autofill/core/browser/browser_autofill_manager_unittest.cc
index 37bffafc..843ccc7 100644
--- a/components/autofill/core/browser/browser_autofill_manager_unittest.cc
+++ b/components/autofill/core/browser/browser_autofill_manager_unittest.cc
@@ -1449,6 +1449,16 @@
EXPECT_FALSE(test_api(*browser_autofill_manager_)
.GetProfileSuggestions(form, form.fields[1])
.empty());
+
+ // Check that after accepting a suggestion, suppression and strikes are reset.
+ GetAutofillSuggestions(
+ form, form.fields[0],
+ AutofillSuggestionTriggerSource::kManualFallbackAddress);
+ external_delegate()->DidAcceptSuggestion(
+ Suggestion(PopupItemId::kAddressEntry), {});
+ EXPECT_FALSE(test_api(*browser_autofill_manager_)
+ .GetProfileSuggestions(form, form.fields[0])
+ .empty());
}
#endif