#ifndef UI_BASE_INTERACTION_INTERACTIVE_TEST_H_
#define UI_BASE_INTERACTION_INTERACTIVE_TEST_H_
#include <concepts>
#include <functional>
#include <memory>
#include <string_view>
#include <type_traits>
#include <utility>
#include <variant>
#include <vector>
#include "base/strings/strcat.h"
#include "base/strings/stringprintf.h"
#include "base/test/bind.h"
#include "base/test/rectify_callback.h"
#include "base/time/time.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_identifier.h"
#include "ui/base/interaction/element_tracker.h"
#include "ui/base/interaction/interaction_sequence.h"
#include "ui/base/interaction/interaction_test_util.h"
#include "ui/base/interaction/interactive_test_internal.h"
#include "ui/base/interaction/polling_state_observer.h"
#include "ui/base/interaction/state_observer.h"
#if !BUILDFLAG(IS_IOS)
#include "ui/base/accelerators/accelerator.h"
#endif
namespace ui::test {
class InteractiveTestApi { … };
template <typename T>
class InteractiveTestT : public T, public InteractiveTestApi { … };
InteractiveTest;
template <typename... Args>
InteractiveTestApi::MultiStep InteractiveTestApi::Steps(Args&&... args) { … }
template <typename T>
void InteractiveTestApi::AddStep(InteractionSequence::Builder& builder,
T&& step) { … }
template <typename... Args>
bool InteractiveTestApi::RunTestSequenceInContext(ElementContext context,
Args&&... steps) { … }
template <typename A>
requires internal::HasSignature<A, void()>
InteractiveTestApi::StepBuilder InteractiveTestApi::Do(A&& action) { … }
template <typename T>
requires internal::IsStepCallback<T>
InteractionSequence::StepBuilder InteractiveTestApi::AfterShow(
ElementSpecifier element,
T&& step_callback) { … }
template <typename T>
requires internal::HasCompatibleSignature<T, void(InteractionSequence*)>
InteractionSequence::StepBuilder InteractiveTestApi::AfterActivate(
ElementSpecifier element,
T&& step_callback) { … }
template <typename T>
requires internal::IsStepCallback<T>
InteractionSequence::StepBuilder InteractiveTestApi::AfterEvent(
ElementSpecifier element,
CustomElementEventType event_type,
T&& step_callback) { … }
template <typename T>
requires internal::HasCompatibleSignature<T, void(InteractionSequence*)>
InteractionSequence::StepBuilder InteractiveTestApi::AfterHide(
ElementSpecifier element,
T&& step_callback) { … }
template <typename T>
requires internal::IsStepCallback<T>
InteractionSequence::StepBuilder InteractiveTestApi::WithElement(
ElementSpecifier element,
T&& step_callback) { … }
template <typename C>
requires internal::HasSignature<C, TrackedElement*(TrackedElement*)>
InteractionSequence::StepBuilder InteractiveTestApi::NameElementRelative(
ElementSpecifier relative_to,
std::string_view name,
C&& find_callback) { … }
template <typename T>
InteractionSequence::StepBuilder InteractiveTestApi::InAnyContext(T&& step) { … }
template <typename T>
InteractionSequence::StepBuilder InteractiveTestApi::InSameContext(T&& step) { … }
template <typename T>
InteractionSequence::StepBuilder InteractiveTestApi::InContext(
ElementContext context,
T&& step) { … }
template <typename T>
InteractionSequence::StepBuilder InteractiveTestApi::WithoutDelay(T&& step) { … }
template <typename C, typename T, typename E>
requires internal::IsCheckCallback<C, bool>
InteractionSequence::StepBuilder InteractiveTestApi::IfElement(
ElementSpecifier element,
C&& condition,
T&& then_steps,
E&& else_steps) { … }
template <typename F, typename M, typename T, typename E, typename R>
requires internal::IsCheckCallback<F, R>
InteractionSequence::StepBuilder InteractiveTestApi::IfElementMatches(
ElementSpecifier element,
F&& function,
M&& matcher,
T&& then_steps,
E&& else_steps) { … }
template <typename C, typename T, typename E>
requires internal::HasSignature<C, bool()>
InteractionSequence::StepBuilder InteractiveTestApi::If(C&& condition,
T&& then_steps,
E&& else_steps) { … }
template <typename F, typename M, typename T, typename E, typename R>
requires internal::HasCompatibleSignature<F, R(const InteractionSequence*)>
InteractionSequence::StepBuilder InteractiveTestApi::IfMatches(F&& function,
M&& matcher,
T&& then_steps,
E&& else_steps) { … }
template <typename... Args>
InteractionSequence::StepBuilder InteractiveTestApi::InParallel(
Args&&... sequences) { … }
template <typename... Args>
InteractionSequence::StepBuilder InteractiveTestApi::AnyOf(
Args&&... sequences) { … }
template <typename ObserverBase, typename Observer>
requires std::derived_from<Observer, ObserverBase> &&
internal::IsValidMatcherType<typename Observer::ValueType>
InteractionSequence::StepBuilder InteractiveTestApi::ObserveState(
StateIdentifier<ObserverBase> id,
std::unique_ptr<Observer> observer) { … }
template <typename Observer, typename... Args>
requires internal::IsValidMatcherType<typename Observer::ValueType>
InteractionSequence::StepBuilder InteractiveTestApi::ObserveState(
StateIdentifier<Observer> id,
Args&&... args) { … }
template <typename T, typename C>
requires internal::IsValidMatcherType<T>
InteractionSequence::StepBuilder InteractiveTestApi::PollState(
StateIdentifier<PollingStateObserver<T>> id,
C&& callback,
base::TimeDelta polling_interval) { … }
template <typename T, typename C>
requires internal::IsValidMatcherType<T>
InteractionSequence::StepBuilder InteractiveTestApi::PollElement(
StateIdentifier<PollingElementStateObserver<T>> id,
ui::ElementIdentifier element_identifier,
C&& callback,
base::TimeDelta polling_interval) { … }
template <typename O, typename V>
InteractiveTestApi::MultiStep InteractiveTestApi::WaitForState(
StateIdentifier<O> id,
V&& value) { … }
template <typename O>
InteractiveTestApi::StepBuilder InteractiveTestApi::StopObservingState(
StateIdentifier<O> id) { … }
template <typename... Args>
InteractiveTestApi::StepBuilder InteractiveTestApi::Log(Args... args) { … }
template <typename C>
requires internal::HasSignature<C, bool()>
InteractiveTestApi::StepBuilder InteractiveTestApi::Check(
C&& check_callback,
std::string check_description) { … }
template <typename C, typename M, typename R>
requires internal::HasSignature<C, R()>
InteractionSequence::StepBuilder InteractiveTestApi::CheckResult(
C&& function,
M&& matcher,
std::string check_description) { … }
template <typename V, typename M, typename T>
InteractionSequence::StepBuilder InteractiveTestApi::CheckVariable(
V& variable,
M&& matcher,
std::string check_description) { … }
template <typename C>
requires internal::HasSignature<C, bool(TrackedElement*)>
InteractionSequence::StepBuilder InteractiveTestApi::CheckElement(
ElementSpecifier element,
C&& check) { … }
template <typename F, typename M, typename R>
requires internal::HasSignature<F, R(TrackedElement*)>
InteractionSequence::StepBuilder InteractiveTestApi::CheckElement(
ElementSpecifier element,
F&& function,
M&& matcher) { … }
}
#endif