#ifndef UI_VIEWS_INTERACTION_INTERACTIVE_VIEWS_TEST_H_
#define UI_VIEWS_INTERACTION_INTERACTIVE_VIEWS_TEST_H_
#include <functional>
#include <memory>
#include <string>
#include <string_view>
#include <type_traits>
#include <utility>
#include <variant>
#include "base/callback_list.h"
#include "base/functional/callback.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/strings/stringprintf.h"
#include "base/test/bind.h"
#include "base/time/time.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_tracker.h"
#include "ui/base/interaction/interactive_test.h"
#include "ui/base/interaction/interactive_test_internal.h"
#include "ui/base/metadata/metadata_types.h"
#include "ui/views/interaction/element_tracker_views.h"
#include "ui/views/interaction/interaction_test_util_mouse.h"
#include "ui/views/interaction/interactive_views_test_internal.h"
#include "ui/views/interaction/polling_view_observer.h"
#include "ui/views/test/views_test_base.h"
#include "ui/views/view.h"
#include "ui/views/view_utils.h"
namespace views::test {
class InteractiveViewsTestApi : public ui::test::InteractiveTestApi { … };
template <typename T>
class InteractiveViewsTestT : public T, public InteractiveViewsTestApi { … };
InteractiveViewsTest;
template <class T>
T* InteractiveViewsTestApi::AsView(ui::TrackedElement* el) { … }
template <class T>
const T* InteractiveViewsTestApi::AsView(const ui::TrackedElement* el) { … }
template <typename... Args>
bool InteractiveViewsTestApi::RunTestSequence(Args&&... steps) { … }
template <typename C, typename V, typename R>
requires ui::test::internal::HasSignature<C, R*(V*)>
ui::InteractionSequence::StepBuilder InteractiveViewsTestApi::NameViewRelative(
ElementSpecifier relative_to,
std::string_view name,
C&& find_callback) { … }
template <typename F, typename V>
requires ui::test::internal::HasSignature<F, void(V*)>
ui::InteractionSequence::StepBuilder InteractiveViewsTestApi::WithView(
ElementSpecifier view,
F&& function) { … }
template <typename C, typename T, typename U, typename V>
requires ui::test::internal::HasSignature<
C,
bool(const V*)>
ui::InteractionSequence::StepBuilder InteractiveViewsTestApi::IfView(
ElementSpecifier element,
C&& condition,
T&& then_steps,
U&& else_steps) { … }
template <typename F,
typename M,
typename T,
typename U,
typename R,
typename V>
requires ui::test::internal::HasSignature<F, R(const V*)>
ui::InteractionSequence::StepBuilder InteractiveViewsTestApi::IfViewMatches(
ElementSpecifier element,
F&& function,
M&& matcher,
T&& then_steps,
U&& else_steps) { … }
template <typename R, typename M, typename V, typename T, typename U>
requires internal::IsView<V>
ui::InteractionSequence::StepBuilder
InteractiveViewsTestApi::IfViewPropertyMatches(ElementSpecifier element,
R (V::*property)() const,
M&& matcher,
T&& then_steps,
U&& else_steps) { … }
template <typename V>
requires internal::IsView<V>
ui::InteractionSequence::StepBuilder
InteractiveViewsTestApi::NameChildViewByType(ElementSpecifier parent,
std::string_view name,
size_t index) { … }
template <typename V>
requires internal::IsView<V>
ui::InteractionSequence::StepBuilder
InteractiveViewsTestApi::NameDescendantViewByType(ElementSpecifier ancestor,
std::string_view name,
size_t index) { … }
template <typename F, typename V>
requires ui::test::internal::HasSignature<F, bool(V*)>
ui::InteractionSequence::StepBuilder InteractiveViewsTestApi::CheckView(
ElementSpecifier view,
F&& check) { … }
template <typename F, typename M, typename R, typename V>
requires ui::test::internal::HasSignature<F, R(V*)>
ui::InteractionSequence::StepBuilder InteractiveViewsTestApi::CheckView(
ElementSpecifier view,
F&& function,
M&& matcher) { … }
template <typename V, typename R, typename M>
requires internal::IsView<V>
ui::InteractionSequence::StepBuilder InteractiveViewsTestApi::CheckViewProperty(
ElementSpecifier view,
R (V::*property)() const,
M&& matcher) { … }
template <typename V, typename R, typename M>
requires internal::IsView<V>
ui::test::InteractiveTestApi::MultiStep
InteractiveViewsTestApi::WaitForViewPropertyCallback(
ElementSpecifier view,
R (V::*property)() const,
base::CallbackListSubscription (V::*add_listener)(
ui::metadata::PropertyChangedCallback),
M&& matcher,
ui::CustomElementEventType event_type) { … }
#define WaitForViewProperty(view, Class, Property, matcher) …
template <typename T, typename V, typename C>
requires internal::IsView<V> &&
ui::test::internal::HasSignature<C, T(const V*)>
ui::InteractionSequence::StepBuilder InteractiveViewsTestApi::PollView(
ui::test::StateIdentifier<PollingViewObserver<T, V>> id,
ui::ElementIdentifier view_id,
C&& callback,
base::TimeDelta polling_interval) { … }
template <typename R, typename V, typename T>
requires internal::IsView<V>
ui::InteractionSequence::StepBuilder InteractiveViewsTestApi::PollViewProperty(
ui::test::StateIdentifier<PollingViewPropertyObserver<T, V>> id,
ui::ElementIdentifier view_id,
R (V::*property)() const,
base::TimeDelta polling_interval) { … }
}
#endif