blob: 4c3f0a80a85acd00c1ea8d359f7f0df87c2bc463 [file] [log] [blame]
Avi Drissman4a8573c2022-09-09 19:35:541// Copyright 2015 The Chromium Authors
bondd10a45b92015-02-04 23:29:402// 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 Schwering02e8cad2023-08-29 11:01:1010#include "components/autofill/content/browser/content_autofill_driver.h"
Jan Keitelcce9e842023-08-11 10:32:0411#include "ui/gfx/geometry/rect_f.h"
12
Ian Struiksma606b1b52020-11-18 18:08:3613class Profile;
bondd10a45b92015-02-04 23:29:4014
15namespace autofill {
16
bondd10a45b92015-02-04 23:29:4017class AutofillProfile;
sebsge35b762c2018-03-29 20:33:2718class CreditCard;
bondd10a45b92015-02-04 23:29:4019
Ian Struiksma606b1b52020-11-18 18:08:3620void AddTestProfile(Profile* base_profile, const AutofillProfile& profile);
21void SetTestProfile(Profile* base_profile, const AutofillProfile& profile);
22void SetTestProfiles(Profile* base_profile,
23 std::vector<AutofillProfile>* profiles);
24void AddTestCreditCard(Profile* base_profile, const CreditCard& card);
25void AddTestServerCreditCard(Profile* base_profile, const CreditCard& card);
26void AddTestAutofillData(Profile* base_profile,
Yiming Zhou03261c82018-06-19 19:18:5427 const AutofillProfile& profile,
28 const CreditCard& card);
Ian Struiksma606b1b52020-11-18 18:08:3629void WaitForPersonalDataChange(Profile* base_profile);
Dominic Battreb5b59a52021-01-14 12:11:0730void WaitForPersonalDataManagerToBeLoaded(Profile* base_profile);
siyua748ce382019-02-11 22:18:2431
Jan Keitelcce9e842023-08-11 10:32:0432// Displays an Autofill popup with a dummy suggestion for an element at
33// `element_bounds`.
34// Unlike `autofill::test::GenerateTestAutofillPopup()`, this function triggers
Christoph Schwering02e8cad2023-08-29 11:01:1035// 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.
40void GenerateTestAutofillPopup(ContentAutofillDriver& driver,
41 gfx::RectF element_bounds = gfx::RectF(100.0f,
42 100.0f));
Christoph Schwering6853e972021-07-02 08:27:2243
bondd10a45b92015-02-04 23:29:4044} // namespace autofill
45
46#endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_UITEST_UTIL_H_