#include "third_party/blink/renderer/core/animation/animation.h"
#include <bit>
#include <memory>
#include <tuple>
#include "base/test/metrics/histogram_tester.h"
#include "build/build_config.h"
#include "cc/trees/target_property.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_optional_effect_timing.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_scroll_timeline_options.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_union_cssnumericvalue_double.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_union_cssnumericvalue_string_unrestricteddouble.h"
#include "third_party/blink/renderer/core/animation/animation_clock.h"
#include "third_party/blink/renderer/core/animation/css/compositor_keyframe_double.h"
#include "third_party/blink/renderer/core/animation/css_number_interpolation_type.h"
#include "third_party/blink/renderer/core/animation/document_timeline.h"
#include "third_party/blink/renderer/core/animation/element_animations.h"
#include "third_party/blink/renderer/core/animation/keyframe_effect.h"
#include "third_party/blink/renderer/core/animation/keyframe_effect_model.h"
#include "third_party/blink/renderer/core/animation/pending_animations.h"
#include "third_party/blink/renderer/core/animation/scroll_timeline.h"
#include "third_party/blink/renderer/core/animation/timing.h"
#include "third_party/blink/renderer/core/css/cssom/css_unit_values.h"
#include "third_party/blink/renderer/core/css/properties/longhands.h"
#include "third_party/blink/renderer/core/css/resolver/style_resolver.h"
#include "third_party/blink/renderer/core/dom/document.h"
#include "third_party/blink/renderer/core/dom/dom_node_ids.h"
#include "third_party/blink/renderer/core/dom/events/event.h"
#include "third_party/blink/renderer/core/dom/events/native_event_listener.h"
#include "third_party/blink/renderer/core/dom/qualified_name.h"
#include "third_party/blink/renderer/core/execution_context/agent.h"
#include "third_party/blink/renderer/core/execution_context/security_context.h"
#include "third_party/blink/renderer/core/page/page_animator.h"
#include "third_party/blink/renderer/core/paint/paint_layer.h"
#include "third_party/blink/renderer/core/paint/paint_layer_scrollable_area.h"
#include "third_party/blink/renderer/core/testing/core_unit_test_helper.h"
#include "third_party/blink/renderer/platform/animation/compositor_animation.h"
#include "third_party/blink/renderer/platform/bindings/v8_per_isolate_data.h"
#include "third_party/blink/renderer/platform/graphics/compositing/paint_artifact_compositor.h"
#include "third_party/blink/renderer/platform/heap/garbage_collected.h"
#include "third_party/blink/renderer/platform/heap/thread_state.h"
#include "third_party/blink/renderer/platform/scheduler/public/event_loop.h"
#include "third_party/blink/renderer/platform/testing/paint_test_configurations.h"
#include "third_party/blink/renderer/platform/weborigin/kurl.h"
namespace blink {
void ExpectRelativeErrorWithinEpsilon(double expected, double observed) { … }
class AnimationAnimationTestNoCompositing : public PaintTestConfigurations,
public RenderingTest { … };
class AnimationAnimationTestCompositing
: public AnimationAnimationTestNoCompositing { … };
INSTANTIATE_PAINT_TEST_SUITE_P(…);
INSTANTIATE_PAINT_TEST_SUITE_P(…);
TEST_P(AnimationAnimationTestNoCompositing, InitialState) { … }
TEST_P(AnimationAnimationTestNoCompositing, CurrentTimeDoesNotSetOutdated) { … }
TEST_P(AnimationAnimationTestNoCompositing, SetCurrentTime) { … }
TEST_P(AnimationAnimationTestNoCompositing, SetCurrentTimeNegative) { … }
TEST_P(AnimationAnimationTestNoCompositing,
SetCurrentTimeNegativeWithoutSimultaneousPlaybackRateChange) { … }
TEST_P(AnimationAnimationTestNoCompositing, SetCurrentTimePastContentEnd) { … }
TEST_P(AnimationAnimationTestCompositing, SetCurrentTimeMax) { … }
TEST_P(AnimationAnimationTestCompositing, SetCurrentTimeAboveMaxTimeDelta) { … }
TEST_P(AnimationAnimationTestNoCompositing, SetCurrentTimeSetsStartTime) { … }
TEST_P(AnimationAnimationTestNoCompositing, SetStartTime) { … }
TEST_P(AnimationAnimationTestNoCompositing, SetStartTimeLimitsAnimation) { … }
TEST_P(AnimationAnimationTestNoCompositing, SetStartTimeOnLimitedAnimation) { … }
TEST_P(AnimationAnimationTestNoCompositing, StartTimePauseFinish) { … }
TEST_P(AnimationAnimationTestNoCompositing, FinishWhenPaused) { … }
TEST_P(AnimationAnimationTestNoCompositing, StartTimeFinishPause) { … }
TEST_P(AnimationAnimationTestNoCompositing, StartTimeWithZeroPlaybackRate) { … }
TEST_P(AnimationAnimationTestNoCompositing, PausePlay) { … }
TEST_P(AnimationAnimationTestNoCompositing, PlayRewindsToStart) { … }
TEST_P(AnimationAnimationTestNoCompositing, PlayRewindsToEnd) { … }
TEST_P(AnimationAnimationTestNoCompositing,
PlayWithPlaybackRateZeroDoesNotSeek) { … }
TEST_P(AnimationAnimationTestNoCompositing,
PlayAfterPauseWithPlaybackRateZeroUpdatesPlayState) { … }
TEST_P(AnimationAnimationTestNoCompositing, Reverse) { … }
TEST_P(AnimationAnimationTestNoCompositing,
ReverseHoldsCurrentTimeWithPlaybackRateZero) { … }
TEST_P(AnimationAnimationTestNoCompositing, ReverseSeeksToStart) { … }
TEST_P(AnimationAnimationTestNoCompositing, ReverseSeeksToEnd) { … }
TEST_P(AnimationAnimationTestNoCompositing, ReverseBeyondLimit) { … }
TEST_P(AnimationAnimationTestNoCompositing, Finish) { … }
TEST_P(AnimationAnimationTestNoCompositing, FinishAfterEffectEnd) { … }
TEST_P(AnimationAnimationTestNoCompositing, FinishBeforeStart) { … }
TEST_P(AnimationAnimationTestNoCompositing,
FinishDoesNothingWithPlaybackRateZero) { … }
TEST_P(AnimationAnimationTestNoCompositing, FinishRaisesException) { … }
TEST_P(AnimationAnimationTestNoCompositing, LimitingAtEffectEnd) { … }
TEST_P(AnimationAnimationTestNoCompositing, LimitingAtStart) { … }
TEST_P(AnimationAnimationTestNoCompositing, LimitingWithNoEffect) { … }
TEST_P(AnimationAnimationTestNoCompositing, SetPlaybackRate) { … }
TEST_P(AnimationAnimationTestNoCompositing, SetPlaybackRateWhilePaused) { … }
TEST_P(AnimationAnimationTestNoCompositing, SetPlaybackRateWhileLimited) { … }
TEST_P(AnimationAnimationTestNoCompositing, SetPlaybackRateZero) { … }
TEST_P(AnimationAnimationTestNoCompositing, SetPlaybackRateMax) { … }
TEST_P(AnimationAnimationTestNoCompositing, UpdatePlaybackRate) { … }
TEST_P(AnimationAnimationTestNoCompositing, UpdatePlaybackRateWhilePaused) { … }
TEST_P(AnimationAnimationTestNoCompositing, UpdatePlaybackRateWhileLimited) { … }
TEST_P(AnimationAnimationTestNoCompositing, UpdatePlaybackRateWhileRunning) { … }
TEST_P(AnimationAnimationTestNoCompositing, SetEffect) { … }
TEST_P(AnimationAnimationTestNoCompositing, SetEffectLimitsAnimation) { … }
TEST_P(AnimationAnimationTestNoCompositing, SetEffectUnlimitsAnimation) { … }
TEST_P(AnimationAnimationTestNoCompositing, EmptyAnimationsDontUpdateEffects) { … }
TEST_P(AnimationAnimationTestNoCompositing, AnimationsDisassociateFromEffect) { … }
#define EXPECT_TIMEDELTA(expected, observed) …
TEST_P(AnimationAnimationTestNoCompositing, AnimationsReturnTimeToNextEffect) { … }
TEST_P(AnimationAnimationTestNoCompositing, TimeToNextEffectWhenPaused) { … }
TEST_P(AnimationAnimationTestNoCompositing,
TimeToNextEffectWhenCancelledBeforeStart) { … }
TEST_P(AnimationAnimationTestNoCompositing,
TimeToNextEffectWhenCancelledBeforeStartReverse) { … }
TEST_P(AnimationAnimationTestNoCompositing,
TimeToNextEffectSimpleCancelledBeforeStart) { … }
TEST_P(AnimationAnimationTestNoCompositing, AttachedAnimations) { … }
TEST_P(AnimationAnimationTestNoCompositing, HasLowerCompositeOrdering) { … }
TEST_P(AnimationAnimationTestNoCompositing, PlayAfterCancel) { … }
TEST_P(AnimationAnimationTestNoCompositing, PlayBackwardsAfterCancel) { … }
TEST_P(AnimationAnimationTestNoCompositing, ReverseAfterCancel) { … }
TEST_P(AnimationAnimationTestNoCompositing, FinishAfterCancel) { … }
TEST_P(AnimationAnimationTestNoCompositing, PauseAfterCancel) { … }
TEST_P(AnimationAnimationTestNoCompositing, SetPlaybackRateAfterFinish) { … }
TEST_P(AnimationAnimationTestNoCompositing, UpdatePlaybackRateAfterFinish) { … }
TEST_P(AnimationAnimationTestCompositing,
NoCompositeWithoutCompositedElementId) { … }
TEST_P(AnimationAnimationTestCompositing,
SetCompositorPendingWithUnresolvedStartTimes) { … }
TEST_P(AnimationAnimationTestCompositing, PreCommitWithUnresolvedStartTimes) { … }
TEST_P(AnimationAnimationTestCompositing, AsynchronousCancel) { … }
namespace {
int GenerateHistogramValue(CompositorAnimations::FailureReason reason) { … }
}
TEST_P(AnimationAnimationTestCompositing, PreCommitRecordsHistograms) { … }
TEST_P(AnimationAnimationTestCompositing, ReplaceCompositedAnimation) { … }
TEST_P(AnimationAnimationTestCompositing, SetKeyframesCausesCompositorPending) { … }
TEST_P(AnimationAnimationTestCompositing, InfiniteDurationAnimation) { … }
TEST_P(AnimationAnimationTestCompositing, ZeroPlaybackSpeed) { … }
TEST_P(AnimationAnimationTestCompositing,
RestartCompositedAnimationOnSizeChange) { … }
TEST_P(AnimationAnimationTestCompositing,
RestartCompositedAnimationOnWidthChange) { … }
TEST_P(AnimationAnimationTestCompositing,
RestartCompositedAnimationOnHeightChange) { … }
TEST_P(AnimationAnimationTestCompositing,
ScrollLinkedAnimationCanBeComposited) { … }
TEST_P(AnimationAnimationTestCompositing,
StartScrollLinkedAnimationWithStartTimeIfApplicable) { … }
TEST_P(AnimationAnimationTestNoCompositing, ScrollLinkedAnimationCreation) { … }
TEST_P(AnimationAnimationTestCompositing,
FinishedScrollLinkedAnimationRestartsOnReverseScrolling) { … }
TEST_P(AnimationAnimationTestNoCompositing,
RemoveCanceledAnimationFromActiveSet) { … }
TEST_P(AnimationAnimationTestNoCompositing,
RemoveFinishedAnimationFromActiveSet) { … }
TEST_P(AnimationAnimationTestNoCompositing,
PendingActivityWithFinishedPromise) { … }
class MockEventListener final : public NativeEventListener { … };
TEST_P(AnimationAnimationTestNoCompositing,
PendingActivityWithFinishedEventListener) { … }
TEST_P(AnimationAnimationTestCompositing, InvalidExecutionContext) { … }
class AnimationPendingAnimationsTest : public PaintTestConfigurations,
public RenderingTest { … };
INSTANTIATE_PAINT_TEST_SUITE_P(…);
TEST_P(AnimationPendingAnimationsTest, PendingAnimationStartSynchronization) { … }
TEST_P(AnimationPendingAnimationsTest,
PendingAnimationCancelUnblocksSynchronizedStart) { … }
TEST_P(AnimationPendingAnimationsTest,
PendingAnimationOnlySynchronizeStartsOfNewlyPendingAnimations) { … }
TEST_P(AnimationAnimationTestCompositing,
ScrollLinkedAnimationCompositedEvenIfSourceIsNotComposited) { … }
#if BUILDFLAG(IS_MAC) && defined(ARCH_CPU_ARM64)
#define MAYBE_ContentVisibleDisplayLockTest …
#else
#define MAYBE_ContentVisibleDisplayLockTest …
#endif
TEST_P(AnimationAnimationTestCompositing, MAYBE_ContentVisibleDisplayLockTest) { … }
TEST_P(AnimationAnimationTestCompositing, HiddenAnimationsDoNotTick) { … }
TEST_P(AnimationAnimationTestCompositing, HiddenAnimationsTickWhenVisible) { … }
TEST_P(AnimationAnimationTestNoCompositing,
GetEffectTimingDelayZeroUseCounter) { … }
}