chromium/chrome/browser/ui/views/autofill/popup/popup_row_view_unittest.cc

// Copyright 2023 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#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{};

}  // namespace

class PopupRowViewTest : public ChromeViewsTestBase {};

TEST_F(PopupRowViewTest, MouseEnterExitInformsSelectionDelegate) {}

// Gestures are not supported on MacOS.
#if !BUILDFLAG(IS_MAC)
TEST_F(PopupRowViewTest, GestureEvents) {}

TEST_F(PopupRowViewTest, NoCrashOnGestureAcceptingWithInvalidatedController) {}
#endif  // !BUILDFLAG(IS_MAC)

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</*modifiers*/ 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) {}

// Gestures are not supported on MacOS.
#if !BUILDFLAG(IS_MAC)
TEST_F(PopupRowViewAcceptGuardEnabledTest,
       NoQuickSuggestionAccepting_GestureEvents) {}
#endif  // !BUILDFLAG(IS_MAC)

TEST_F(PopupRowViewAcceptGuardEnabledTest,
       SuggestionIsAcceptedIfVisibleLongEnough) {}

}  // namespace autofill