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 "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
8 #include "cc/test/animation_test_common.h" | 8 #include "cc/test/animation_test_common.h" |
9 #include "testing/gmock/include/gmock/gmock.h" | 9 #include "testing/gmock/include/gmock/gmock.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
11 | 11 |
12 namespace cc { | 12 namespace cc { |
13 namespace { | 13 namespace { |
14 | 14 |
15 using base::TimeDelta; | 15 using base::TimeDelta; |
16 | 16 |
17 static base::TimeTicks TicksFromSecondsF(double seconds) { | 17 static base::TimeTicks TicksFromSecondsF(double seconds) { |
18 return base::TimeTicks::FromInternalValue(seconds * | 18 return base::TimeTicks::FromInternalValue(seconds * |
19 base::Time::kMicrosecondsPerSecond); | 19 base::Time::kMicrosecondsPerSecond); |
20 } | 20 } |
21 | 21 |
22 std::unique_ptr<Animation> CreateAnimation(double iterations, | 22 std::unique_ptr<Animation> CreateAnimation(double iterations, |
23 double duration, | 23 double duration, |
24 double playback_rate) { | 24 double playback_rate) { |
25 std::unique_ptr<Animation> to_return( | 25 std::unique_ptr<Animation> to_return( |
26 Animation::Create(base::WrapUnique(new FakeFloatAnimationCurve(duration)), | 26 Animation::Create(base::MakeUnique<FakeFloatAnimationCurve>(duration), 0, |
27 0, 1, TargetProperty::OPACITY)); | 27 1, TargetProperty::OPACITY)); |
28 to_return->set_iterations(iterations); | 28 to_return->set_iterations(iterations); |
29 to_return->set_playback_rate(playback_rate); | 29 to_return->set_playback_rate(playback_rate); |
30 return to_return; | 30 return to_return; |
31 } | 31 } |
32 | 32 |
33 std::unique_ptr<Animation> CreateAnimation(double iterations, double duration) { | 33 std::unique_ptr<Animation> CreateAnimation(double iterations, double duration) { |
34 return CreateAnimation(iterations, duration, 1); | 34 return CreateAnimation(iterations, duration, 1); |
35 } | 35 } |
36 | 36 |
37 std::unique_ptr<Animation> CreateAnimation(double iterations) { | 37 std::unique_ptr<Animation> CreateAnimation(double iterations) { |
(...skipping 959 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
997 EXPECT_TRUE(anim->InEffect(TicksFromSecondsF(1.0))); | 997 EXPECT_TRUE(anim->InEffect(TicksFromSecondsF(1.0))); |
998 | 998 |
999 anim->set_fill_mode(Animation::FillMode::BOTH); | 999 anim->set_fill_mode(Animation::FillMode::BOTH); |
1000 EXPECT_TRUE(anim->InEffect(TicksFromSecondsF(-1.0))); | 1000 EXPECT_TRUE(anim->InEffect(TicksFromSecondsF(-1.0))); |
1001 EXPECT_TRUE(anim->InEffect(TicksFromSecondsF(0.0))); | 1001 EXPECT_TRUE(anim->InEffect(TicksFromSecondsF(0.0))); |
1002 EXPECT_TRUE(anim->InEffect(TicksFromSecondsF(1.0))); | 1002 EXPECT_TRUE(anim->InEffect(TicksFromSecondsF(1.0))); |
1003 } | 1003 } |
1004 | 1004 |
1005 } // namespace | 1005 } // namespace |
1006 } // namespace cc | 1006 } // namespace cc |
OLD | NEW |