chromium/ui/views/interaction/interaction_sequence_views_unittest.cc

// Copyright 2021 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/interaction/interaction_sequence_views.h"

// This suite contains tests which integrate the functionality of
// ui::InteractionSequence with Views elements like Widgets and buttons.
// Similar suites should be created for other platforms.

#include <memory>
#include <utility>

#include "base/functional/bind.h"
#include "base/memory/raw_ptr.h"
#include "base/test/bind.h"
#include "base/test/mock_callback.h"
#include "build/build_config.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/base/interaction/element_tracker.h"
#include "ui/base/interaction/expect_call_in_scope.h"
#include "ui/base/interaction/interaction_sequence.h"
#include "ui/base/interaction/interaction_sequence_test_util.h"
#include "ui/base/interaction/interaction_test_util.h"
#include "ui/base/ui_base_types.h"
#include "ui/events/base_event_utils.h"
#include "ui/events/event.h"
#include "ui/events/test/event_generator.h"
#include "ui/events/types/event_type.h"
#include "ui/views/bubble/bubble_dialog_delegate_view.h"
#include "ui/views/controls/button/label_button.h"
#include "ui/views/interaction/element_tracker_views.h"
#include "ui/views/interaction/interaction_test_util_views.h"
#include "ui/views/layout/flex_layout.h"
#include "ui/views/layout/flex_layout_types.h"
#include "ui/views/layout/layout_types.h"
#include "ui/views/test/views_test_base.h"
#include "ui/views/test/widget_test.h"
#include "ui/views/view.h"
#include "ui/views/view_class_properties.h"
#include "ui/views/widget/widget.h"

namespace views {

namespace {

DEFINE_LOCAL_ELEMENT_IDENTIFIER_VALUE();
DEFINE_LOCAL_ELEMENT_IDENTIFIER_VALUE();
DEFINE_LOCAL_ELEMENT_IDENTIFIER_VALUE();
DEFINE_LOCAL_ELEMENT_IDENTIFIER_VALUE();
const char kElementName[] =;

}  // namespace

class InteractionSequenceViewsTest
    : public ViewsTestBase,
      public testing::WithParamInterface<
          ui::InteractionSequence::StepStartMode> {};

INSTANTIATE_TEST_SUITE_P();

TEST_P(InteractionSequenceViewsTest, DestructWithInitialViewAborts) {}

TEST_P(InteractionSequenceViewsTest, DestructWithInitialViewBeforeStartAborts) {}

TEST_P(InteractionSequenceViewsTest, WrongWithInitialViewDoesNotStartSequence) {}

TEST_P(InteractionSequenceViewsTest,
       SequenceNotCanceledDueToViewDestroyedIfRequirementChanged) {}

// The tests are failing on debug swiftshader on arm64, see
// https://ci.chromium.org/ui/p/chromium/builders/ci/fuchsia-fyi-arm64-dbg/9234/overview
// TODO(crbug.com/42050042): Re-enable the tests once we get rid of swiftshader.
#if BUILDFLAG(IS_FUCHSIA) && !defined(NDEBUG) && defined(ARCH_CPU_ARM64)
#define MAYBE_TransitionToBubble
#else
#define MAYBE_TransitionToBubble
#endif
TEST_P(InteractionSequenceViewsTest, MAYBE_TransitionToBubble) {}

// The tests are failing on debug swiftshader on arm64, see
// https://ci.chromium.org/ui/p/chromium/builders/ci/fuchsia-fyi-arm64-dbg/9234/overview
// TODO(crbug.com/42050042): Re-enable the tests once we get rid of swiftshader.
#if BUILDFLAG(IS_FUCHSIA) && !defined(NDEBUG) && defined(ARCH_CPU_ARM64)
#define MAYBE_TransitionToBubbleThenAbort
#else
#define MAYBE_TransitionToBubbleThenAbort
#endif
TEST_P(InteractionSequenceViewsTest, MAYBE_TransitionToBubbleThenAbort) {}

// NameView tests:

// The tests are failing on debug swiftshader on arm64, see
// https://ci.chromium.org/ui/p/chromium/builders/ci/fuchsia-fyi-arm64-dbg/9234/overview
// TODO(crbug.com/42050042): Re-enable the tests once we get rid of swiftshader.
#if BUILDFLAG(IS_FUCHSIA) && !defined(NDEBUG) && defined(ARCH_CPU_ARM64)
#define MAYBE_NameView_NameViewWithIdentifier
#else
#define MAYBE_NameView_NameViewWithIdentifier
#endif
TEST_P(InteractionSequenceViewsTest, MAYBE_NameView_NameViewWithIdentifier) {}

// The tests are failing on debug swiftshader on arm64, see
// https://ci.chromium.org/ui/p/chromium/builders/ci/fuchsia-fyi-arm64-dbg/9234/overview
// TODO(crbug.com/42050042): Re-enable the tests once we get rid of swiftshader.
#if BUILDFLAG(IS_FUCHSIA) && !defined(NDEBUG) && defined(ARCH_CPU_ARM64)
#define MAYBE_NameView_NameViewWithNoIdentifier
#else
#define MAYBE_NameView_NameViewWithNoIdentifier
#endif
TEST_P(InteractionSequenceViewsTest, MAYBE_NameView_NameViewWithNoIdentifier) {}

}  // namespace views