chromium/third_party/blink/renderer/core/animation/css/css_animations_test.cc

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

#include "third_party/blink/renderer/core/animation/css/css_animations.h"

#include "cc/animation/animation.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_union_cssnumericvalue_double.h"
#include "third_party/blink/renderer/core/animation/animation.h"
#include "third_party/blink/renderer/core/animation/animation_test_helpers.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/css/cssom/css_numeric_value.h"
#include "third_party/blink/renderer/core/dom/dom_token_list.h"
#include "third_party/blink/renderer/core/dom/node_computed_style.h"
#include "third_party/blink/renderer/core/dom/pseudo_element.h"
#include "third_party/blink/renderer/core/layout/layout_object.h"
#include "third_party/blink/renderer/core/page/page_animator.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/animation/compositor_animation_delegate.h"
#include "third_party/blink/renderer/platform/testing/paint_test_configurations.h"
#include "third_party/blink/renderer/platform/testing/runtime_enabled_features_test_helpers.h"

namespace {

const double kTolerance =;

const double kTimeToleranceMilliseconds =;
}

namespace blink {

class CSSAnimationsTest : public RenderingTest, public PaintTestConfigurations {};

INSTANTIATE_PAINT_TEST_SUITE_P();

// Verify that a composited animation is retargeted according to its composited
// time.
TEST_P(CSSAnimationsTest, RetargetedTransition) {}

// Test that when an incompatible in progress compositor transition
// would be retargeted it does not incorrectly combine with a new
// transition target.
TEST_P(CSSAnimationsTest, IncompatibleRetargetedTransition) {}

TEST_P(CSSAnimationsTest, CompositedBackgroundColorSnapshot) {}

// Verifies that newly created/cancelled transitions are both taken into
// account when setting the flags. (The filter property is an
// arbitrarily chosen sample).
TEST_P(CSSAnimationsTest, AnimationFlags_Transitions) {}

// Verifies that newly created/updated CSS/JS animations are all taken into
// account when setting the flags. (The filter/opacity/transform properties are
// arbitrarily chosen samples).
TEST_P(CSSAnimationsTest, AnimationFlags_Animations) {}

namespace {

bool OpacityFlag(const ComputedStyle& style) {}
bool TransformFlag(const ComputedStyle& style) {}
bool ScaleFlag(const ComputedStyle& style) {}
bool RotateFlag(const ComputedStyle& style) {}
bool TranslateFlag(const ComputedStyle& style) {}
bool FilterFlag(const ComputedStyle& style) {}
bool BackdropFilterFlag(const ComputedStyle& style) {}
bool BackgroundColorFlag(const ComputedStyle& style) {}

bool CompositedOpacityFlag(const ComputedStyle& style) {}
bool CompositedTransformFlag(const ComputedStyle& style) {}
bool CompositedScaleFlag(const ComputedStyle& style) {}
bool CompositedRotateFlag(const ComputedStyle& style) {}
bool CompositedTranslateFlag(const ComputedStyle& style) {}
bool CompositedFilterFlag(const ComputedStyle& style) {}
bool CompositedBackdropFilterFlag(const ComputedStyle& style) {}

FlagFunction;

struct FlagData {};

FlagData flag_data[] =;

FlagData compositor_flag_data[] =;

String GenerateTransitionHTMLFrom(const FlagData& data) {}

String GenerateCSSAnimationHTMLFrom(const FlagData& data) {}

}  // namespace

// Verify that HasCurrent*Animation flags are set for transitions.
TEST_P(CSSAnimationsTest, AllAnimationFlags_Transitions) {}

// Verify that IsRunning*AnimationOnCompositor flags are set for transitions.
TEST_P(CSSAnimationsTest, AllAnimationFlags_Transitions_Compositor) {}

// Verify that HasCurrent*Animation flags are set for CSS animations.
TEST_P(CSSAnimationsTest, AllAnimationFlags_CSSAnimations) {}

// Verify that IsRunning*AnimationOnCompositor flags are set for CSS animations.
TEST_P(CSSAnimationsTest, AllAnimationFlags_CSSAnimations_Compositor) {}

// Verify that HasCurrent*Animation flags are set for JS animations.
TEST_P(CSSAnimationsTest, AllAnimationFlags_JSAnimations) {}

// Verify that IsRunning*AnimationOnCompositor flags are set for JS animations.
TEST_P(CSSAnimationsTest, AllAnimationFlags_JSAnimations_Compositor) {}

TEST_P(CSSAnimationsTest, CompositedAnimationUpdateCausesPaintInvalidation) {}

TEST_P(CSSAnimationsTest, UpdateAnimationFlags_AnimatingElement) {}

TEST_P(CSSAnimationsTest, CSSTransitionBlockedByAnimationUseCounter) {}

// The following group of tests verify that composited CSS animations are
// well behaved when updated via the web-animations API. Verifies that changes
// are synced with the compositor.

class CSSAnimationsCompositorSyncTest : public CSSAnimationsTest {};

INSTANTIATE_PAINT_TEST_SUITE_P();

// Verifies that changes to the playback rate are synced with the compositor.
TEST_P(CSSAnimationsCompositorSyncTest, UpdatePlaybackRate) {}

// Verifies that reversing an animation is synced with the compositor.
TEST_P(CSSAnimationsCompositorSyncTest, Reverse) {}

// Verifies that setting the start time on a running animation restarts the
// compositor animation in sync with blink.
TEST_P(CSSAnimationsCompositorSyncTest, SetStartTime) {}

// Verifies that setting the current time on a running animation restarts the
// compositor animation in sync with blink.
TEST_P(CSSAnimationsCompositorSyncTest, SetCurrentTime) {}

TEST_P(CSSAnimationsTest, LingeringTimelineAttachments) {}

TEST_P(CSSAnimationsTest, DeferredTimelineUpdate) {}

TEST_P(CSSAnimationsTest, OpacityUnchangedWhileDeferred) {}

}  // namespace blink