Avi Drissman | 4a8573c | 2022-09-09 19:35:54 | [diff] [blame] | 1 | // Copyright 2015 The Chromium Authors |
bondd | 10a45b9 | 2015-02-04 23:29:40 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef CHROME_BROWSER_AUTOFILL_AUTOFILL_UITEST_UTIL_H_ |
| 6 | #define CHROME_BROWSER_AUTOFILL_AUTOFILL_UITEST_UTIL_H_ |
| 7 | |
Christoph Schwering | 02e8cad | 2023-08-29 11:01:10 | [diff] [blame] | 8 | #include "components/autofill/content/browser/content_autofill_driver.h" |
Theo Cristea | 0cb4c2c | 2024-04-23 14:31:59 | [diff] [blame] | 9 | #include "testing/gtest/include/gtest/gtest.h" |
Jan Keitel | cce9e84 | 2023-08-11 10:32:04 | [diff] [blame] | 10 | #include "ui/gfx/geometry/rect_f.h" |
| 11 | |
Ian Struiksma | 606b1b5 | 2020-11-18 18:08:36 | [diff] [blame] | 12 | class Profile; |
bondd | 10a45b9 | 2015-02-04 23:29:40 | [diff] [blame] | 13 | |
| 14 | namespace autofill { |
| 15 | |
| 16 | class AutofillProfile; |
sebsg | e35b762c | 2018-03-29 20:33:27 | [diff] [blame] | 17 | class CreditCard; |
bondd | 10a45b9 | 2015-02-04 23:29:40 | [diff] [blame] | 18 | |
Ian Struiksma | 606b1b5 | 2020-11-18 18:08:36 | [diff] [blame] | 19 | void AddTestProfile(Profile* base_profile, const AutofillProfile& profile); |
Ian Struiksma | 606b1b5 | 2020-11-18 18:08:36 | [diff] [blame] | 20 | void AddTestCreditCard(Profile* base_profile, const CreditCard& card); |
| 21 | void AddTestServerCreditCard(Profile* base_profile, const CreditCard& card); |
| 22 | void AddTestAutofillData(Profile* base_profile, |
Yiming Zhou | 03261c8 | 2018-06-19 19:18:54 | [diff] [blame] | 23 | const AutofillProfile& profile, |
| 24 | const CreditCard& card); |
Ian Struiksma | 606b1b5 | 2020-11-18 18:08:36 | [diff] [blame] | 25 | void WaitForPersonalDataChange(Profile* base_profile); |
Dominic Battre | b5b59a5 | 2021-01-14 12:11:07 | [diff] [blame] | 26 | void WaitForPersonalDataManagerToBeLoaded(Profile* base_profile); |
siyua | 748ce38 | 2019-02-11 22:18:24 | [diff] [blame] | 27 | |
Jan Keitel | cce9e84 | 2023-08-11 10:32:04 | [diff] [blame] | 28 | // Displays an Autofill popup with a dummy suggestion for an element at |
| 29 | // `element_bounds`. |
| 30 | // Unlike `autofill::test::GenerateTestAutofillPopup()`, this function triggers |
Christoph Schwering | 02e8cad | 2023-08-29 11:01:10 | [diff] [blame] | 31 | // the popup through `driver->AskForValuesToFill()`, instead of |
| 32 | // AutofillExternalDelegate::OnQuery(). This initializes the form's meta data |
Christoph Schwering | bc48bb97f | 2023-09-07 09:22:40 | [diff] [blame] | 33 | // and prepares ContentAutofillDriver's and AutofillDriverRouter's state to |
Christoph Schwering | 02e8cad | 2023-08-29 11:01:10 | [diff] [blame] | 34 | // process events such as `AutofillDriver::PopupHidden()` triggered by the |
| 35 | // popup. |
Theo Cristea | 0cb4c2c | 2024-04-23 14:31:59 | [diff] [blame] | 36 | [[nodiscard]] testing::AssertionResult GenerateTestAutofillPopup( |
| 37 | ContentAutofillDriver& driver, |
| 38 | Profile* profile, |
| 39 | bool expect_popup_to_be_shown, |
| 40 | gfx::RectF element_bounds = gfx::RectF(100.0f, 100.0f)); |
Christoph Schwering | 6853e97 | 2021-07-02 08:27:22 | [diff] [blame] | 41 | |
bondd | 10a45b9 | 2015-02-04 23:29:40 | [diff] [blame] | 42 | } // namespace autofill |
| 43 | |
| 44 | #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_UITEST_UTIL_H_ |