OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "platform/animation/CompositorAnimationHost.h" | 5 #include "platform/animation/CompositorAnimationHost.h" |
6 | 6 |
| 7 #include <memory> |
7 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
8 #include "platform/animation/CompositorAnimationTimeline.h" | 9 #include "platform/animation/CompositorAnimationTimeline.h" |
9 #include "platform/testing/CompositorTest.h" | 10 #include "platform/testing/CompositorTest.h" |
10 #include "platform/testing/WebLayerTreeViewImplForTesting.h" | 11 #include "platform/testing/WebLayerTreeViewImplForTesting.h" |
11 #include <memory> | |
12 | 12 |
13 namespace blink { | 13 namespace blink { |
14 | 14 |
15 class CompositorAnimationHostTest : public CompositorTest {}; | 15 class CompositorAnimationHostTest : public CompositorTest {}; |
16 | 16 |
17 TEST_F(CompositorAnimationHostTest, AnimationHostNullWhenTimelineDetached) { | 17 TEST_F(CompositorAnimationHostTest, AnimationHostNullWhenTimelineDetached) { |
18 std::unique_ptr<CompositorAnimationTimeline> timeline = | 18 std::unique_ptr<CompositorAnimationTimeline> timeline = |
19 CompositorAnimationTimeline::create(); | 19 CompositorAnimationTimeline::create(); |
20 | 20 |
21 scoped_refptr<cc::AnimationTimeline> ccTimeline = | 21 scoped_refptr<cc::AnimationTimeline> ccTimeline = |
22 timeline->animationTimeline(); | 22 timeline->animationTimeline(); |
23 EXPECT_FALSE(ccTimeline->animation_host()); | 23 EXPECT_FALSE(ccTimeline->animation_host()); |
24 | 24 |
25 WebLayerTreeViewImplForTesting layerTreeView; | 25 WebLayerTreeViewImplForTesting layerTreeView; |
26 CompositorAnimationHost compositorAnimationHost( | 26 CompositorAnimationHost compositorAnimationHost( |
27 layerTreeView.compositorAnimationHost()); | 27 layerTreeView.compositorAnimationHost()); |
28 | 28 |
29 compositorAnimationHost.addTimeline(*timeline); | 29 compositorAnimationHost.addTimeline(*timeline); |
30 EXPECT_TRUE(ccTimeline->animation_host()); | 30 EXPECT_TRUE(ccTimeline->animation_host()); |
31 | 31 |
32 compositorAnimationHost.removeTimeline(*timeline); | 32 compositorAnimationHost.removeTimeline(*timeline); |
33 EXPECT_FALSE(ccTimeline->animation_host()); | 33 EXPECT_FALSE(ccTimeline->animation_host()); |
34 } | 34 } |
35 | 35 |
36 } // namespace blink | 36 } // namespace blink |
OLD | NEW |