OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/trees/layer_tree_host.h" | 5 #include "cc/trees/layer_tree_host.h" |
6 | 6 |
7 #include "cc/animation/animation_curve.h" | 7 #include "cc/animation/animation_curve.h" |
8 #include "cc/animation/layer_animation_controller.h" | 8 #include "cc/animation/layer_animation_controller.h" |
9 #include "cc/animation/scroll_offset_animation_curve.h" | 9 #include "cc/animation/scroll_offset_animation_curve.h" |
10 #include "cc/animation/timing_function.h" | 10 #include "cc/animation/timing_function.h" |
(...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
561 } | 561 } |
562 | 562 |
563 virtual void NotifyAnimationStarted( | 563 virtual void NotifyAnimationStarted( |
564 base::TimeTicks monotonic_time, | 564 base::TimeTicks monotonic_time, |
565 Animation::TargetProperty target_property) OVERRIDE { | 565 Animation::TargetProperty target_property) OVERRIDE { |
566 LayerAnimationController* controller = | 566 LayerAnimationController* controller = |
567 layer_tree_host()->root_layer()->children()[0]-> | 567 layer_tree_host()->root_layer()->children()[0]-> |
568 layer_animation_controller(); | 568 layer_animation_controller(); |
569 Animation* animation = | 569 Animation* animation = |
570 controller->GetAnimation(Animation::Opacity); | 570 controller->GetAnimation(Animation::Opacity); |
571 main_start_time_ = animation->start_time(); | 571 main_start_time_ = |
| 572 (animation->start_time() - base::TimeTicks()).InSecondsF(); |
572 controller->RemoveAnimation(animation->id()); | 573 controller->RemoveAnimation(animation->id()); |
573 | 574 |
574 if (impl_start_time_ > 0.0) | 575 if (impl_start_time_ > 0.0) |
575 EndTest(); | 576 EndTest(); |
576 } | 577 } |
577 | 578 |
578 virtual void UpdateAnimationState( | 579 virtual void UpdateAnimationState( |
579 LayerTreeHostImpl* impl_host, | 580 LayerTreeHostImpl* impl_host, |
580 bool has_unfinished_animation) OVERRIDE { | 581 bool has_unfinished_animation) OVERRIDE { |
581 LayerAnimationController* controller = | 582 LayerAnimationController* controller = |
582 impl_host->active_tree()->root_layer()->children()[0]-> | 583 impl_host->active_tree()->root_layer()->children()[0]-> |
583 layer_animation_controller(); | 584 layer_animation_controller(); |
584 Animation* animation = | 585 Animation* animation = |
585 controller->GetAnimation(Animation::Opacity); | 586 controller->GetAnimation(Animation::Opacity); |
586 if (!animation) | 587 if (!animation) |
587 return; | 588 return; |
588 | 589 |
589 impl_start_time_ = animation->start_time(); | 590 impl_start_time_ = |
| 591 (animation->start_time() - base::TimeTicks()).InSecondsF(); |
590 controller->RemoveAnimation(animation->id()); | 592 controller->RemoveAnimation(animation->id()); |
591 | 593 |
592 if (main_start_time_ > 0.0) | 594 if (main_start_time_ > 0.0) |
593 EndTest(); | 595 EndTest(); |
594 } | 596 } |
595 | 597 |
596 virtual void AfterTest() OVERRIDE { | 598 virtual void AfterTest() OVERRIDE { |
597 EXPECT_FLOAT_EQ(impl_start_time_, main_start_time_); | 599 EXPECT_FLOAT_EQ(impl_start_time_, main_start_time_); |
598 } | 600 } |
599 | 601 |
(...skipping 761 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1361 AnimationRegistrar::AnimationControllerMap copy = | 1363 AnimationRegistrar::AnimationControllerMap copy = |
1362 host_impl->animation_registrar()->active_animation_controllers(); | 1364 host_impl->animation_registrar()->active_animation_controllers(); |
1363 EXPECT_EQ(2u, copy.size()); | 1365 EXPECT_EQ(2u, copy.size()); |
1364 for (AnimationRegistrar::AnimationControllerMap::iterator iter = | 1366 for (AnimationRegistrar::AnimationControllerMap::iterator iter = |
1365 copy.begin(); | 1367 copy.begin(); |
1366 iter != copy.end(); | 1368 iter != copy.end(); |
1367 ++iter) { | 1369 ++iter) { |
1368 int id = ((*iter).second->id()); | 1370 int id = ((*iter).second->id()); |
1369 if (id == host_impl->RootLayer()->id()) { | 1371 if (id == host_impl->RootLayer()->id()) { |
1370 Animation* anim = (*iter).second->GetAnimation(Animation::Transform); | 1372 Animation* anim = (*iter).second->GetAnimation(Animation::Transform); |
1371 EXPECT_GT(anim->start_time(), 0); | 1373 EXPECT_GT((anim->start_time() - base::TimeTicks()).InSecondsF(), 0); |
1372 } else if (id == host_impl->RootLayer()->children()[0]->id()) { | 1374 } else if (id == host_impl->RootLayer()->children()[0]->id()) { |
1373 Animation* anim = (*iter).second->GetAnimation(Animation::Opacity); | 1375 Animation* anim = (*iter).second->GetAnimation(Animation::Opacity); |
1374 EXPECT_GT(anim->start_time(), 0); | 1376 EXPECT_GT((anim->start_time() - base::TimeTicks()).InSecondsF(), 0); |
1375 } | 1377 } |
1376 } | 1378 } |
1377 } | 1379 } |
1378 } | 1380 } |
1379 | 1381 |
1380 virtual void AfterTest() OVERRIDE {} | 1382 virtual void AfterTest() OVERRIDE {} |
1381 | 1383 |
1382 private: | 1384 private: |
1383 scoped_refptr<Layer> content_; | 1385 scoped_refptr<Layer> content_; |
1384 int num_swap_buffers_; | 1386 int num_swap_buffers_; |
1385 }; | 1387 }; |
1386 | 1388 |
1387 SINGLE_AND_MULTI_THREAD_TEST_F( | 1389 SINGLE_AND_MULTI_THREAD_TEST_F( |
1388 LayerTreeHostAnimationTestAddAnimationAfterAnimating); | 1390 LayerTreeHostAnimationTestAddAnimationAfterAnimating); |
1389 | 1391 |
1390 } // namespace | 1392 } // namespace |
1391 } // namespace cc | 1393 } // namespace cc |
OLD | NEW |