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" |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 : client_(ThreadInstance::MAIN), | 288 : client_(ThreadInstance::MAIN), |
289 client_impl_(ThreadInstance::IMPL), | 289 client_impl_(ThreadInstance::IMPL), |
290 host_(nullptr), | 290 host_(nullptr), |
291 host_impl_(nullptr), | 291 host_impl_(nullptr), |
292 timeline_id_(AnimationIdProvider::NextTimelineId()), | 292 timeline_id_(AnimationIdProvider::NextTimelineId()), |
293 player_id_(AnimationIdProvider::NextPlayerId()), | 293 player_id_(AnimationIdProvider::NextPlayerId()), |
294 next_test_layer_id_(0) { | 294 next_test_layer_id_(0) { |
295 host_ = client_.host(); | 295 host_ = client_.host(); |
296 host_impl_ = client_impl_.host(); | 296 host_impl_ = client_impl_.host(); |
297 | 297 |
298 layer_id_ = NextTestLayerId(); | 298 element_id_ = NextTestLayerId(); |
299 } | 299 } |
300 | 300 |
301 AnimationTimelinesTest::~AnimationTimelinesTest() { | 301 AnimationTimelinesTest::~AnimationTimelinesTest() { |
302 } | 302 } |
303 | 303 |
304 void AnimationTimelinesTest::SetUp() { | 304 void AnimationTimelinesTest::SetUp() { |
305 timeline_ = AnimationTimeline::Create(timeline_id_); | 305 timeline_ = AnimationTimeline::Create(timeline_id_); |
306 player_ = AnimationPlayer::Create(player_id_); | 306 player_ = AnimationPlayer::Create(player_id_); |
307 } | 307 } |
308 | 308 |
309 void AnimationTimelinesTest::TearDown() { | 309 void AnimationTimelinesTest::TearDown() { |
310 host_impl_->ClearTimelines(); | 310 host_impl_->ClearTimelines(); |
311 host_->ClearTimelines(); | 311 host_->ClearTimelines(); |
312 } | 312 } |
313 | 313 |
314 void AnimationTimelinesTest::CreateTestLayer( | 314 void AnimationTimelinesTest::CreateTestLayer( |
315 bool needs_active_value_observations, | 315 bool needs_active_value_observations, |
316 bool needs_pending_value_observations) { | 316 bool needs_pending_value_observations) { |
317 CreateTestMainLayer(); | 317 CreateTestMainLayer(); |
318 | 318 |
319 if (needs_pending_value_observations) | 319 if (needs_pending_value_observations) |
320 CreateTestImplLayer(LayerTreeType::PENDING); | 320 CreateTestImplLayer(LayerTreeType::PENDING); |
321 if (needs_active_value_observations) | 321 if (needs_active_value_observations) |
322 CreateTestImplLayer(LayerTreeType::ACTIVE); | 322 CreateTestImplLayer(LayerTreeType::ACTIVE); |
323 } | 323 } |
324 | 324 |
325 void AnimationTimelinesTest::CreateTestMainLayer() { | 325 void AnimationTimelinesTest::CreateTestMainLayer() { |
326 client_.RegisterLayer(layer_id_, LayerTreeType::ACTIVE); | 326 client_.RegisterLayer(element_id_, LayerTreeType::ACTIVE); |
327 } | 327 } |
328 | 328 |
329 void AnimationTimelinesTest::CreateTestImplLayer( | 329 void AnimationTimelinesTest::CreateTestImplLayer( |
330 LayerTreeType layer_tree_type) { | 330 LayerTreeType layer_tree_type) { |
331 client_impl_.RegisterLayer(layer_id_, layer_tree_type); | 331 client_impl_.RegisterLayer(element_id_, layer_tree_type); |
332 } | 332 } |
333 | 333 |
334 void AnimationTimelinesTest::AttachTimelinePlayerLayer() { | 334 void AnimationTimelinesTest::AttachTimelinePlayerLayer() { |
335 host_->AddAnimationTimeline(timeline_); | 335 host_->AddAnimationTimeline(timeline_); |
336 timeline_->AttachPlayer(player_); | 336 timeline_->AttachPlayer(player_); |
337 player_->AttachLayer(layer_id_); | 337 player_->AttachLayer(element_id_); |
338 } | 338 } |
339 | 339 |
340 void AnimationTimelinesTest::CreateImplTimelineAndPlayer() { | 340 void AnimationTimelinesTest::CreateImplTimelineAndPlayer() { |
341 host_->PushPropertiesTo(host_impl_); | 341 host_->PushPropertiesTo(host_impl_); |
342 GetImplTimelineAndPlayerByID(); | 342 GetImplTimelineAndPlayerByID(); |
343 } | 343 } |
344 | 344 |
345 scoped_refptr<ElementAnimations> AnimationTimelinesTest::element_animations() | 345 scoped_refptr<ElementAnimations> AnimationTimelinesTest::element_animations() |
346 const { | 346 const { |
347 DCHECK(player_); | 347 DCHECK(player_); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 return element_animations ? element_animations->players_list().head()->value() | 397 return element_animations ? element_animations->players_list().head()->value() |
398 : nullptr; | 398 : nullptr; |
399 } | 399 } |
400 | 400 |
401 int AnimationTimelinesTest::NextTestLayerId() { | 401 int AnimationTimelinesTest::NextTestLayerId() { |
402 next_test_layer_id_++; | 402 next_test_layer_id_++; |
403 return next_test_layer_id_; | 403 return next_test_layer_id_; |
404 } | 404 } |
405 | 405 |
406 } // namespace cc | 406 } // namespace cc |
OLD | NEW |