Only call AutofillPopupDelegate::OnPopupShown if popup was shown.
Prior to this change, AutofillPopupControllerImpl::Show does not return
early if AutofillPopupView::Show does not result in actually showing
the popup.
This means that AutofillPopupControllerImpl::Show will call
AutofillPopupDelegate::OnPopupShown even though
- The popup was never shown.
- AutofillPopupDelegate::OnPopupHidden was called just before it,
since failure to show the popup results in PopupViewViews
calling Hide() on the controller and the controller calls
OnPopupHidden.
Bug: 1469871
Change-Id: I5b9be19c9659f34cc8ffe55d6a6c7690f8eb682e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4753574
Reviewed-by: Vasilii Sukhanov <[email protected]>
Code-Coverage: [email protected] <[email protected]>
Commit-Queue: Jan Keitel <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1182508}
diff --git a/chrome/browser/autofill/autofill_uitest_util.h b/chrome/browser/autofill/autofill_uitest_util.h
index bfd2bc5b..84d24e0 100644
--- a/chrome/browser/autofill/autofill_uitest_util.h
+++ b/chrome/browser/autofill/autofill_uitest_util.h
@@ -7,6 +7,8 @@
#include <vector>
+#include "ui/gfx/geometry/rect_f.h"
+
class Profile;
namespace autofill {
@@ -27,15 +29,17 @@
void WaitForPersonalDataChange(Profile* base_profile);
void WaitForPersonalDataManagerToBeLoaded(Profile* base_profile);
-// Displays an Autofill popup with a dummy suggestion.
-// Unlike autofill::test::GenerateTestAutofillPopup(), this function triggers
+// Displays an Autofill popup with a dummy suggestion for an element at
+// `element_bounds`.
+// Unlike `autofill::test::GenerateTestAutofillPopup()`, this function triggers
// the popup through the `autofill_external_delegate->GetAutofillDriver()`'s
-// AskForValuesToFill(), instead of the |autofill_external_delegate|'s
-// OnQuery() event. This initializes the form's meta data and prepares
+// `AskForValuesToFill()`, instead of the `autofill_external_delegate`'s
+// `OnQuery()` event. This initializes the form's meta data and prepares
// ContentAutofillDriver's and ContentAutofillRouter's state to process events
-// such as AutofillDriver::PopupHidden() triggered by the popup.
+// such as `AutofillDriver::PopupHidden()` triggered by the popup.
void GenerateTestAutofillPopup(
- AutofillExternalDelegate* autofill_external_delegate);
+ AutofillExternalDelegate* autofill_external_delegate,
+ gfx::RectF element_bounds = gfx::RectF(100.0f, 100.0f));
} // namespace autofill