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