| 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/animation/animation.h" | 5 #include "cc/animation/animation.h" |
| 6 | 6 |
| 7 #include "cc/test/animation_test_common.h" | 7 #include "cc/test/animation_test_common.h" |
| 8 #include "testing/gmock/include/gmock/gmock.h" | 8 #include "testing/gmock/include/gmock/gmock.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 | 10 |
| 11 namespace cc { | 11 namespace cc { |
| 12 namespace { | 12 namespace { |
| 13 | 13 |
| 14 using base::TimeDelta; | 14 using base::TimeDelta; |
| 15 | 15 |
| 16 static base::TimeTicks TicksFromSecondsF(double seconds) { | 16 static base::TimeTicks TicksFromSecondsF(double seconds) { |
| 17 return base::TimeTicks::FromInternalValue(seconds * | 17 return base::TimeTicks::FromInternalValue(seconds * |
| 18 base::Time::kMicrosecondsPerSecond); | 18 base::Time::kMicrosecondsPerSecond); |
| 19 } | 19 } |
| 20 | 20 |
| 21 scoped_ptr<Animation> CreateAnimation(double iterations, | 21 scoped_ptr<Animation> CreateAnimation(double iterations, |
| 22 double duration, | 22 double duration, |
| 23 double playback_rate) { | 23 double playback_rate) { |
| 24 scoped_ptr<Animation> to_return(Animation::Create( | 24 scoped_ptr<Animation> to_return( |
| 25 make_scoped_ptr( | 25 Animation::Create(make_scoped_ptr(new FakeFloatAnimationCurve(duration)), |
| 26 new FakeFloatAnimationCurve(duration)).PassAs<AnimationCurve>(), | 26 0, |
| 27 0, | 27 1, |
| 28 1, | 28 Animation::Opacity)); |
| 29 Animation::Opacity)); | |
| 30 to_return->set_iterations(iterations); | 29 to_return->set_iterations(iterations); |
| 31 to_return->set_playback_rate(playback_rate); | 30 to_return->set_playback_rate(playback_rate); |
| 32 return to_return.Pass(); | 31 return to_return.Pass(); |
| 33 } | 32 } |
| 34 | 33 |
| 35 scoped_ptr<Animation> CreateAnimation(double iterations, double duration) { | 34 scoped_ptr<Animation> CreateAnimation(double iterations, double duration) { |
| 36 return CreateAnimation(iterations, duration, 1); | 35 return CreateAnimation(iterations, duration, 1); |
| 37 } | 36 } |
| 38 | 37 |
| 39 scoped_ptr<Animation> CreateAnimation(double iterations) { | 38 scoped_ptr<Animation> CreateAnimation(double iterations) { |
| (...skipping 667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 707 EXPECT_TRUE(anim->InEffect(TicksFromSecondsF(1.0))); | 706 EXPECT_TRUE(anim->InEffect(TicksFromSecondsF(1.0))); |
| 708 | 707 |
| 709 anim->set_fill_mode(Animation::FillModeBoth); | 708 anim->set_fill_mode(Animation::FillModeBoth); |
| 710 EXPECT_TRUE(anim->InEffect(TicksFromSecondsF(-1.0))); | 709 EXPECT_TRUE(anim->InEffect(TicksFromSecondsF(-1.0))); |
| 711 EXPECT_TRUE(anim->InEffect(TicksFromSecondsF(0.0))); | 710 EXPECT_TRUE(anim->InEffect(TicksFromSecondsF(0.0))); |
| 712 EXPECT_TRUE(anim->InEffect(TicksFromSecondsF(1.0))); | 711 EXPECT_TRUE(anim->InEffect(TicksFromSecondsF(1.0))); |
| 713 } | 712 } |
| 714 | 713 |
| 715 } // namespace | 714 } // namespace |
| 716 } // namespace cc | 715 } // namespace cc |
| OLD | NEW |