#include "ui/views/bubble/bubble_dialog_delegate_view.h"
#include <stddef.h>
#include <memory>
#include <string>
#include <utility>
#include "base/i18n/rtl.h"
#include "base/memory/ptr_util.h"
#include "base/memory/raw_ptr.h"
#include "base/metrics/histogram_functions.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/scoped_feature_list.h"
#include "build/build_config.h"
#include "ui/base/hit_test.h"
#include "ui/base/metadata/metadata_header_macros.h"
#include "ui/base/metadata/metadata_impl_macros.h"
#include "ui/base/mojom/dialog_button.mojom.h"
#include "ui/base/ui_base_features.h"
#include "ui/compositor/compositor.h"
#include "ui/display/test/test_screen.h"
#include "ui/events/event_utils.h"
#include "ui/views/animation/ink_drop.h"
#include "ui/views/animation/test/ink_drop_host_test_api.h"
#include "ui/views/animation/test/test_ink_drop.h"
#include "ui/views/bubble/bubble_frame_view.h"
#include "ui/views/controls/button/button.h"
#include "ui/views/controls/button/label_button.h"
#include "ui/views/controls/styled_label.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/test_views.h"
#include "ui/views/test/test_widget_observer.h"
#include "ui/views/test/views_test_base.h"
#include "ui/views/test/views_test_utils.h"
#include "ui/views/test/widget_test.h"
#include "ui/views/view_class_properties.h"
#include "ui/views/widget/widget.h"
#include "ui/views/widget/widget_observer.h"
#if BUILDFLAG(IS_OZONE)
#include "ui/ozone/public/ozone_platform.h"
#endif
namespace views {
TestInkDrop;
namespace {
constexpr gfx::Size kContentSize = …;
class TestBubbleDialogDelegateView : public BubbleDialogDelegateView { … };
BEGIN_METADATA(…)
class TestAlertBubbleDialogDelegateView : public TestBubbleDialogDelegateView { … };
BEGIN_METADATA(…)
class WidgetWithNonNullThemeProvider : public Widget { … };
class BubbleDialogDelegateViewTest : public ViewsTestBase { … };
class BubbleUmaLoggerTest : public ViewsTestBase { … };
}
TEST_F(BubbleDialogDelegateViewTest, CreateDelegate) { … }
TEST_F(BubbleDialogDelegateViewTest, CloseAnchorWidget) { … }
TEST_F(BubbleDialogDelegateViewTest, CloseAnchorViewTest) { … }
TEST_F(BubbleDialogDelegateViewTest, TestAnchorRectMovesWithViewTest) { … }
TEST_F(BubbleDialogDelegateViewTest, ResetAnchorWidget) { … }
TEST_F(BubbleDialogDelegateViewTest, MultipleBubbleAnchorHighlightTestInOrder) { … }
TEST_F(BubbleDialogDelegateViewTest,
MultipleBubbleAnchorHighlightTestOutOfOrder) { … }
TEST_F(BubbleDialogDelegateViewTest, NoParentWidget) { … }
TEST_F(BubbleDialogDelegateViewTest, InitiallyFocusedView) { … }
TEST_F(BubbleDialogDelegateViewTest, NonClientHitTest) { … }
TEST_F(BubbleDialogDelegateViewTest, VisibleWhenAnchorWidgetBoundsChanged) { … }
TEST_F(BubbleDialogDelegateViewTest, GetPrimaryWindowWidget) { … }
TEST_F(BubbleDialogDelegateViewTest, NotActivatable) { … }
TEST_F(BubbleDialogDelegateViewTest, CloseMethods) { … }
TEST_F(BubbleDialogDelegateViewTest, PinBlocksCloseOnDeactivate) { … }
TEST_F(BubbleDialogDelegateViewTest, CloseOnDeactivatePinCanOutliveBubble) { … }
TEST_F(BubbleDialogDelegateViewTest, MultipleCloseOnDeactivatePins) { … }
TEST_F(BubbleDialogDelegateViewTest, CustomTitle) { … }
TEST_F(BubbleDialogDelegateViewTest, StyledLabelTitle) { … }
TEST_F(BubbleDialogDelegateViewTest, AttachedWidgetShowsInkDropWhenVisible) { … }
TEST_F(BubbleDialogDelegateViewTest, VisibleWidgetShowsInkDropOnAttaching) { … }
TEST_F(BubbleDialogDelegateViewTest, VisibleAnchorChanges) { … }
TEST_F(BubbleDialogDelegateViewTest, GetThemeProvider_FromAnchorWidget) { … }
const int kScreenWidth = …;
const int kScreenHeight = …;
struct ArrowTestParameters { … };
class BubbleDialogDelegateViewArrowTest
: public BubbleDialogDelegateViewTest,
public testing::WithParamInterface<ArrowTestParameters> { … };
TEST_P(BubbleDialogDelegateViewArrowTest, AvailableScreenSpaceTest) { … }
const int kAnchorFarRightX = …;
const int kAnchorFarLeftX = …;
const int kAnchorFarTopY = …;
const int kAnchorFarBottomY = …;
const int kAnchorLength = …;
const ArrowTestParameters kAnchorAtFarScreenCornersParams[] = …;
INSTANTIATE_TEST_SUITE_P(…);
TEST_F(BubbleDialogDelegateViewTest, WithClientLayerTest) { … }
TEST_F(BubbleDialogDelegateViewTest, WithoutClientLayerTest) { … }
TEST_F(BubbleDialogDelegateViewTest, AlertAccessibleEvent) { … }
namespace {
class AnchorTestBubbleDialogDelegateView : public BubbleDialogDelegateView { … };
class BubbleDialogDelegateViewAnchorTest : public test::WidgetTest { … };
}
TEST_F(BubbleDialogDelegateViewAnchorTest,
AnchoredToWidgetShouldPaintAsActive) { … }
TEST_F(BubbleDialogDelegateViewAnchorTest,
AnchoredToWidgetBecomesActiveWhenBubbleIsShown) { … }
TEST_F(BubbleDialogDelegateViewAnchorTest,
ActiveStatePersistsAcrossAnchorWidgetAndBubbleActivation) { … }
TEST_F(BubbleDialogDelegateViewAnchorTest,
AnchoringAlreadyActiveBubbleChangesAnchorWidgetState) { … }
TEST_F(BubbleDialogDelegateViewAnchorTest,
ActivationPassesToRemainingWidgetOnBubbleClose) { … }
TEST_F(BubbleDialogDelegateViewAnchorTest,
ActivationPassesToOtherWidgetOnReanchor) { … }
TEST_F(BubbleDialogDelegateViewAnchorTest,
ActivationPassesAcrossChainOfAnchoredBubbles) { … }
TEST_F(BubbleDialogDelegateViewAnchorTest,
DestroyingAnchoredToWidgetDoesNotCrash) { … }
TEST_F(BubbleDialogDelegateViewAnchorTest,
DestroyingMiddleWidgetOfAnchorChainDoesNotCrash) { … }
TEST_F(BubbleDialogDelegateViewAnchorTest, WidgetForAnchoring) { … }
TEST_F(BubbleDialogDelegateViewTest, BubbleMetrics) { … }
class TestBubbleUmaLogger : public BubbleDialogDelegate::BubbleUmaLogger { … };
TEST_F(BubbleUmaLoggerTest, LogMetricFromView) { … }
TEST_F(BubbleUmaLoggerTest, LogMetricFromDelegate) { … }
TEST_F(BubbleUmaLoggerTest, DoNotLogMetricNotFromAllowedClasses) { … }
}