#include "chrome/browser/ui/views/autofill/popup/popup_row_view.h"
#include <memory>
#include <optional>
#include <utility>
#include "base/functional/callback.h"
#include "base/i18n/rtl.h"
#include "base/memory/raw_ptr.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/mock_callback.h"
#include "base/test/scoped_feature_list.h"
#include "chrome/browser/ui/autofill/mock_autofill_popup_controller.h"
#include "chrome/browser/ui/views/autofill/popup/mock_accessibility_selection_delegate.h"
#include "chrome/browser/ui/views/autofill/popup/mock_selection_delegate.h"
#include "chrome/browser/ui/views/autofill/popup/popup_row_content_view.h"
#include "chrome/browser/ui/views/autofill/popup/popup_row_factory_utils.h"
#include "chrome/browser/ui/views/autofill/popup/popup_view_utils.h"
#include "chrome/test/base/testing_profile.h"
#include "chrome/test/views/chrome_views_test_base.h"
#include "components/autofill/core/browser/ui/suggestion.h"
#include "components/autofill/core/browser/ui/suggestion_type.h"
#include "components/autofill/core/common/autofill_features.h"
#include "components/input/native_web_keyboard_event.h"
#include "content/public/browser/web_contents.h"
#include "content/public/test/test_renderer_host.h"
#include "content/public/test/web_contents_tester.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/common/input/web_input_event.h"
#include "third_party/blink/public/common/input/web_keyboard_event.h"
#include "ui/accessibility/ax_enums.mojom-shared.h"
#include "ui/compositor/canvas_painter.h"
#include "ui/events/base_event_utils.h"
#include "ui/events/keycodes/keyboard_codes.h"
#include "ui/events/test/event_generator.h"
#include "ui/gfx/geometry/point.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/views/accessibility/view_accessibility.h"
#include "ui/views/controls/label.h"
#include "ui/views/widget/widget.h"
#include "ui/views/widget/widget_utils.h"
namespace autofill {
namespace {
_;
NiceMock;
Ref;
Return;
StrictMock;
CellType;
CellIndex;
constexpr gfx::Point kOutOfBounds{ … };
}
class PopupRowViewTest : public ChromeViewsTestBase { … };
TEST_F(PopupRowViewTest, MouseEnterExitInformsSelectionDelegate) { … }
#if !BUILDFLAG(IS_MAC)
TEST_F(PopupRowViewTest, GestureEvents) { … }
TEST_F(PopupRowViewTest, NoCrashOnGestureAcceptingWithInvalidatedController) { … }
#endif
TEST_F(PopupRowViewTest, SetSelectedCellVerifiesArgumentsNoControl) { … }
TEST_F(PopupRowViewTest, SetSelectedCellVerifiesArgumentsWithControl) { … }
TEST_F(PopupRowViewTest, SetSelectedCellTriggersController) { … }
TEST_F(PopupRowViewTest, NotifyAXSelectionCalledOnChangesOnly) { … }
TEST_F(PopupRowViewTest, ReturnKeyEventsAreHandled) { … }
class PopupRowSuggestionAcceptanceWithModifiers
: public PopupRowViewTest,
public ::testing::WithParamInterface< int> { … };
TEST_P(PopupRowSuggestionAcceptanceWithModifiers, All) { … }
INSTANTIATE_TEST_SUITE_P(…);
TEST_F(PopupRowViewTest,
ShouldIgnoreMouseObservedOutsideItemBoundsCheckIsFalse_IgnoreClick) { … }
TEST_F(PopupRowViewTest,
ShouldIgnoreMouseObservedOutsideItemBoundsCheckIsTrue_DoNotIgnoreClick) { … }
TEST_F(PopupRowViewTest, NoCrashOnMouseAcceptingWithInvalidatedController) { … }
TEST_F(PopupRowViewTest, SelectSuggestionOnFocusedContent) { … }
TEST_F(PopupRowViewTest, ContentViewA11yAttributes) { … }
TEST_F(PopupRowViewTest, AccessibleProperties) { … }
TEST_F(PopupRowViewTest, ExpandChildSuggestionsIconRemainsVisible) { … }
class PopupRowViewExpandControlVisibilityExperimentArmTest
: public PopupRowViewTest { … };
TEST_F(PopupRowViewExpandControlVisibilityExperimentArmTest,
ExpandChildSuggestionsIconVisibleDependsOnSelectedCell) { … }
class PopupRowExpandVisibilityNonEligibleSuggestionsTest
: public PopupRowViewExpandControlVisibilityExperimentArmTest,
public ::testing::WithParamInterface<SuggestionType> { … };
TEST_P(PopupRowExpandVisibilityNonEligibleSuggestionsTest, All) { … }
INSTANTIATE_TEST_SUITE_P(…);
struct PosInSetTestdata { … };
const PosInSetTestdata kPosInSetTestcases[] = …;
class PopupRowPosInSetViewTest
: public PopupRowViewTest,
public ::testing::WithParamInterface<PosInSetTestdata> { … };
TEST_P(PopupRowPosInSetViewTest, All) { … }
INSTANTIATE_TEST_SUITE_P(…);
class PopupRowViewAcceptGuardEnabledTest : public PopupRowViewTest { … };
TEST_F(PopupRowViewAcceptGuardEnabledTest,
NoQuickSuggestionAccepting_ReturnKeyPress) { … }
TEST_F(PopupRowViewAcceptGuardEnabledTest,
NoQuickSuggestionAccepting_LeftClick) { … }
#if !BUILDFLAG(IS_MAC)
TEST_F(PopupRowViewAcceptGuardEnabledTest,
NoQuickSuggestionAccepting_GestureEvents) { … }
#endif
TEST_F(PopupRowViewAcceptGuardEnabledTest,
SuggestionIsAcceptedIfVisibleLongEnough) { … }
}