| 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 "core/animation/AnimationInputHelpers.h" | 5 #include "core/animation/AnimationInputHelpers.h" |
| 6 | 6 |
| 7 #include "core/dom/Element.h" | 7 #include "core/dom/Element.h" |
| 8 #include "core/dom/ExceptionCode.h" | 8 #include "core/dom/ExceptionCode.h" |
| 9 #include "core/testing/DummyPageHolder.h" | 9 #include "core/testing/DummyPageHolder.h" |
| 10 #include "platform/animation/TimingFunction.h" | 10 #include "platform/animation/TimingFunction.h" |
| 11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
| 12 #include <memory> | 12 #include <memory> |
| 13 | 13 |
| 14 namespace blink { | 14 namespace blink { |
| 15 | 15 |
| 16 class AnimationAnimationInputHelpersTest : public ::testing::Test { | 16 class AnimationAnimationInputHelpersTest : public ::testing::Test { |
| 17 public: | 17 public: |
| 18 CSSPropertyID keyframeAttributeToCSSProperty(const String& property) | 18 CSSPropertyID keyframeAttributeToCSSProperty(const String& property) |
| 19 { | 19 { |
| 20 return AnimationInputHelpers::keyframeAttributeToCSSProperty(property, *
document); | 20 return AnimationInputHelpers::keyframeAttributeToCSSProperty(property, *
document); |
| 21 } | 21 } |
| 22 | 22 |
| 23 PassRefPtr<TimingFunction> parseTimingFunction(const String& string, Excepti
onState& exceptionState) | 23 PassRefPtr<TimingFunction> parseTimingFunction(const String& string, Excepti
onState& exceptionState) |
| 24 { | 24 { |
| 25 return AnimationInputHelpers::parseTimingFunction(string, document, exce
ptionState); | 25 return AnimationInputHelpers::parseTimingFunction(string, *document, exc
eptionState); |
| 26 } | 26 } |
| 27 | 27 |
| 28 void timingFunctionRoundTrips(const String& string, ExceptionState& exceptio
nState) | 28 void timingFunctionRoundTrips(const String& string, ExceptionState& exceptio
nState) |
| 29 { | 29 { |
| 30 RefPtr<TimingFunction> timingFunction = parseTimingFunction(string, exce
ptionState); | 30 RefPtr<TimingFunction> timingFunction = parseTimingFunction(string, exce
ptionState); |
| 31 EXPECT_NE(nullptr, timingFunction); | 31 EXPECT_NE(nullptr, timingFunction); |
| 32 EXPECT_EQ(string, timingFunction->toString()); | 32 EXPECT_EQ(string, timingFunction->toString()); |
| 33 } | 33 } |
| 34 | 34 |
| 35 void timingFunctionThrows(const String& string, ExceptionState& exceptionSta
te) | 35 void timingFunctionThrows(const String& string, ExceptionState& exceptionSta
te) |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 timingFunctionRoundTrips("cubic-bezier(0.1, 5, 0.23, 0)", exceptionState); | 100 timingFunctionRoundTrips("cubic-bezier(0.1, 5, 0.23, 0)", exceptionState); |
| 101 | 101 |
| 102 EXPECT_EQ("steps(3, end)", parseTimingFunction("steps(3)", exceptionState)->
toString()); | 102 EXPECT_EQ("steps(3, end)", parseTimingFunction("steps(3)", exceptionState)->
toString()); |
| 103 | 103 |
| 104 timingFunctionThrows("steps(3, nowhere)", exceptionState); | 104 timingFunctionThrows("steps(3, nowhere)", exceptionState); |
| 105 timingFunctionThrows("steps(-3, end)", exceptionState); | 105 timingFunctionThrows("steps(-3, end)", exceptionState); |
| 106 timingFunctionThrows("cubic-bezier(0.1, 0, 4, 0.4)", exceptionState); | 106 timingFunctionThrows("cubic-bezier(0.1, 0, 4, 0.4)", exceptionState); |
| 107 } | 107 } |
| 108 | 108 |
| 109 } // namespace blink | 109 } // namespace blink |
| OLD | NEW |