#include "chrome/browser/ui/autofill/chrome_autofill_client.h"
#include <optional>
#include <utility>
#include "base/functional/bind.h"
#include "base/memory/raw_ptr.h"
#include "base/test/scoped_feature_list.h"
#include "build/branding_buildflags.h"
#include "build/build_config.h"
#include "chrome/browser/autofill/mock_autofill_agent.h"
#include "chrome/browser/autofill/personal_data_manager_factory.h"
#include "chrome/browser/autofill/ui/ui_util.h"
#include "chrome/browser/fast_checkout/fast_checkout_client_impl.h"
#include "chrome/browser/feature_engagement/tracker_factory.h"
#include "chrome/browser/plus_addresses/plus_address_service_factory.h"
#include "chrome/browser/ssl/chrome_security_state_tab_helper.h"
#include "chrome/browser/ui/autofill/autofill_field_promo_controller.h"
#include "chrome/browser/ui/autofill/edit_address_profile_dialog_controller_impl.h"
#include "chrome/test/base/chrome_render_view_host_test_harness.h"
#include "components/autofill/content/browser/autofill_test_utils.h"
#include "components/autofill/content/browser/test_autofill_client_injector.h"
#include "components/autofill/content/browser/test_autofill_driver_injector.h"
#include "components/autofill/content/browser/test_autofill_manager_injector.h"
#include "components/autofill/content/browser/test_content_autofill_driver.h"
#include "components/autofill/core/browser/autofill_test_utils.h"
#include "components/autofill/core/browser/data_model/autofill_profile.h"
#include "components/autofill/core/browser/data_model/autofill_profile_test_api.h"
#include "components/autofill/core/browser/payments/payments_autofill_client.h"
#include "components/autofill/core/browser/test_autofill_manager_waiter.h"
#include "components/autofill/core/browser/test_browser_autofill_manager.h"
#include "components/autofill/core/browser/test_personal_data_manager.h"
#include "components/autofill/core/browser/ui/mock_autofill_suggestion_delegate.h"
#include "components/autofill/core/browser/ui/mock_fast_checkout_client.h"
#include "components/autofill/core/common/autofill_payments_features.h"
#include "components/autofill/core/common/autofill_test_utils.h"
#include "components/autofill/core/common/form_field_data.h"
#include "components/autofill/core/common/form_interactions_flow.h"
#include "components/keyed_service/core/keyed_service.h"
#include "components/plus_addresses/features.h"
#include "components/prefs/pref_service.h"
#include "components/strings/grit/components_strings.h"
#include "components/unified_consent/pref_names.h"
#include "components/user_education/test/mock_feature_promo_controller.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/test/navigation_simulator.h"
#include "mojo/public/cpp/bindings/associated_receiver_set.h"
#include "mojo/public/cpp/bindings/associated_remote.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/common/associated_interfaces/associated_interface_provider.h"
#include "ui/base/l10n/l10n_util.h"
#if BUILDFLAG(IS_ANDROID)
#include "chrome/browser/ui/android/autofill/autofill_cvc_save_message_delegate.h"
#include "chrome/browser/ui/android/autofill/autofill_save_card_bottom_sheet_bridge.h"
#include "chrome/browser/ui/android/autofill/autofill_save_card_delegate_android.h"
#include "components/autofill/core/browser/payments/autofill_save_card_ui_info.h"
#else
#include "chrome/browser/ui/autofill/payments/save_card_bubble_controller_impl.h"
#include "chrome/browser/ui/hats/hats_service_factory.h"
#include "chrome/browser/ui/hats/mock_hats_service.h"
#include "components/feature_engagement/test/mock_tracker.h"
#endif
namespace autofill {
namespace {
CreateFormDataForRenderFrameHost;
CreateTestFormField;
_;
A;
AllOf;
Field;
InSequence;
Ref;
Return;
PasswordFormClassification;
MockFeaturePromoController;
#if BUILDFLAG(IS_ANDROID)
class MockAutofillSaveCardBottomSheetBridge
: public AutofillSaveCardBottomSheetBridge {
public:
MockAutofillSaveCardBottomSheetBridge()
: AutofillSaveCardBottomSheetBridge(
base::android::ScopedJavaGlobalRef<jobject>(nullptr)) {}
MOCK_METHOD(void,
RequestShowContent,
(const AutofillSaveCardUiInfo&,
std::unique_ptr<AutofillSaveCardDelegateAndroid>),
(override));
};
#else
class MockSaveCardBubbleController : public SaveCardBubbleControllerImpl { … };
#endif
class MockAutofillFieldPromoController : public AutofillFieldPromoController { … };
class TestChromeAutofillClient : public ChromeAutofillClient { … };
class ChromeAutofillClientTest : public ChromeRenderViewHostTestHarness { … };
TEST_F(ChromeAutofillClientTest, ClassifiesLoginFormOnMainFrame) { … }
TEST_F(ChromeAutofillClientTest, ClassifiesLoginFormOnChildFrame) { … }
TEST_F(ChromeAutofillClientTest, GetFormInteractionsFlowId_BelowMaxFlowTime) { … }
TEST_F(ChromeAutofillClientTest, GetFormInteractionsFlowId_AboveMaxFlowTime) { … }
TEST_F(ChromeAutofillClientTest, GetFormInteractionsFlowId_AdvancedTwice) { … }
TEST_F(ChromeAutofillClientTest,
PlusAddressDefaultFeatureStateMeansNullPlusAddressService) { … }
#if !BUILDFLAG(IS_ANDROID)
TEST_F(ChromeAutofillClientTest, TriggerUserPerceptionOfAutofillAddressSurvey) { … }
TEST_F(ChromeAutofillClientTest,
TriggerUserPerceptionOfAutofillCreditCardSurvey) { … }
TEST_F(ChromeAutofillClientTest,
CreditCardUploadCompleted_ShowConfirmationBubbleView_CardSaved) { … }
TEST_F(ChromeAutofillClientTest,
CreditCardUploadCompleted_ShowConfirmationBubbleView_CardNotSaved) { … }
TEST_F(ChromeAutofillClientTest,
CreditCardUploadCompleted_NoConfirmationBubbleView_OnRequestTimeout) { … }
TEST_F(ChromeAutofillClientTest, EditAddressDialogFooter) { … }
TEST_F(ChromeAutofillClientTest, AutofillManualFallbackIPH_IsShown) { … }
TEST_F(ChromeAutofillClientTest,
AutofillManualFallbackIPH_HideOnShowAutofillSuggestions) { … }
TEST_F(ChromeAutofillClientTest, AutofillManualFallbackIPH_NotifyFeatureUsed) { … }
#endif
}
}