blob: 48c327b0c17adedb2a1f1484e453f254a7405156 [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
Christoph Schwering02e8cad2023-08-29 11:01:108#include "components/autofill/content/browser/content_autofill_driver.h"
Theo Cristea0cb4c2c2024-04-23 14:31:599#include "testing/gtest/include/gtest/gtest.h"
Jan Keitelcce9e842023-08-11 10:32:0410#include "ui/gfx/geometry/rect_f.h"
11
Ian Struiksma606b1b52020-11-18 18:08:3612class Profile;
bondd10a45b92015-02-04 23:29:4013
14namespace autofill {
15
16class AutofillProfile;
sebsge35b762c2018-03-29 20:33:2717class CreditCard;
bondd10a45b92015-02-04 23:29:4018
Ian Struiksma606b1b52020-11-18 18:08:3619void AddTestProfile(Profile* base_profile, const AutofillProfile& profile);
Ian Struiksma606b1b52020-11-18 18:08:3620void AddTestCreditCard(Profile* base_profile, const CreditCard& card);
21void AddTestServerCreditCard(Profile* base_profile, const CreditCard& card);
22void AddTestAutofillData(Profile* base_profile,
Yiming Zhou03261c82018-06-19 19:18:5423 const AutofillProfile& profile,
24 const CreditCard& card);
Ian Struiksma606b1b52020-11-18 18:08:3625void WaitForPersonalDataChange(Profile* base_profile);
Dominic Battreb5b59a52021-01-14 12:11:0726void WaitForPersonalDataManagerToBeLoaded(Profile* base_profile);
siyua748ce382019-02-11 22:18:2427
Jan Keitelcce9e842023-08-11 10:32:0428// Displays an Autofill popup with a dummy suggestion for an element at
29// `element_bounds`.
30// Unlike `autofill::test::GenerateTestAutofillPopup()`, this function triggers
Christoph Schwering02e8cad2023-08-29 11:01:1031// the popup through `driver->AskForValuesToFill()`, instead of
32// AutofillExternalDelegate::OnQuery(). This initializes the form's meta data
Christoph Schweringbc48bb97f2023-09-07 09:22:4033// and prepares ContentAutofillDriver's and AutofillDriverRouter's state to
Christoph Schwering02e8cad2023-08-29 11:01:1034// process events such as `AutofillDriver::PopupHidden()` triggered by the
35// popup.
Theo Cristea0cb4c2c2024-04-23 14:31:5936[[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 Schwering6853e972021-07-02 08:27:2241
bondd10a45b92015-02-04 23:29:4042} // namespace autofill
43
44#endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_UITEST_UTIL_H_