| 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/test/animation_timelines_test_common.h" | 5 #include "cc/test/animation_timelines_test_common.h" |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "cc/animation/animation_events.h" | 8 #include "cc/animation/animation_events.h" |
| 9 #include "cc/animation/animation_id_provider.h" | 9 #include "cc/animation/animation_id_provider.h" |
| 10 #include "cc/animation/animation_player.h" | 10 #include "cc/animation/animation_player.h" |
| 11 #include "cc/animation/animation_registrar.h" | |
| 12 #include "cc/animation/animation_timeline.h" | 11 #include "cc/animation/animation_timeline.h" |
| 13 #include "cc/animation/element_animations.h" | 12 #include "cc/animation/element_animations.h" |
| 14 #include "cc/output/filter_operation.h" | 13 #include "cc/output/filter_operation.h" |
| 15 #include "cc/output/filter_operations.h" | 14 #include "cc/output/filter_operations.h" |
| 16 #include "ui/gfx/transform.h" | 15 #include "ui/gfx/transform.h" |
| 17 | 16 |
| 18 namespace cc { | 17 namespace cc { |
| 19 | 18 |
| 20 std::unique_ptr<TestLayer> TestLayer::Create() { | 19 std::unique_ptr<TestLayer> TestLayer::Create() { |
| 21 return base::WrapUnique(new TestLayer()); | 20 return base::WrapUnique(new TestLayer()); |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 void AnimationTimelinesTest::ReleaseRefPtrs() { | 227 void AnimationTimelinesTest::ReleaseRefPtrs() { |
| 229 player_ = nullptr; | 228 player_ = nullptr; |
| 230 timeline_ = nullptr; | 229 timeline_ = nullptr; |
| 231 player_impl_ = nullptr; | 230 player_impl_ = nullptr; |
| 232 timeline_impl_ = nullptr; | 231 timeline_impl_ = nullptr; |
| 233 } | 232 } |
| 234 | 233 |
| 235 void AnimationTimelinesTest::AnimateLayersTransferEvents( | 234 void AnimationTimelinesTest::AnimateLayersTransferEvents( |
| 236 base::TimeTicks time, | 235 base::TimeTicks time, |
| 237 unsigned expect_events) { | 236 unsigned expect_events) { |
| 238 std::unique_ptr<AnimationEvents> events = | 237 std::unique_ptr<AnimationEvents> events = host_->CreateEvents(); |
| 239 host_->animation_registrar()->CreateEvents(); | |
| 240 | 238 |
| 241 host_impl_->animation_registrar()->AnimateLayers(time); | 239 host_impl_->AnimateLayers(time); |
| 242 host_impl_->animation_registrar()->UpdateAnimationState(true, events.get()); | 240 host_impl_->UpdateAnimationState(true, events.get()); |
| 243 EXPECT_EQ(expect_events, events->events_.size()); | 241 EXPECT_EQ(expect_events, events->events_.size()); |
| 244 | 242 |
| 245 host_->animation_registrar()->AnimateLayers(time); | 243 host_->AnimateLayers(time); |
| 246 host_->animation_registrar()->UpdateAnimationState(true, nullptr); | 244 host_->UpdateAnimationState(true, nullptr); |
| 247 host_->animation_registrar()->SetAnimationEvents(std::move(events)); | 245 host_->SetAnimationEvents(std::move(events)); |
| 248 } | 246 } |
| 249 | 247 |
| 250 AnimationPlayer* AnimationTimelinesTest::GetPlayerForLayerId(int layer_id) { | 248 AnimationPlayer* AnimationTimelinesTest::GetPlayerForLayerId(int layer_id) { |
| 251 const ElementAnimations* element_animations = | 249 const ElementAnimations* element_animations = |
| 252 host_->GetElementAnimationsForLayerId(layer_id); | 250 host_->GetElementAnimationsForLayerId(layer_id); |
| 253 return element_animations ? element_animations->players_list().head()->value() | 251 return element_animations ? element_animations->players_list().head()->value() |
| 254 : nullptr; | 252 : nullptr; |
| 255 } | 253 } |
| 256 | 254 |
| 257 AnimationPlayer* AnimationTimelinesTest::GetImplPlayerForLayerId(int layer_id) { | 255 AnimationPlayer* AnimationTimelinesTest::GetImplPlayerForLayerId(int layer_id) { |
| 258 const ElementAnimations* element_animations = | 256 const ElementAnimations* element_animations = |
| 259 host_impl_->GetElementAnimationsForLayerId(layer_id); | 257 host_impl_->GetElementAnimationsForLayerId(layer_id); |
| 260 return element_animations ? element_animations->players_list().head()->value() | 258 return element_animations ? element_animations->players_list().head()->value() |
| 261 : nullptr; | 259 : nullptr; |
| 262 } | 260 } |
| 263 | 261 |
| 264 int AnimationTimelinesTest::NextTestLayerId() { | 262 int AnimationTimelinesTest::NextTestLayerId() { |
| 265 next_test_layer_id_++; | 263 next_test_layer_id_++; |
| 266 return next_test_layer_id_; | 264 return next_test_layer_id_; |
| 267 } | 265 } |
| 268 | 266 |
| 269 } // namespace cc | 267 } // namespace cc |
| OLD | NEW |