| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "ui/gfx/compositor/layer_animator.h" | 5 #include "ui/gfx/compositor/layer_animator.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/time.h" | 10 #include "base/time.h" |
| (...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 621 | 621 |
| 622 EXPECT_TRUE(animator->is_animating()); | 622 EXPECT_TRUE(animator->is_animating()); |
| 623 EXPECT_FLOAT_EQ(delegate.GetOpacityForAnimation(), start_opacity); | 623 EXPECT_FLOAT_EQ(delegate.GetOpacityForAnimation(), start_opacity); |
| 624 | 624 |
| 625 element->Step(start_time + base::TimeDelta::FromMilliseconds(3000)); | 625 element->Step(start_time + base::TimeDelta::FromMilliseconds(3000)); |
| 626 | 626 |
| 627 EXPECT_TRUE(animator->is_animating()); | 627 EXPECT_TRUE(animator->is_animating()); |
| 628 EXPECT_FLOAT_EQ(delegate.GetOpacityForAnimation(), target_opacity); | 628 EXPECT_FLOAT_EQ(delegate.GetOpacityForAnimation(), target_opacity); |
| 629 | 629 |
| 630 // Skip ahead by a lot. | 630 // Skip ahead by a lot. |
| 631 element->Step(start_time + base::TimeDelta::FromMilliseconds(1000000000000)); | 631 element->Step(start_time + base::TimeDelta::FromMilliseconds(1000000000)); |
| 632 | 632 |
| 633 EXPECT_TRUE(animator->is_animating()); | 633 EXPECT_TRUE(animator->is_animating()); |
| 634 EXPECT_FLOAT_EQ(delegate.GetOpacityForAnimation(), start_opacity); | 634 EXPECT_FLOAT_EQ(delegate.GetOpacityForAnimation(), start_opacity); |
| 635 | 635 |
| 636 // Skip ahead by a lot. | 636 // Skip ahead by a lot. |
| 637 element->Step(start_time + base::TimeDelta::FromMilliseconds(1000000001000)); | 637 element->Step(start_time + base::TimeDelta::FromMilliseconds(1000001000)); |
| 638 | 638 |
| 639 EXPECT_TRUE(animator->is_animating()); | 639 EXPECT_TRUE(animator->is_animating()); |
| 640 EXPECT_FLOAT_EQ(delegate.GetOpacityForAnimation(), target_opacity); | 640 EXPECT_FLOAT_EQ(delegate.GetOpacityForAnimation(), target_opacity); |
| 641 | 641 |
| 642 animator->StopAnimatingProperty(LayerAnimationElement::OPACITY); | 642 animator->StopAnimatingProperty(LayerAnimationElement::OPACITY); |
| 643 | 643 |
| 644 EXPECT_FALSE(animator->is_animating()); | 644 EXPECT_FALSE(animator->is_animating()); |
| 645 } | 645 } |
| 646 | 646 |
| 647 TEST(LayerAnimatorTest, AddObserverExplicit) { | 647 TEST(LayerAnimatorTest, AddObserverExplicit) { |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 780 | 780 |
| 781 animator->SetOpacity(0.5); | 781 animator->SetOpacity(0.5); |
| 782 | 782 |
| 783 EXPECT_FALSE(animator->is_animating()); | 783 EXPECT_FALSE(animator->is_animating()); |
| 784 EXPECT_EQ(0.5, animator->GetTargetOpacity()); | 784 EXPECT_EQ(0.5, animator->GetTargetOpacity()); |
| 785 } | 785 } |
| 786 | 786 |
| 787 } // namespace | 787 } // namespace |
| 788 | 788 |
| 789 } // namespace ui | 789 } // namespace ui |
| OLD | NEW |