chromium/cc/animation/element_animations_unittest.cc

// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "cc/animation/element_animations.h"

#include <limits>
#include <memory>
#include <utility>

#include "base/memory/ptr_util.h"
#include "cc/animation/animation.h"
#include "cc/animation/animation_delegate.h"
#include "cc/animation/animation_events.h"
#include "cc/animation/animation_host.h"
#include "cc/animation/animation_id_provider.h"
#include "cc/animation/animation_timeline.h"
#include "cc/animation/keyframe_effect.h"
#include "cc/animation/scroll_offset_animation_curve.h"
#include "cc/animation/scroll_offset_animation_curve_factory.h"
#include "cc/test/animation_test_common.h"
#include "cc/test/animation_timelines_test_common.h"
#include "ui/gfx/animation/keyframe/keyframed_animation_curve.h"
#include "ui/gfx/geometry/box_f.h"
#include "ui/gfx/geometry/test/geometry_util.h"
#include "ui/gfx/geometry/transform_operations.h"

namespace cc {
namespace {

TimeTicks;

static base::TimeTicks TicksFromSecondsF(double seconds) {}

// An ElementAnimations cannot be ticked at 0.0, since an animation
// with start time 0.0 is treated as an animation whose start time has
// not yet been set.
const TimeTicks kInitialTickTime =;

class ElementAnimationsTest : public AnimationTimelinesTest {};

// See animation_unittest.cc for integration with Animation.

TEST_F(ElementAnimationsTest, AttachToLayerInActiveTree) {}

TEST_F(ElementAnimationsTest, AddRemoveAnimations) {}

TEST_F(ElementAnimationsTest, SyncNewAnimation) {}

TEST_F(ElementAnimationsTest,
       SyncScrollOffsetAnimationRespectsHasSetInitialValue) {}

class TestAnimationDelegateThatDestroysAnimation
    : public TestAnimationDelegate {};

// Test that we don't crash if a animation is deleted while ElementAnimations is
// iterating through the list of animations (see crbug.com/631052). This test
// passes if it doesn't crash.
TEST_F(ElementAnimationsTest, AddedAnimationIsDestroyed) {}

// If an animation is started on the impl thread before it is ticked on the main
// thread, we must be sure to respect the synchronized start time.
TEST_F(ElementAnimationsTest, DoNotClobberStartTimes) {}

TEST_F(ElementAnimationsTest, UseSpecifiedStartTimes) {}

// Tests that animationss activate and deactivate as expected.
TEST_F(ElementAnimationsTest, Activation) {}

TEST_F(ElementAnimationsTest, SyncPause) {}

TEST_F(ElementAnimationsTest, DoNotSyncFinishedAnimation) {}

// Ensure that a finished animation is eventually deleted by both the
// main-thread and the impl-thread animationss.
TEST_F(ElementAnimationsTest, AnimationsAreDeleted) {}

// Test an animation that finishes on impl but is deleted on main before the
// event is received. https://crbug.com/1325393.
TEST_F(ElementAnimationsTest, AnimationFinishedOnImplDeletedOnMain) {}

// Tests that transitioning opacity from 0 to 1 works as expected.

static std::unique_ptr<KeyframeModel> CreateKeyframeModel(
    std::unique_ptr<gfx::AnimationCurve> curve,
    int group_id,
    TargetProperty::Type property) {}

TEST_F(ElementAnimationsTest, TrivialTransition) {}

TEST_F(ElementAnimationsTest, FilterTransition) {}

TEST_F(ElementAnimationsTest, BackdropFilterTransition) {}

TEST_F(ElementAnimationsTest, ScrollOffsetTransition) {}

TEST_F(ElementAnimationsTest, ScrollOffsetTransitionOnImplOnly) {}

// This test verifies that if an animation is added after a layer is animated,
// it doesn't get promoted to be in the RUNNING state. This prevents cases where
// a start time gets set on an animation using the stale value of
// last_tick_time_.
TEST_F(ElementAnimationsTest, UpdateStateWithoutAnimate) {}

// Ensure that when the impl animations doesn't have a value provider,
// the main-thread animations's value provider is used to obtain the intial
// scroll offset.
TEST_F(ElementAnimationsTest, ScrollOffsetTransitionNoImplProvider) {}

TEST_F(ElementAnimationsTest, ScrollOffsetRemovalClearsScrollDelta) {}

// Tests that impl-only animations lead to start and finished notifications
// on the impl thread animations's animation delegate.
TEST_F(ElementAnimationsTest,
       NotificationsForImplOnlyAnimationsAreSentToImplThreadDelegate) {}

// Tests that specified start times are sent to the main thread delegate
TEST_F(ElementAnimationsTest, SpecifiedStartTimesAreSentToMainThreadDelegate) {}

// Tests animations that are waiting for a synchronized start time do not
// finish.
TEST_F(ElementAnimationsTest,
       AnimationsWaitingForStartTimeDoNotFinishIfTheyOutwaitTheirFinish) {}

// Tests that two queued animations affecting the same property run in sequence.
TEST_F(ElementAnimationsTest, TrivialQueuing) {}

// Tests interrupting a transition with another transition.
TEST_F(ElementAnimationsTest, Interrupt) {}

// Tests scheduling two animations to run together when only one property is
// free.
TEST_F(ElementAnimationsTest, ScheduleTogetherWhenAPropertyIsBlocked) {}

// Tests scheduling two animations to run together with different lengths and
// another animation queued to start when the shorter animation finishes (should
// wait for both to finish).
TEST_F(ElementAnimationsTest, ScheduleTogetherWithAnAnimWaiting) {}

// Test that a looping animation loops and for the correct number of iterations.
TEST_F(ElementAnimationsTest, TrivialLooping) {}

// Test that an infinitely looping animation does indeed go until aborted.
TEST_F(ElementAnimationsTest, InfiniteLooping) {}

// Test that pausing and resuming work as expected.
TEST_F(ElementAnimationsTest, PauseResume) {}

TEST_F(ElementAnimationsTest, AbortAGroupedAnimation) {}

TEST_F(ElementAnimationsTest, PushUpdatesWhenSynchronizedStartTimeNeeded) {}

// Tests that skipping a call to UpdateState works as expected.
TEST_F(ElementAnimationsTest, SkipUpdateState) {}

// Tests that an animation animations with only a pending observer gets ticked
// but doesn't progress animations past the STARTING state.
TEST_F(ElementAnimationsTest, InactiveObserverGetsTicked) {}

// Tests that AbortKeyframeModelsWithProperty aborts all animations targeting
// the specified property.
TEST_F(ElementAnimationsTest, AbortKeyframeModelsWithProperty) {}

// An animation aborted on the main thread should get deleted on both threads.
TEST_F(ElementAnimationsTest, MainThreadAbortedAnimationGetsDeleted) {}

// An animation aborted on the impl thread should get deleted on both threads.
TEST_F(ElementAnimationsTest, ImplThreadAbortedAnimationGetsDeleted) {}

// Test that an impl-only scroll offset animation that needs to be completed on
// the main thread gets deleted.
TEST_F(ElementAnimationsTest, ImplThreadTakeoverAnimationGetsDeleted) {}

// Ensure that we only generate FINISHED events for animations in a group
// once all animations in that group are finished.
TEST_F(ElementAnimationsTest, FinishedEventsForGroup) {}

// Ensure that when a group has a mix of aborted and finished animations,
// we generate a FINISHED event for the finished animation and an ABORTED
// event for the aborted animation.
TEST_F(ElementAnimationsTest, FinishedAndAbortedEventsForGroup) {}

TEST_F(ElementAnimationsTest, MaximumAnimationScaleNotScaled) {}

TEST_F(ElementAnimationsTest, MaximumAnimationNonCalculatableScale) {}

TEST_F(ElementAnimationsTest, MaximumAnimationPartialNonCalculatableScale) {}

TEST_F(ElementAnimationsTest, MaximumScale) {}

TEST_F(ElementAnimationsTest, MaximumAnimationScaleWithDirection) {}

TEST_F(ElementAnimationsTest, NewlyPushedAnimationWaitsForActivation) {}

TEST_F(ElementAnimationsTest, ActivationBetweenAnimateAndUpdateState) {}

TEST_F(ElementAnimationsTest, ObserverNotifiedWhenTransformAnimationChanges) {}

TEST_F(ElementAnimationsTest, ObserverNotifiedWhenOpacityAnimationChanges) {}

TEST_F(ElementAnimationsTest, ObserverNotifiedWhenFilterAnimationChanges) {}

TEST_F(ElementAnimationsTest,
       ObserverNotifiedWhenBackdropFilterAnimationChanges) {}

TEST_F(ElementAnimationsTest, ClippedOpacityValues) {}

TEST_F(ElementAnimationsTest, ClippedNegativeOpacityValues) {}

TEST_F(ElementAnimationsTest, PushedDeletedAnimationWaitsForActivation) {}

// Tests that an animation that affects only active elements won't block
// an animation that affects only pending elements from starting.
TEST_F(ElementAnimationsTest, StartAnimationsAffectingDifferentObservers) {}

TEST_F(ElementAnimationsTest, TestIsCurrentlyAnimatingProperty) {}

TEST_F(ElementAnimationsTest, TestIsAnimatingPropertyTimeOffsetFillMode) {}

TEST_F(ElementAnimationsTest, RemoveAndReAddAnimationToTicking) {}

// This test verifies that finished keyframe models don't get copied over to
// impl thread.
TEST_F(ElementAnimationsTest, FinishedKeyframeModelsNotCopiedToImpl) {}

TEST_F(ElementAnimationsTest, ClientAnimationState) {}

}  // namespace
}  // namespace cc