| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2013, Google Inc. All rights reserved. | 2 * Copyright (c) 2013, Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #include "config.h" | 31 #include "config.h" |
| 32 #include "core/animation/DocumentTimeline.h" | 32 #include "core/animation/DocumentTimeline.h" |
| 33 | 33 |
| 34 #include "core/animation/Animation.h" | 34 #include "core/animation/Animation.h" |
| 35 #include "core/animation/AnimationClock.h" | |
| 36 #include "core/animation/KeyframeAnimationEffect.h" | 35 #include "core/animation/KeyframeAnimationEffect.h" |
| 37 #include "core/animation/TimedItem.h" | 36 #include "core/animation/TimedItem.h" |
| 38 #include "core/dom/Document.h" | 37 #include "core/dom/Document.h" |
| 39 #include "core/dom/Element.h" | 38 #include "core/dom/Element.h" |
| 40 #include "core/dom/QualifiedName.h" | 39 #include "core/dom/QualifiedName.h" |
| 41 #include "weborigin/KURL.h" | 40 #include "weborigin/KURL.h" |
| 42 #include <gtest/gtest.h> | 41 #include <gtest/gtest.h> |
| 43 | 42 |
| 44 using namespace WebCore; | 43 using namespace WebCore; |
| 45 | 44 |
| 46 namespace { | 45 namespace { |
| 47 | 46 |
| 48 class CoreAnimationDocumentTimelineTest : public ::testing::Test { | 47 class CoreAnimationDocumentTimelineTest : public ::testing::Test { |
| 49 protected: | 48 protected: |
| 50 virtual void SetUp() | 49 virtual void SetUp() |
| 51 { | 50 { |
| 52 document = Document::create(); | 51 document = Document::create(); |
| 53 element = Element::create(nullQName() , document.get()); | 52 element = Element::create(nullQName() , document.get()); |
| 54 timeline = DocumentTimeline::create(document.get()); | 53 timeline = DocumentTimeline::create(document.get()); |
| 55 timeline->setZeroTimeAsPerfTime(0); | 54 timeline->setZeroTimeAsPerfTime(0); |
| 56 document->animationClock().updateTime(0); | |
| 57 ASSERT_EQ(0, timeline->currentTime()); | 55 ASSERT_EQ(0, timeline->currentTime()); |
| 58 } | 56 } |
| 59 | 57 |
| 60 RefPtr<Document> document; | 58 RefPtr<Document> document; |
| 61 RefPtr<Element> element; | 59 RefPtr<Element> element; |
| 62 RefPtr<DocumentTimeline> timeline; | 60 RefPtr<DocumentTimeline> timeline; |
| 63 Timing timing; | 61 Timing timing; |
| 64 }; | 62 }; |
| 65 | 63 |
| 66 TEST_F(CoreAnimationDocumentTimelineTest, EmptyKeyframeAnimation) | 64 TEST_F(CoreAnimationDocumentTimelineTest, EmptyKeyframeAnimation) |
| (...skipping 15 matching lines...) Expand all Loading... |
| 82 { | 80 { |
| 83 timeline = DocumentTimeline::create(document.get()); | 81 timeline = DocumentTimeline::create(document.get()); |
| 84 | 82 |
| 85 timeline->serviceAnimations(100); | 83 timeline->serviceAnimations(100); |
| 86 EXPECT_TRUE(isNull(timeline->currentTime())); | 84 EXPECT_TRUE(isNull(timeline->currentTime())); |
| 87 | 85 |
| 88 timeline->serviceAnimations(200); | 86 timeline->serviceAnimations(200); |
| 89 EXPECT_TRUE(isNull(timeline->currentTime())); | 87 EXPECT_TRUE(isNull(timeline->currentTime())); |
| 90 | 88 |
| 91 timeline->setZeroTimeAsPerfTime(300); | 89 timeline->setZeroTimeAsPerfTime(300); |
| 92 document->animationClock().updateTime(300); | |
| 93 timeline->serviceAnimations(300); | 90 timeline->serviceAnimations(300); |
| 94 EXPECT_EQ(0, timeline->currentTime()); | 91 EXPECT_EQ(0, timeline->currentTime()); |
| 95 | 92 |
| 96 timeline->serviceAnimations(400); | 93 timeline->serviceAnimations(400); |
| 97 EXPECT_EQ(100, timeline->currentTime()); | 94 EXPECT_EQ(100, timeline->currentTime()); |
| 98 } | 95 } |
| 99 | 96 |
| 100 TEST_F(CoreAnimationDocumentTimelineTest, PauseForTesting) | 97 TEST_F(CoreAnimationDocumentTimelineTest, PauseForTesting) |
| 101 { | 98 { |
| 102 float seekTime = 1; | 99 float seekTime = 1; |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 EXPECT_EQ(4U, timeline->numberOfActiveAnimationsForTesting()); | 144 EXPECT_EQ(4U, timeline->numberOfActiveAnimationsForTesting()); |
| 148 timeline->serviceAnimations(0.5); | 145 timeline->serviceAnimations(0.5); |
| 149 EXPECT_EQ(4U, timeline->numberOfActiveAnimationsForTesting()); | 146 EXPECT_EQ(4U, timeline->numberOfActiveAnimationsForTesting()); |
| 150 timeline->serviceAnimations(1.5); | 147 timeline->serviceAnimations(1.5); |
| 151 EXPECT_EQ(4U, timeline->numberOfActiveAnimationsForTesting()); | 148 EXPECT_EQ(4U, timeline->numberOfActiveAnimationsForTesting()); |
| 152 timeline->serviceAnimations(3); | 149 timeline->serviceAnimations(3); |
| 153 EXPECT_EQ(1U, timeline->numberOfActiveAnimationsForTesting()); | 150 EXPECT_EQ(1U, timeline->numberOfActiveAnimationsForTesting()); |
| 154 } | 151 } |
| 155 | 152 |
| 156 } | 153 } |
| OLD | NEW |