Commit 16fdc860 authored by Majid Valipour's avatar Majid Valipour Committed by Commit Bot

[cc] cleanup worklet animation tests

- Move two tests for AnimationHost/WorkletAnimation interactions to animation_host_unittests
- Remove unnecessary complexity related to creating and testing an impl instance.
  These tests don't need to distinguish between main/impl instances at all.

Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;master.tryserver.blink:linux_trusty_blink_rel
Change-Id: I928e664ddf4fab8496fbbe3a09fcdcd120c875fb
Reviewed-on: https://chromium-review.googlesource.com/1133770Reviewed-by: default avatarStephen McGruer <smcgruer@chromium.org>
Commit-Queue: Majid Valipour <majidvp@chromium.org>
Cr-Commit-Position: refs/heads/master@{#578405}
parent c7c6a230
...@@ -183,5 +183,60 @@ TEST_F(AnimationHostTest, LayerTreeMutatorUpdateTakesEffectInSameFrame) { ...@@ -183,5 +183,60 @@ TEST_F(AnimationHostTest, LayerTreeMutatorUpdateTakesEffectInSameFrame) {
element_id_, ElementListType::ACTIVE, expected_opacity); element_id_, ElementListType::ACTIVE, expected_opacity);
} }
TEST_F(AnimationHostTest, LayerTreeMutatorsIsMutatedWithCorrectInputState) {
AttachWorkletAnimation();
MockLayerTreeMutator* mock_mutator = new NiceMock<MockLayerTreeMutator>();
host_impl_->SetLayerTreeMutator(
base::WrapUnique<LayerTreeMutator>(mock_mutator));
ON_CALL(*mock_mutator, HasAnimators()).WillByDefault(Return(true));
const float start_opacity = .7f;
const float end_opacity = .3f;
const double duration = 1.;
AddOpacityTransitionToAnimation(worklet_animation_.get(), duration,
start_opacity, end_opacity, true);
host_->PushPropertiesTo(host_impl_);
host_impl_->ActivateAnimations();
EXPECT_CALL(*mock_mutator, MutateRef(_));
base::TimeTicks time;
time += base::TimeDelta::FromSecondsD(0.1);
TickAnimationsTransferEvents(time, 0u);
}
TEST_F(AnimationHostTest, LayerTreeMutatorsIsMutatedOnlyWhenInputChanges) {
AttachWorkletAnimation();
MockLayerTreeMutator* mock_mutator = new NiceMock<MockLayerTreeMutator>();
host_impl_->SetLayerTreeMutator(
base::WrapUnique<LayerTreeMutator>(mock_mutator));
ON_CALL(*mock_mutator, HasAnimators()).WillByDefault(Return(true));
const float start_opacity = .7f;
const float end_opacity = .3f;
const double duration = 1.;
AddOpacityTransitionToAnimation(worklet_animation_.get(), duration,
start_opacity, end_opacity, true);
host_->PushPropertiesTo(host_impl_);
host_impl_->ActivateAnimations();
EXPECT_CALL(*mock_mutator, MutateRef(_)).Times(1);
base::TimeTicks time;
time += base::TimeDelta::FromSecondsD(0.1);
TickAnimationsTransferEvents(time, 0u);
// The time has not changed which means worklet animation input is the same.
// Ticking animations again should not result in mutator being asked to
// mutate.
TickAnimationsTransferEvents(time, 0u);
}
} // namespace } // namespace
} // namespace cc } // namespace cc
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment