#include "ui/base/interaction/interactive_test.h"
#include <functional>
#include <list>
#include <memory>
#include <string>
#include "base/functional/callback_forward.h"
#include "base/functional/callback_helpers.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/observer_list.h"
#include "base/observer_list_types.h"
#include "base/task/single_thread_task_runner.h"
#include "base/test/bind.h"
#include "base/test/task_environment.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_test_util.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/state_observer.h"
#if !BUILDFLAG(IS_IOS)
#include "ui/base/accelerators/accelerator.h"
#endif
namespace ui::test {
namespace {
enum class ActionType { … };
ActionRecord;
const ui::ElementContext kTestContext1(1);
const ui::ElementContext kTestContext2(2);
DEFINE_LOCAL_ELEMENT_IDENTIFIER_VALUE(…);
DEFINE_LOCAL_ELEMENT_IDENTIFIER_VALUE(…);
DEFINE_LOCAL_ELEMENT_IDENTIFIER_VALUE(…);
DEFINE_LOCAL_ELEMENT_IDENTIFIER_VALUE(…);
DEFINE_LOCAL_CUSTOM_ELEMENT_EVENT_TYPE(…);
DEFINE_LOCAL_CUSTOM_ELEMENT_EVENT_TYPE(…);
constexpr char kSetOnIncompatibleActionMessage[] = …;
class TestSimulator : public InteractionTestUtil::Simulator { … };
void DoFunction() { … }
const TrackedElement* CheckElementFunction(const TrackedElement* el) { … }
int ValueGeneratingFunction() { … }
struct CallableObject { … };
struct MutableCallableObject { … };
struct EmptyCallableObject { … };
}
class InteractiveTestTest : public InteractiveTest { … };
TEST_F(InteractiveTestTest, StepsConstructsMultiStep) { … }
TEST_F(InteractiveTestTest, RunTestSequenceInContext) { … }
TEST_F(InteractiveTestTest, WaitInAnyContext) { … }
TEST_F(InteractiveTestTest, FlushInAnyContext) { … }
TEST_F(InteractiveTestTest, InteractionVerbs) { … }
TEST_F(InteractiveTestTest, InteractionVerbsInAnyContext) { … }
TEST_F(InteractiveTestTest, InteractionVerbsInSameContext) { … }
TEST_F(InteractiveTestTest, Do) { … }
TEST_F(InteractiveTestTest, Check) { … }
TEST_F(InteractiveTestTest, CheckFails) { … }
TEST_F(InteractiveTestTest, CheckResult) { … }
TEST_F(InteractiveTestTest, CheckResultFails) { … }
TEST_F(InteractiveTestTest, CheckVariable) { … }
TEST_F(InteractiveTestTest, CheckVariableFails) { … }
TEST_F(InteractiveTestTest, CheckElement) { … }
TEST_F(InteractiveTestTest, CheckElementFails) { … }
TEST_F(InteractiveTestTest, CheckElementWithMatcher) { … }
TEST_F(InteractiveTestTest, CheckElementWithMatcherFails) { … }
TEST_F(InteractiveTestTest, After) { … }
TEST_F(InteractiveTestTest, WaitFor) { … }
TEST_F(InteractiveTestTest, PresentOrNotPresentInAnyContext) { … }
TEST_F(InteractiveTestTest, WithElementFails) { … }
TEST_F(InteractiveTestTest, EnsureNotPresentFails) { … }
TEST_F(InteractiveTestTest, EnsureNotPresentInAnyContextFails) { … }
TEST_F(InteractiveTestTest, EnsurePresentFails) { … }
TEST_F(InteractiveTestTest, NameElementWithPointer) { … }
TEST_F(InteractiveTestTest, NameElementWithReference) { … }
TEST_F(InteractiveTestTest, NameElementWithCallback) { … }
TEST_F(InteractiveTestTest, NameElementWithContext) { … }
TEST_F(InteractiveTestTest, SimulatorSucceeds_SkipOnUnsupported) { … }
TEST_F(InteractiveTestTest, SimulatorSucceeds_IgnoreOnUnsupported) { … }
TEST_F(InteractiveTestTest, SimulatorFailureFails) { … }
TEST_F(InteractiveTestTest, SimulatorFailureFails_SkipOnUnsupported) { … }
TEST_F(InteractiveTestTest, SimulatorFailureFails_IgnoreOnUnsupported) { … }
TEST_F(InteractiveTestTest, SimulatorCannotSimulateFails) { … }
TEST_F(InteractiveTestTest, SimulatorCannotSimulateFails_SkipOnUnsupported) { … }
TEST_F(InteractiveTestTest, SimulatorCannotSimulateFails_IgnoreOnUnsupported) { … }
TEST_F(InteractiveTestTest, SimulatorNotSupportedFails) { … }
TEST_F(InteractiveTestTest, SimulatorNotSupportedSkipsOnUnsupported) { … }
TEST_F(InteractiveTestTest, SimulatorNotSupportedContinuesOnUnsupported) { … }
TEST_F(InteractiveTestTest, CanChangeOnIncompatibleAction) { … }
TEST_F(InteractiveTestTest, SimulatorNotSupportedHaltAndSucceedOnUnsupported) { … }
TEST_F(InteractiveTestTest, ActuallySkipsTestOnSimulatorFailure) { … }
TEST_F(InteractiveTestTest, IfTrue) { … }
TEST_F(InteractiveTestTest, IfFalse) { … }
TEST_F(InteractiveTestTest, IfMatcherTrue) { … }
TEST_F(InteractiveTestTest, IfMatcherFalse) { … }
TEST_F(InteractiveTestTest, IfImplicitMatcherTrue) { … }
TEST_F(InteractiveTestTest, IfImplicitMatcherFalse) { … }
TEST_F(InteractiveTestTest, IfWithMultiStep) { … }
TEST_F(InteractiveTestTest, IfElementTrue) { … }
TEST_F(InteractiveTestTest, IfElementFalse) { … }
TEST_F(InteractiveTestTest, IfElementMatchesTrue) { … }
TEST_F(InteractiveTestTest, IfElementMatchesFalse) { … }
TEST_F(InteractiveTestTest, IfElementWithMultiStep) { … }
TEST_F(InteractiveTestTest, IfFails) { … }
TEST_F(InteractiveTestTest, IfThenElse_OnlyRunsThen) { … }
TEST_F(InteractiveTestTest, IfThenElse_OnlyRunsElse) { … }
TEST_F(InteractiveTestTest, IfThenElse_ThenFails) { … }
TEST_F(InteractiveTestTest, IfThenElse_ElseFails) { … }
TEST_F(InteractiveTestTest, InParallel) { … }
TEST_F(InteractiveTestTest, InParallelMultiStep) { … }
TEST_F(InteractiveTestTest, InParallelAsync) { … }
TEST_F(InteractiveTestTest, InParallelDependent) { … }
TEST_F(InteractiveTestTest, InParallelPingPong) { … }
TEST_F(InteractiveTestTest, InParallelFails) { … }
TEST_F(InteractiveTestTest, AnyOf) { … }
TEST_F(InteractiveTestTest, AnyOfOneFailsOneSucceeds) { … }
TEST_F(InteractiveTestTest, AnyOfAllFail) { … }
TEST_F(InteractiveTestTest, AnyOfInsideIf) { … }
TEST_F(InteractiveTestTest, Log) { … }
TEST_F(InteractiveTestTest, ActionBindingMethods) { … }
TEST_F(InteractiveTestTest, ConditionalBindingMethods) { … }
namespace {
template <typename T>
class TestObservable;
template <typename T>
class TestObserver : public base::CheckedObserver { … };
template <typename T>
class TestObservable { … };
template <typename T>
class TestStateObserver
: public ObservationStateObserver<T, TestObservable<T>, TestObserver<T>> { … };
struct MyStruct { … };
DEFINE_LOCAL_STATE_IDENTIFIER_VALUE(TestStateObserver<int>, kIntTestState);
DEFINE_LOCAL_STATE_IDENTIFIER_VALUE(TestStateObserver<std::string>,
kStringTestState);
DEFINE_LOCAL_STATE_IDENTIFIER_VALUE(TestStateObserver<std::u16string>,
kWStringTestState);
DEFINE_LOCAL_STATE_IDENTIFIER_VALUE(TestStateObserver<MyStruct>,
kStructTestState);
}
TEST_F(InteractiveTestTest, ObserveStateFromUniquePtr) { … }
TEST_F(InteractiveTestTest, ObserveExistingStateProceedsImmediately) { … }
TEST_F(InteractiveTestTest, ObserveStateFromArgsWithReferences) { … }
TEST_F(InteractiveTestTest, ObserveStateFromArgsWithFunctions) { … }
TEST_F(InteractiveTestTest, ObserveStateResetsOnDestruction) { … }
TEST_F(InteractiveTestTest, ObserveStateWithString) { … }
TEST_F(InteractiveTestTest, ObserveStateWithWideString) { … }
TEST_F(InteractiveTestTest, ObserveStateWithStruct) { … }
TEST_F(InteractiveTestTest, StopObservingState) { … }
DEFINE_LOCAL_STATE_IDENTIFIER_VALUE(PollingStateObserver<int>,
kPollingTestState);
TEST_F(InteractiveTestTest, PollingStateObserver) { … }
TEST_F(InteractiveTestTest, PollingStateCalledOnce) { … }
DEFINE_LOCAL_STATE_IDENTIFIER_VALUE(PollingElementStateObserver<std::string>,
kPollingElementTestState);
TEST_F(InteractiveTestTest, PollingElementStateObserver) { … }
TEST_F(InteractiveTestTest, SubsequenceHidesElement) { … }
}