| 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> | |
| 13 | 12 |
| 14 namespace blink { | 13 namespace blink { |
| 15 | 14 |
| 16 class AnimationAnimationInputHelpersTest : public ::testing::Test { | 15 class AnimationAnimationInputHelpersTest : public ::testing::Test { |
| 17 public: | 16 public: |
| 18 CSSPropertyID keyframeAttributeToCSSProperty(const String& property) | 17 CSSPropertyID keyframeAttributeToCSSProperty(const String& property) |
| 19 { | 18 { |
| 20 return AnimationInputHelpers::keyframeAttributeToCSSProperty(property, *
document); | 19 return AnimationInputHelpers::keyframeAttributeToCSSProperty(property, *
document); |
| 21 } | 20 } |
| 22 | 21 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 46 pageHolder = DummyPageHolder::create(); | 45 pageHolder = DummyPageHolder::create(); |
| 47 document = &pageHolder->document(); | 46 document = &pageHolder->document(); |
| 48 } | 47 } |
| 49 | 48 |
| 50 void TearDown() override | 49 void TearDown() override |
| 51 { | 50 { |
| 52 document.release(); | 51 document.release(); |
| 53 ThreadHeap::collectAllGarbage(); | 52 ThreadHeap::collectAllGarbage(); |
| 54 } | 53 } |
| 55 | 54 |
| 56 std::unique_ptr<DummyPageHolder> pageHolder; | 55 OwnPtr<DummyPageHolder> pageHolder; |
| 57 Persistent<Document> document; | 56 Persistent<Document> document; |
| 58 TrackExceptionState exceptionState; | 57 TrackExceptionState exceptionState; |
| 59 }; | 58 }; |
| 60 | 59 |
| 61 TEST_F(AnimationAnimationInputHelpersTest, ParseKeyframePropertyAttributes) | 60 TEST_F(AnimationAnimationInputHelpersTest, ParseKeyframePropertyAttributes) |
| 62 { | 61 { |
| 63 EXPECT_EQ(CSSPropertyLineHeight, keyframeAttributeToCSSProperty("lineHeight"
)); | 62 EXPECT_EQ(CSSPropertyLineHeight, keyframeAttributeToCSSProperty("lineHeight"
)); |
| 64 EXPECT_EQ(CSSPropertyBorderTopWidth, keyframeAttributeToCSSProperty("borderT
opWidth")); | 63 EXPECT_EQ(CSSPropertyBorderTopWidth, keyframeAttributeToCSSProperty("borderT
opWidth")); |
| 65 EXPECT_EQ(CSSPropertyWidth, keyframeAttributeToCSSProperty("width")); | 64 EXPECT_EQ(CSSPropertyWidth, keyframeAttributeToCSSProperty("width")); |
| 66 EXPECT_EQ(CSSPropertyFloat, keyframeAttributeToCSSProperty("float")); | 65 EXPECT_EQ(CSSPropertyFloat, keyframeAttributeToCSSProperty("float")); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 timingFunctionRoundTrips("cubic-bezier(0.1, 5, 0.23, 0)", exceptionState); | 99 timingFunctionRoundTrips("cubic-bezier(0.1, 5, 0.23, 0)", exceptionState); |
| 101 | 100 |
| 102 EXPECT_EQ("steps(3, end)", parseTimingFunction("steps(3)", exceptionState)->
toString()); | 101 EXPECT_EQ("steps(3, end)", parseTimingFunction("steps(3)", exceptionState)->
toString()); |
| 103 | 102 |
| 104 timingFunctionThrows("steps(3, nowhere)", exceptionState); | 103 timingFunctionThrows("steps(3, nowhere)", exceptionState); |
| 105 timingFunctionThrows("steps(-3, end)", exceptionState); | 104 timingFunctionThrows("steps(-3, end)", exceptionState); |
| 106 timingFunctionThrows("cubic-bezier(0.1, 0, 4, 0.4)", exceptionState); | 105 timingFunctionThrows("cubic-bezier(0.1, 0, 4, 0.4)", exceptionState); |
| 107 } | 106 } |
| 108 | 107 |
| 109 } // namespace blink | 108 } // namespace blink |
| OLD | NEW |