#include "chrome/browser/ui/autofill/autofill_popup_controller_impl.h"
#include <optional>
#include "base/test/metrics/user_action_tester.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/ui/autofill/autofill_popup_controller.h"
#include "chrome/browser/ui/autofill/autofill_popup_controller_impl_test_api.h"
#include "chrome/browser/ui/autofill/autofill_suggestion_controller_test_base.h"
#include "chrome/browser/ui/autofill/test_autofill_popup_controller_autofill_client.h"
#include "components/autofill/core/browser/ui/popup_interaction.h"
#include "components/autofill/core/browser/ui/suggestion.h"
#include "components/autofill/core/browser/ui/suggestion_button_action.h"
#include "components/autofill/core/browser/ui/suggestion_type.h"
#include "components/autofill/core/common/aliases.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/accessibility/ax_active_popup.h"
#include "ui/accessibility/ax_node.h"
#include "ui/accessibility/ax_tree_id.h"
#include "ui/accessibility/ax_tree_manager.h"
#include "ui/accessibility/ax_tree_manager_map.h"
#include "ui/accessibility/platform/ax_platform_node_base.h"
#include "ui/accessibility/platform/ax_platform_node_delegate.h"
#include "ui/gfx/range/range.h"
#if !BUILDFLAG(IS_CHROMEOS_ASH)
#include "content/public/test/scoped_accessibility_mode_override.h"
#endif
namespace autofill {
namespace {
_;
AllOf;
ElementsAre;
Eq;
Field;
InSequence;
Matcher;
Mock;
MockFunction;
NiceMock;
Return;
SingleEntryRemovalMethod;
Matcher<const AutofillSuggestionDelegate::SuggestionPosition&>
EqualsSuggestionPosition(
AutofillSuggestionDelegate::SuggestionPosition position) { … }
}
AutofillPopupControllerImplTest;
TEST_F(AutofillPopupControllerImplTest, AcceptSuggestionRespectsTimeout) { … }
TEST_F(AutofillPopupControllerImplTest, AcceptSuggestionRespectsWaitsForPaint) { … }
TEST_F(AutofillPopupControllerImplTest,
AcceptSuggestionTimeoutIsUpdatedOnPopupUpdate) { … }
TEST_F(AutofillPopupControllerImplTest, SubPopupIsCreatedWithViewFromParent) { … }
TEST_F(AutofillPopupControllerImplTest,
PopupInteraction_SubPopupMetricsAreLogged) { … }
TEST_F(AutofillPopupControllerImplTest,
PopupInteraction_NonAddressSuggestion_LogOnlyHistogramMetrics) { … }
TEST_F(
AutofillPopupControllerImplTest,
PopupInteraction_TriggerSourcesThatOpensThePopupIndirectly_SubPopupMetricsAreNotLogged) { … }
TEST_F(AutofillPopupControllerImplTest,
PopupInteraction_RootPopupMetricsAreLogged) { … }
TEST_F(AutofillPopupControllerImplTest,
DelegateMethodsAreCalledOnlyByRootPopup) { … }
TEST_F(AutofillPopupControllerImplTest, EventsAreDelegatedToChildrenAndView) { … }
TEST_F(AutofillPopupControllerImplTest, ButtonActionsAreSentToDelegate) { … }
TEST_F(AutofillPopupControllerImplTest, PopupForwardsSuggestionPosition) { … }
TEST_F(AutofillPopupControllerImplTest, DoesNotAcceptUnacceptableSuggestions) { … }
TEST_F(AutofillPopupControllerImplTest, DoesNotSelectUnacceptableSuggestions) { … }
TEST_F(AutofillPopupControllerImplTest,
ManualFallBackTriggerSource_IgnoresClickOutsideCheck) { … }
TEST_F(AutofillPopupControllerImplTest, GetPopupScreenLocationCallsView) { … }
TEST_F(AutofillPopupControllerImplTest,
TimedHideComposeSavedStateNotification) { … }
TEST_F(AutofillPopupControllerImplTest,
PopupHidesOnWebContentsFocusLossIfViewIsNotFocused) { … }
TEST_F(AutofillPopupControllerImplTest,
PopupDoesntHideOnWebContentsFocusLossIfViewIsFocused) { … }
TEST_F(AutofillPopupControllerImplTest,
PopupDoesntHideOnEndEditingFromRendererIfViewIsFocused) { … }
TEST_F(AutofillPopupControllerImplTest, EmitsVisibleDurationMetricsOnHide) { … }
TEST_F(AutofillPopupControllerImplTest,
DoesntEmitsVisibleDurationMetricsOnHideForSubPopups) { … }
TEST_F(AutofillPopupControllerImplTest,
RemoveAutocompleteSuggestion_IgnoresClickOutsideCheck) { … }
TEST_F(AutofillPopupControllerImplTest, HideInMainFrameOnZoomChange) { … }
TEST_F(AutofillPopupControllerImplTest,
SuggestionFiltration_NoFilteringByDefault) { … }
TEST_F(AutofillPopupControllerImplTest,
SuggestionFiltration_SuggestionChangeNotifications) { … }
TEST_F(AutofillPopupControllerImplTest, SuggestionFiltration_MatchingMainText) { … }
TEST_F(AutofillPopupControllerImplTest,
SuggestionFiltration_SuggestionIsDeletedFromFilteredList) { … }
TEST_F(AutofillPopupControllerImplTest,
SuggestionFiltration_StaticSuggestionsAreNotFilteredOut) { … }
TEST_F(AutofillPopupControllerImplTest,
SuggestionFiltration_HasFilteredOutSuggestions) { … }
TEST_F(
AutofillPopupControllerImplTest,
SuggestionFiltration_PresentOnlyWithoutFilterSuggestionsAlwaysFilteredOut) { … }
TEST_F(AutofillPopupControllerImplTest, RemoveSuggestion) { … }
TEST_F(AutofillPopupControllerImplTest,
RemoveAutocompleteSuggestion_AnnounceText) { … }
TEST_F(AutofillPopupControllerImplTest,
RemoveAutocompleteSuggestion_NoMetricsEmittedOnFail) { … }
TEST_F(AutofillPopupControllerImplTest,
RemoveAutocompleteSuggestion_MetricsEmittedOnSuccess) { … }
TEST_F(AutofillPopupControllerImplTest,
RemoveAddressSuggestion_NoMetricsEmittedOnFail) { … }
TEST_F(AutofillPopupControllerImplTest,
RemoveAddressSuggestion_MetricsEmittedOnSuccess) { … }
TEST_F(AutofillPopupControllerImplTest,
RemoveCreditCardSuggestion_NoMetricsEmitted) { … }
TEST_F(AutofillPopupControllerImplTest, UnselectingClearsPreview) { … }
#if !BUILDFLAG(IS_CHROMEOS_ASH)
namespace {
class MockAutofillDriver : public ContentAutofillDriver { … };
class AutofillPopupControllerForPopupAxTest
: public AutofillSuggestionControllerForTest { … };
class MockAxTreeManager : public ui::AXTreeManager { … };
class MockAxPlatformNodeDelegate : public ui::AXPlatformNodeDelegate { … };
class MockAxPlatformNode : public ui::AXPlatformNodeBase { … };
}
AutofillPopupControllerImplTestAccessibilityBase;
class AutofillPopupControllerImplTestAccessibility
: public AutofillPopupControllerImplTestAccessibilityBase { … };
TEST_F(AutofillPopupControllerImplTestAccessibility,
FireControlsChangedEventDuringShowAndHide) { … }
TEST_F(AutofillPopupControllerImplTestAccessibility,
FireControlsChangedEventNoAxPlatformNode) { … }
TEST_F(AutofillPopupControllerImplTestAccessibility,
FireControlsChangedEventNoPopupAxUniqueId) { … }
#endif
}