chromium/ui/views/window/dialog_delegate_unittest.cc

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

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

}  // namespace

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) {}

// Unlike the previous two tests, this test simulates a key press at the level
// of the dialog's Widget, so the return-to-close-dialog behavior does happen.
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) {}

// Tests default focus is assigned correctly when showing a new dialog.
TEST_F(DialogTest, InitialFocus) {}

// A dialog for testing initial focus with only an OK button.
class InitialFocusTestDialog : public DialogDelegateView {};

// If the Widget can't be activated while the initial focus View is requesting
// focus, test it is still able to receive focus once the Widget is activated.
TEST_F(DialogTest, InitialFocusWithDeactivatedWidget) {}

// If the initially focused View provided is unfocusable, check the next
// available focusable View is focused.
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) {}

}  // namespace views