#include "ui/views/window/dialog_delegate.h"
#include <stddef.h>
#include "base/functional/callback.h"
#include "base/memory/raw_ptr.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/bind.h"
#include "build/build_config.h"
#include "ui/base/hit_test.h"
#include "ui/base/mojom/dialog_button.mojom.h"
#include "ui/events/event_processor.h"
#include "ui/views/bubble/bubble_border.h"
#include "ui/views/bubble/bubble_frame_view.h"
#include "ui/views/controls/button/checkbox.h"
#include "ui/views/controls/button/label_button.h"
#include "ui/views/controls/textfield/textfield.h"
#include "ui/views/style/platform_style.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/widget/widget.h"
#if BUILDFLAG(IS_MAC)
#include "ui/base/test/scoped_fake_full_keyboard_access.h"
#endif
namespace views {
namespace {
class TestDialog : public DialogDelegateView { … };
class DialogTest : public ViewsTestBase { … };
}
TEST_F(DialogTest, InputIsInitiallyFocused) { … }
TEST_F(DialogTest, OkButtonAccepts) { … }
TEST_F(DialogTest, EscButtonClosesDialogWithCloseButtonWithoutCallingCancel) { … }
TEST_F(DialogTest, EscButtonClosesWithCloseCallback) { … }
TEST_F(DialogTest, EscButtonCancelsWithoutCloseAction) { … }
TEST_F(DialogTest, ReturnDirectedToOkButtonPlatformStyle) { … }
TEST_F(DialogTest, ReturnDirectedToCancelButtonPlatformBehavior) { … }
TEST_F(DialogTest, ReturnOnCancelButtonPlatformBehavior) { … }
TEST_F(DialogTest, CanOverrideEsc) { … }
TEST_F(DialogTest, RemoveDefaultButton) { … }
TEST_F(DialogTest, HitTest_HiddenTitle) { … }
TEST_F(DialogTest, HitTest_HiddenTitleNoCloseButton) { … }
TEST_F(DialogTest, HitTest_WithTitle) { … }
TEST_F(DialogTest, HitTest_CloseButton) { … }
TEST_F(DialogTest, BoundsAccommodateTitle) { … }
TEST_F(DialogTest, ActualBoundsMatchPreferredBounds) { … }
TEST_F(DialogTest, InitialFocus) { … }
class InitialFocusTestDialog : public DialogDelegateView { … };
TEST_F(DialogTest, InitialFocusWithDeactivatedWidget) { … }
TEST_F(DialogTest, UnfocusableInitialFocus) { … }
TEST_F(DialogTest, ButtonEnableUpdatesState) { … }
DialogDelegateCloseTest;
TEST_F(DialogDelegateCloseTest, AnyCallbackInhibitsDefaultClose) { … }
TEST_F(DialogDelegateCloseTest,
RecursiveCloseFromAcceptCallbackDoesNotTriggerSecondCallback) { … }
class TestDialogDelegateView : public DialogDelegateView { … };
TEST_F(DialogDelegateCloseTest, OldClosePathDoesNotDoubleClose) { … }
TEST_F(DialogDelegateCloseTest, CloseParentWidgetDoesNotInvokeCloseCallback) { … }
TEST_F(DialogTest, AcceptCallbackWithCloseDoesNotClose) { … }
TEST_F(DialogTest, AcceptCallbackWithCloseDoesClose) { … }
TEST_F(DialogTest, CancelCallbackWithCloseDoesNotClose) { … }
TEST_F(DialogTest, CancelCallbackWithCloseDoesClose) { … }
}