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 | |
| 8 | #include <vector> |
| 9 | |
Christoph Schwering | 02e8cad | 2023-08-29 11:01:10 | [diff] [blame^] | 10 | #include "components/autofill/content/browser/content_autofill_driver.h" |
Jan Keitel | cce9e84 | 2023-08-11 10:32:04 | [diff] [blame] | 11 | #include "ui/gfx/geometry/rect_f.h" |
| 12 | |
Ian Struiksma | 606b1b5 | 2020-11-18 18:08:36 | [diff] [blame] | 13 | class Profile; |
bondd | 10a45b9 | 2015-02-04 23:29:40 | [diff] [blame] | 14 | |
| 15 | namespace autofill { |
| 16 | |
bondd | 10a45b9 | 2015-02-04 23:29:40 | [diff] [blame] | 17 | class AutofillProfile; |
sebsg | e35b762c | 2018-03-29 20:33:27 | [diff] [blame] | 18 | class CreditCard; |
bondd | 10a45b9 | 2015-02-04 23:29:40 | [diff] [blame] | 19 | |
Ian Struiksma | 606b1b5 | 2020-11-18 18:08:36 | [diff] [blame] | 20 | void AddTestProfile(Profile* base_profile, const AutofillProfile& profile); |
| 21 | void SetTestProfile(Profile* base_profile, const AutofillProfile& profile); |
| 22 | void SetTestProfiles(Profile* base_profile, |
| 23 | std::vector<AutofillProfile>* profiles); |
| 24 | void AddTestCreditCard(Profile* base_profile, const CreditCard& card); |
| 25 | void AddTestServerCreditCard(Profile* base_profile, const CreditCard& card); |
| 26 | void AddTestAutofillData(Profile* base_profile, |
Yiming Zhou | 03261c8 | 2018-06-19 19:18:54 | [diff] [blame] | 27 | const AutofillProfile& profile, |
| 28 | const CreditCard& card); |
Ian Struiksma | 606b1b5 | 2020-11-18 18:08:36 | [diff] [blame] | 29 | void WaitForPersonalDataChange(Profile* base_profile); |
Dominic Battre | b5b59a5 | 2021-01-14 12:11:07 | [diff] [blame] | 30 | void WaitForPersonalDataManagerToBeLoaded(Profile* base_profile); |
siyua | 748ce38 | 2019-02-11 22:18:24 | [diff] [blame] | 31 | |
Jan Keitel | cce9e84 | 2023-08-11 10:32:04 | [diff] [blame] | 32 | // Displays an Autofill popup with a dummy suggestion for an element at |
| 33 | // `element_bounds`. |
| 34 | // Unlike `autofill::test::GenerateTestAutofillPopup()`, this function triggers |
Christoph Schwering | 02e8cad | 2023-08-29 11:01:10 | [diff] [blame^] | 35 | // the popup through `driver->AskForValuesToFill()`, instead of |
| 36 | // AutofillExternalDelegate::OnQuery(). This initializes the form's meta data |
| 37 | // and prepares ContentAutofillDriver's and ContentAutofillRouter's state to |
| 38 | // process events such as `AutofillDriver::PopupHidden()` triggered by the |
| 39 | // popup. |
| 40 | void GenerateTestAutofillPopup(ContentAutofillDriver& driver, |
| 41 | gfx::RectF element_bounds = gfx::RectF(100.0f, |
| 42 | 100.0f)); |
Christoph Schwering | 6853e97 | 2021-07-02 08:27:22 | [diff] [blame] | 43 | |
bondd | 10a45b9 | 2015-02-04 23:29:40 | [diff] [blame] | 44 | } // namespace autofill |
| 45 | |
| 46 | #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_UITEST_UTIL_H_ |