#include "ui/views/interaction/element_tracker_views.h"
#include <iterator>
#include <memory>
#include <utility>
#include "base/functional/bind.h"
#include "base/memory/raw_ptr.h"
#include "base/ranges/algorithm.h"
#include "base/test/bind.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/base/interaction/element_identifier.h"
#include "ui/base/interaction/element_test_util.h"
#include "ui/base/interaction/element_tracker.h"
#include "ui/base/metadata/metadata_header_macros.h"
#include "ui/base/metadata/metadata_impl_macros.h"
#include "ui/events/base_event_utils.h"
#include "ui/events/event.h"
#include "ui/events/keycodes/dom/dom_code.h"
#include "ui/events/types/event_type.h"
#include "ui/views/controls/button/label_button.h"
#include "ui/views/controls/button/menu_button.h"
#include "ui/views/interaction/interaction_test_util_views.h"
#include "ui/views/test/views_test_base.h"
#include "ui/views/test/widget_test.h"
#include "ui/views/view_class_properties.h"
#include "ui/views/widget/widget.h"
namespace views {
DEFINE_LOCAL_ELEMENT_IDENTIFIER_VALUE(…);
DEFINE_LOCAL_ELEMENT_IDENTIFIER_VALUE(…);
DECLARE_CUSTOM_ELEMENT_EVENT_TYPE(…);
DEFINE_CUSTOM_ELEMENT_EVENT_TYPE(kCustomEventType);
namespace {
enum ElementEventType { … };
View* ElementToView(ui::TrackedElement* element) { … }
class TypedView : public View { … };
BEGIN_METADATA(…)
class ElementEventWatcher { … };
ElementTrackerViews::ViewList ElementsToViews(
ui::ElementTracker::ElementList elements) { … }
}
class ElementTrackerViewsTest : public ViewsTestBase { … };
TEST_F(ElementTrackerViewsTest, ViewShownByAddingToWidgetSendsNotification) { … }
TEST_F(ElementTrackerViewsTest,
ViewHiddenByRemovingFromWidgetSendsNotification) { … }
TEST_F(ElementTrackerViewsTest, ViewShownAfterAddingToWidgetSendsNotification) { … }
TEST_F(ElementTrackerViewsTest,
ViewHiddenAfterAddingToWidgetSendsNotification) { … }
TEST_F(ElementTrackerViewsTest, SettingIDOnVisibleViewSendsNotification) { … }
TEST_F(ElementTrackerViewsTest, ClearingIDOnVisibleViewSendsNotification) { … }
TEST_F(ElementTrackerViewsTest, ChangingIDOnVisibleViewSendsNotification) { … }
TEST_F(ElementTrackerViewsTest, ButtonPressedSendsActivatedSignal) { … }
TEST_F(ElementTrackerViewsTest, MenuButtonPressedSendsActivatedSignal) { … }
TEST_F(ElementTrackerViewsTest, SendCustomEventWithNamedElement) { … }
TEST_F(ElementTrackerViewsTest, SendCustomEventWithUnnamedElement) { … }
TEST_F(ElementTrackerViewsTest, HandlesCreateWithTheSameIDMultipleTimes) { … }
TEST_F(ElementTrackerViewsTest, HandlesReshowingTheSameView) { … }
TEST_F(ElementTrackerViewsTest, CanLookupViewByIdentifier) { … }
TEST_F(ElementTrackerViewsTest, CanLookUpElementByIdentifier) { … }
TEST_F(ElementTrackerViewsTest, CanGetFirstViewByIdentifier) { … }
TEST_F(ElementTrackerViewsTest, CanGetFirstElementByIdentifier) { … }
TEST_F(ElementTrackerViewsTest, CanGetAllViewsByIdentifier) { … }
TEST_F(ElementTrackerViewsTest, CanGetAllElementsByIdentifier) { … }
TEST_F(ElementTrackerViewsTest, CanGetVisibilityByIdentifier) { … }
TEST_F(ElementTrackerViewsTest, CanLookupElementByView) { … }
TEST_F(ElementTrackerViewsTest, AssignTemporaryId) { … }
TEST_F(ElementTrackerViewsTest, ParentNotVisibleWhenAddedToWidget) { … }
TEST_F(ElementTrackerViewsTest, WidgetNotVisibleWhenAddedToWidget) { … }
TEST_F(ElementTrackerViewsTest, ParentHidden) { … }
TEST_F(ElementTrackerViewsTest, WidgetHidden) { … }
TEST_F(ElementTrackerViewsTest, WidgetClosed) { … }
TEST_F(ElementTrackerViewsTest, WidgetDestroyed) { … }
TEST_F(ElementTrackerViewsTest, WidgetShownAfterAdd) { … }
TEST_F(ElementTrackerViewsTest, AddedDuringWidgetShow) { … }
TEST_F(ElementTrackerViewsTest, CleansUpWidgetTrackers) { … }
TEST_F(ElementTrackerViewsTest, GetUniqueView) { … }
TEST_F(ElementTrackerViewsTest, GetUniqueViewAs) { … }
TEST_F(ElementTrackerViewsTest, GetFirstMatchingViewWithSingleView) { … }
TEST_F(ElementTrackerViewsTest, GetFirstMatchingViewAs) { … }
TEST_F(ElementTrackerViewsTest, GetFirstMatchingViewWithMultipleViews) { … }
TEST_F(ElementTrackerViewsTest, GetFirstMatchingViewWithNonViewsElements) { … }
TEST_F(ElementTrackerViewsTest, GetAllMatchingViewsWithSingleView) { … }
TEST_F(ElementTrackerViewsTest, GetAllMatchingViewsWithMultipleViews) { … }
TEST_F(ElementTrackerViewsTest, GetAllMatchingViewsWithNonViewsElements) { … }
TEST_F(ElementTrackerViewsTest, GetAllViewsInAnyContextWithSingleView) { … }
TEST_F(ElementTrackerViewsTest, GetAllViewsInAnyContextWithMultipleViews) { … }
TEST_F(ElementTrackerViewsTest, GetAllViewsInAnyContextWithNonViewsElements) { … }
class ElementTrackerTwoWidgetTest : public ElementTrackerViewsTest { … };
TEST_F(ElementTrackerTwoWidgetTest, ViewMovedToDifferentWidgetGeneratesEvents) { … }
TEST_F(ElementTrackerTwoWidgetTest, CanLookUpViewsOnMultipleWidgets) { … }
TEST_F(ElementTrackerTwoWidgetTest,
MakingViewsVisibleSendsNotificationsToCorrectListeners) { … }
TEST_F(ElementTrackerTwoWidgetTest,
ButtonPressedSendsNotificationsToCorrectListeners) { … }
TEST_F(ElementTrackerTwoWidgetTest, OverrideContextCallbackCollapsesContexts) { … }
TEST_F(ElementTrackerTwoWidgetTest,
OverrideContextCallbackOverridesContextSelectively) { … }
}