#include "ui/views/controls/button/button.h"
#include <memory>
#include <string>
#include <utility>
#include "base/functional/bind.h"
#include "base/memory/ptr_util.h"
#include "base/memory/raw_ptr.h"
#include "base/run_loop.h"
#include "build/build_config.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/accessibility/ax_enums.mojom.h"
#include "ui/accessibility/ax_node_data.h"
#include "ui/actions/actions.h"
#include "ui/base/metadata/metadata_header_macros.h"
#include "ui/base/metadata/metadata_impl_macros.h"
#include "ui/display/screen.h"
#include "ui/events/base_event_utils.h"
#include "ui/events/event.h"
#include "ui/events/event_utils.h"
#include "ui/events/test/event_generator.h"
#include "ui/events/types/event_type.h"
#include "ui/gfx/geometry/point.h"
#include "ui/views/accessibility/view_accessibility.h"
#include "ui/views/animation/ink_drop_host.h"
#include "ui/views/animation/ink_drop_impl.h"
#include "ui/views/animation/test/ink_drop_host_test_api.h"
#include "ui/views/animation/test/test_ink_drop.h"
#include "ui/views/animation/test/test_ink_drop_host.h"
#include "ui/views/context_menu_controller.h"
#include "ui/views/controls/button/button_controller.h"
#include "ui/views/controls/button/checkbox.h"
#include "ui/views/controls/button/image_button.h"
#include "ui/views/controls/button/label_button.h"
#include "ui/views/controls/button/menu_button.h"
#include "ui/views/controls/button/radio_button.h"
#include "ui/views/controls/button/toggle_button.h"
#include "ui/views/controls/link.h"
#include "ui/views/controls/textfield/textfield.h"
#include "ui/views/style/platform_style.h"
#include "ui/views/test/ax_event_counter.h"
#include "ui/views/test/button_test_api.h"
#include "ui/views/test/view_metadata_test_utils.h"
#include "ui/views/test/views_test_base.h"
#include "ui/views/widget/widget_utils.h"
#if defined(USE_AURA)
#include "ui/aura/test/test_cursor_client.h"
#include "ui/aura/window.h"
#include "ui/aura/window_event_dispatcher.h"
#endif
namespace views {
InkDropHostTestApi;
TestInkDrop;
namespace {
class TestContextMenuController : public ContextMenuController { … };
class TestButton : public Button { … };
BEGIN_METADATA(…)
class TestButtonObserver { … };
TestInkDrop* AddTestInkDrop(TestButton* button) { … }
}
class ButtonTest : public ViewsTestBase { … };
TEST_F(ButtonTest, MetadataTest) { … }
TEST_F(ButtonTest, HoverStateOnVisibilityChange) { … }
TEST_F(ButtonTest, HoverStatePreservedOnDescendantViewHierarchyChange) { … }
TEST_F(ButtonTest, AccessibleHoveredStateUpdatesCorrectly) { … }
TEST_F(ButtonTest, NotifyAction) { … }
TEST_F(ButtonTest, NotifyActionNoClick) { … }
TEST_F(ButtonTest, ButtonControllerNotifyClick) { … }
#if !BUILDFLAG(IS_MAC) || defined(USE_AURA)
namespace {
void PerformGesture(Button* button, ui::EventType event_type) { … }
}
TEST_F(ButtonTest, GestureEventsSetState) { … }
TEST_F(ButtonTest, GestureEventsRespectDisabledState) { … }
#endif
TEST_F(ButtonTest, AsButton) { … }
TEST_F(ButtonTest, ButtonClickTogglesInkDrop) { … }
TEST_F(ButtonTest, CaptureLossHidesInkDrop) { … }
TEST_F(ButtonTest, HideInkDropWhenShowingContextMenu) { … }
TEST_F(ButtonTest, DontHideInkDropWhenShowingContextMenu) { … }
TEST_F(ButtonTest, HideInkDropOnBlur) { … }
TEST_F(ButtonTest, HideInkDropHighlightOnDisable) { … }
TEST_F(ButtonTest, InkDropAfterTryingToShowContextMenu) { … }
TEST_F(ButtonTest, HideInkDropHighlightWhenRemoved) { … }
TEST_F(ButtonTest, InkDropShowHideOnMouseDraggedNotifyOnRelease) { … }
TEST_F(ButtonTest, InkDropShowHideOnMouseDraggedNotifyOnPress) { … }
TEST_F(ButtonTest, InkDropStaysHiddenWhileDragging) { … }
TEST_F(ButtonTest, SetCallback) { … }
class VisibilityTestButton : public TestButton { … };
TEST_F(ButtonTest, NoLayerAddedForWidgetVisibilityChanges) { … }
TEST_F(ButtonTest, ActionOnSpace) { … }
TEST_F(ButtonTest, ActionOnReturn) { … }
TEST_F(ButtonTest, CustomActionOnKeyPressedEvent) { … }
TEST_F(ButtonTest, ChangingHighlightStateNotifiesCallback) { … }
TEST_F(ButtonTest, ClickingButtonNotifiesObserverOfStateChanges) { … }
TEST_F(ButtonTest, SetStateNotifiesObserver) { … }
TEST_F(ButtonTest, SetTooltipTextNotifiesAccessibilityEvent) { … }
TEST_F(ButtonTest, AccessibleRole) { … }
TEST_F(ButtonTest, AccessibleDefaultActionVerb) { … }
TEST_F(ButtonTest, AnchorHighlightSetsHiglight) { … }
TEST_F(ButtonTest, AnchorHighlightDestructionClearsHighlight) { … }
TEST_F(ButtonTest, NestedAnchorHighlights) { … }
TEST_F(ButtonTest, OverlappingAnchorHighlights) { … }
TEST_F(ButtonTest, AnchorHighlightsCanOutliveButton) { … }
ButtonActionViewInterfaceTest;
TEST_F(ButtonActionViewInterfaceTest, TestActionChanged) { … }
TEST_F(ButtonActionViewInterfaceTest, TestActionTriggered) { … }
}