OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "cc/animation/animation_host.h" | 5 #include "cc/animation/animation_host.h" |
6 | 6 |
7 #include "cc/animation/animation_id_provider.h" | 7 #include "cc/animation/animation_id_provider.h" |
8 #include "cc/animation/animation_timeline.h" | 8 #include "cc/animation/animation_timeline.h" |
9 #include "cc/test/animation_test_common.h" | 9 #include "cc/test/animation_test_common.h" |
10 #include "cc/test/animation_timelines_test_common.h" | 10 #include "cc/test/animation_timelines_test_common.h" |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 host->AddAnimationTimeline(timeline.get()); | 74 host->AddAnimationTimeline(timeline.get()); |
75 host_impl->AddAnimationTimeline(timeline_impl.get()); | 75 host_impl->AddAnimationTimeline(timeline_impl.get()); |
76 | 76 |
77 host->PushPropertiesTo(host_impl.get()); | 77 host->PushPropertiesTo(host_impl.get()); |
78 | 78 |
79 EXPECT_TRUE(host->GetTimelineById(timeline_id1)); | 79 EXPECT_TRUE(host->GetTimelineById(timeline_id1)); |
80 EXPECT_TRUE(host_impl->GetTimelineById(timeline_id2)); | 80 EXPECT_TRUE(host_impl->GetTimelineById(timeline_id2)); |
81 } | 81 } |
82 | 82 |
83 TEST_F(AnimationHostTest, ImplOnlyScrollAnimationUpdateTargetIfDetached) { | 83 TEST_F(AnimationHostTest, ImplOnlyScrollAnimationUpdateTargetIfDetached) { |
84 client_.RegisterLayer(layer_id_, LayerTreeType::ACTIVE); | 84 client_.RegisterLayer(element_id_, LayerTreeType::ACTIVE); |
85 client_impl_.RegisterLayer(layer_id_, LayerTreeType::PENDING); | 85 client_impl_.RegisterLayer(element_id_, LayerTreeType::PENDING); |
86 | 86 |
87 gfx::ScrollOffset target_offset(0., 2.); | 87 gfx::ScrollOffset target_offset(0., 2.); |
88 gfx::ScrollOffset current_offset(0., 1.); | 88 gfx::ScrollOffset current_offset(0., 1.); |
89 host_impl_->ImplOnlyScrollAnimationCreate(layer_id_, target_offset, | 89 host_impl_->ImplOnlyScrollAnimationCreate(element_id_, target_offset, |
90 current_offset); | 90 current_offset); |
91 | 91 |
92 gfx::Vector2dF scroll_delta(0, 0.5); | 92 gfx::Vector2dF scroll_delta(0, 0.5); |
93 gfx::ScrollOffset max_scroll_offset(0., 3.); | 93 gfx::ScrollOffset max_scroll_offset(0., 3.); |
94 | 94 |
95 base::TimeTicks time; | 95 base::TimeTicks time; |
96 | 96 |
97 time += base::TimeDelta::FromSecondsD(0.1); | 97 time += base::TimeDelta::FromSecondsD(0.1); |
98 EXPECT_TRUE(host_impl_->ImplOnlyScrollAnimationUpdateTarget( | 98 EXPECT_TRUE(host_impl_->ImplOnlyScrollAnimationUpdateTarget( |
99 layer_id_, scroll_delta, max_scroll_offset, time)); | 99 element_id_, scroll_delta, max_scroll_offset, time)); |
100 | 100 |
101 // Detach all players from layers and timelines. | 101 // Detach all players from layers and timelines. |
102 host_impl_->ClearTimelines(); | 102 host_impl_->ClearTimelines(); |
103 | 103 |
104 time += base::TimeDelta::FromSecondsD(0.1); | 104 time += base::TimeDelta::FromSecondsD(0.1); |
105 EXPECT_FALSE(host_impl_->ImplOnlyScrollAnimationUpdateTarget( | 105 EXPECT_FALSE(host_impl_->ImplOnlyScrollAnimationUpdateTarget( |
106 layer_id_, scroll_delta, max_scroll_offset, time)); | 106 element_id_, scroll_delta, max_scroll_offset, time)); |
107 } | 107 } |
108 | 108 |
109 } // namespace | 109 } // namespace |
110 } // namespace cc | 110 } // namespace cc |
OLD | NEW |