chromium/ui/base/interaction/element_tracker_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/base/interaction/element_tracker.h"

#include "base/functional/callback_forward.h"
#include "base/functional/callback_helpers.h"
#include "base/logging.h"
#include "base/test/bind.h"
#include "base/test/mock_callback.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/expect_call_in_scope.h"

namespace ui {

namespace  // namespace

TEST(TrackedElementTest, IsATest) {}

TEST(TrackedElementTest, AsATest) {}

TEST(ElementTrackerTest, GetUniqueElement) {}

TEST(ElementTrackerTest, GetFirstMatchingElement) {}

TEST(ElementTrackerTest, GetFirstMatchingElementWithMultipleElements) {}

TEST(ElementTrackerTest, GetAllMatchingElements) {}

TEST(ElementTrackerTest, GetAllMatchingElementsInAnyContext) {}

TEST(ElementTrackerTest, GetElementInAnyContext) {}

TEST(ElementTrackerTest, IsElementVisible) {}

TEST(ElementTrackerTest, AddElementShownCallback) {}

TEST(ElementTrackerTest, AddElementShownInAnyContextCallback) {}

TEST(ElementTrackerTest, AddElementActivatedCallback) {}

TEST(ElementTrackerTest, AddElementActivatedInAnyContextCallback) {}

TEST(ElementTrackerTest, AddElementHiddenCallback) {}

TEST(ElementTrackerTest, AddElementHiddenInAnyContextCallback) {}

TEST(ElementTrackerTest, AddCustomEventCallback) {}

TEST(ElementTrackerTest, AddCustomEventInAnyContextCallback) {}

TEST(ElementTrackerTest, AddClassCustomEventCallback) {}

TEST(ElementTrackerTest, MultipleCustomEventCallbacks) {}

TEST(ElementTrackerTest, CleanupAfterElementHidden) {}

TEST(ElementTrackerTest, CleanupAfterCallbacksRemoved) {}

// The following test specific conditions that could trigger a UAF or cause
// similar instability due to changing callback lists during callbacks. These
// tests may fail all or some builds (specifically asan/msan) if the logic is
// implemented incorrectly.

TEST(ElementTrackerTest, RemoveCallbackDuringRemove) {}

TEST(ElementTrackerTest, RemoveAndThenAddCallbackDuringRemove) {}

TEST(ElementTrackerTest, RemoveAndThenAddDifferentCallbackDuringRemove) {}

TEST(ElementTrackerTest, MultipleCallbacksForSameEvent) {}

TEST(ElementTrackerTest, HideDuringShowCallback) {}

// Regression test for a case where an element disappears in the middle of shown
// callbacks.
TEST(ElementTrackerTest, HideDuringShowCallbackMultipleListeners) {}

TEST(ElementTrackerTest, GetAllContextsForTesting) {}

TEST(ElementTrackerTest, GetAllElementsForTestingInAnyContext) {}

TEST(ElementTrackerTest, GetAllElementsForTestingInSpecificContexts) {}

TEST(SafeElementReferenceTest, ElementRemainsVisible) {}

TEST(SafeElementReferenceTest, ElementHidden) {}

TEST(SafeElementReferenceTest, MoveConstructor) {}

TEST(SafeElementReferenceTest, MoveOperator) {}

TEST(SafeElementReferenceTest, CopyConstructor) {}

TEST(SafeElementReferenceTest, CopyOperator) {}

class ElementTrackerIdentifierTest : public testing::Test {};

TEST_F(ElementTrackerIdentifierTest, ShowElementRegistersIdentifier) {}

TEST_F(ElementTrackerIdentifierTest, AddListenerRegistersIdentifier) {}

}  // namespace ui