| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "base/memory/scoped_ptr.h" | 5 #include "base/memory/scoped_ptr.h" |
| 6 #include "cc/animation/timing_function.h" | 6 #include "cc/animation/timing_function.h" |
| 7 #include "content/renderer/compositor_bindings/web_float_animation_curve_impl.h" | 7 #include "cc/blink/web_float_animation_curve_impl.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 | 9 |
| 10 using blink::WebCompositorAnimationCurve; | 10 using blink::WebCompositorAnimationCurve; |
| 11 using blink::WebFloatAnimationCurve; | 11 using blink::WebFloatAnimationCurve; |
| 12 using blink::WebFloatKeyframe; | 12 using blink::WebFloatKeyframe; |
| 13 | 13 |
| 14 namespace content { | 14 namespace cc_blink { |
| 15 namespace { | 15 namespace { |
| 16 | 16 |
| 17 // Tests that a float animation with one keyframe works as expected. | 17 // Tests that a float animation with one keyframe works as expected. |
| 18 TEST(WebFloatAnimationCurveTest, OneFloatKeyframe) { | 18 TEST(WebFloatAnimationCurveTest, OneFloatKeyframe) { |
| 19 scoped_ptr<WebFloatAnimationCurve> curve(new WebFloatAnimationCurveImpl); | 19 scoped_ptr<WebFloatAnimationCurve> curve(new WebFloatAnimationCurveImpl); |
| 20 curve->add(WebFloatKeyframe(0, 2), | 20 curve->add(WebFloatKeyframe(0, 2), |
| 21 WebCompositorAnimationCurve::TimingFunctionTypeLinear); | 21 WebCompositorAnimationCurve::TimingFunctionTypeLinear); |
| 22 EXPECT_FLOAT_EQ(2, curve->getValue(-1)); | 22 EXPECT_FLOAT_EQ(2, curve->getValue(-1)); |
| 23 EXPECT_FLOAT_EQ(2, curve->getValue(0)); | 23 EXPECT_FLOAT_EQ(2, curve->getValue(0)); |
| 24 EXPECT_FLOAT_EQ(2, curve->getValue(0.5)); | 24 EXPECT_FLOAT_EQ(2, curve->getValue(0.5)); |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 | 224 |
| 225 scoped_ptr<cc::TimingFunction> timing_function( | 225 scoped_ptr<cc::TimingFunction> timing_function( |
| 226 cc::EaseTimingFunction::Create()); | 226 cc::EaseTimingFunction::Create()); |
| 227 for (int i = 0; i <= 4; ++i) { | 227 for (int i = 0; i <= 4; ++i) { |
| 228 const double time = i * 0.25; | 228 const double time = i * 0.25; |
| 229 EXPECT_FLOAT_EQ(timing_function->GetValue(time), curve->getValue(time)); | 229 EXPECT_FLOAT_EQ(timing_function->GetValue(time), curve->getValue(time)); |
| 230 } | 230 } |
| 231 } | 231 } |
| 232 | 232 |
| 233 } // namespace | 233 } // namespace |
| 234 } // namespace content | 234 } // namespace cc_blink |
| 235 | |
| OLD | NEW |