| 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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 } | 77 } |
| 78 | 78 |
| 79 bool simulateFrame(double time) | 79 bool simulateFrame(double time) |
| 80 { | 80 { |
| 81 document->animationClock().updateTime(time); | 81 document->animationClock().updateTime(time); |
| 82 document->compositorPendingAnimations().update(false); | 82 document->compositorPendingAnimations().update(false); |
| 83 // The timeline does not know about our animation, so we have to explici
tly call update(). | 83 // The timeline does not know about our animation, so we have to explici
tly call update(). |
| 84 return animation->update(TimingUpdateForAnimationFrame); | 84 return animation->update(TimingUpdateForAnimationFrame); |
| 85 } | 85 } |
| 86 | 86 |
| 87 RefPtrWillBePersistent<Document> document; | 87 Persistent<Document> document; |
| 88 Persistent<AnimationTimeline> timeline; | 88 Persistent<AnimationTimeline> timeline; |
| 89 Persistent<Animation> animation; | 89 Persistent<Animation> animation; |
| 90 TrackExceptionState exceptionState; | 90 TrackExceptionState exceptionState; |
| 91 OwnPtr<DummyPageHolder> pageHolder; | 91 OwnPtr<DummyPageHolder> pageHolder; |
| 92 }; | 92 }; |
| 93 | 93 |
| 94 TEST_F(AnimationAnimationTest, InitialState) | 94 TEST_F(AnimationAnimationTest, InitialState) |
| 95 { | 95 { |
| 96 setUpWithoutStartingTimeline(); | 96 setUpWithoutStartingTimeline(); |
| 97 animation = timeline->play(0); | 97 animation = timeline->play(0); |
| (...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 720 animation->cancel(); | 720 animation->cancel(); |
| 721 animation->update(TimingUpdateOnDemand); | 721 animation->update(TimingUpdateOnDemand); |
| 722 // This frame will fire the finish event event though no start time has been | 722 // This frame will fire the finish event event though no start time has been |
| 723 // received from the compositor yet, as cancel() nukes start times. | 723 // received from the compositor yet, as cancel() nukes start times. |
| 724 simulateFrame(0); | 724 simulateFrame(0); |
| 725 EXPECT_EQ(std::numeric_limits<double>::infinity(), animation->timeToEffectCh
ange()); | 725 EXPECT_EQ(std::numeric_limits<double>::infinity(), animation->timeToEffectCh
ange()); |
| 726 } | 726 } |
| 727 | 727 |
| 728 TEST_F(AnimationAnimationTest, AttachedAnimations) | 728 TEST_F(AnimationAnimationTest, AttachedAnimations) |
| 729 { | 729 { |
| 730 RefPtrWillBePersistent<Element> element = document->createElement("foo", ASS
ERT_NO_EXCEPTION); | 730 Persistent<Element> element = document->createElement("foo", ASSERT_NO_EXCEP
TION); |
| 731 | 731 |
| 732 Timing timing; | 732 Timing timing; |
| 733 KeyframeEffect* keyframeEffect = KeyframeEffect::create(element.get(), nullp
tr, timing); | 733 KeyframeEffect* keyframeEffect = KeyframeEffect::create(element.get(), nullp
tr, timing); |
| 734 Animation* animation = timeline->play(keyframeEffect); | 734 Animation* animation = timeline->play(keyframeEffect); |
| 735 simulateFrame(0); | 735 simulateFrame(0); |
| 736 timeline->serviceAnimations(TimingUpdateForAnimationFrame); | 736 timeline->serviceAnimations(TimingUpdateForAnimationFrame); |
| 737 EXPECT_EQ(1U, element->elementAnimations()->animations().find(animation)->va
lue); | 737 EXPECT_EQ(1U, element->elementAnimations()->animations().find(animation)->va
lue); |
| 738 | 738 |
| 739 Heap::collectAllGarbage(); | 739 Heap::collectAllGarbage(); |
| 740 EXPECT_TRUE(element->elementAnimations()->animations().isEmpty()); | 740 EXPECT_TRUE(element->elementAnimations()->animations().isEmpty()); |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 816 EXPECT_EQ(Animation::Idle, animation->playStateInternal()); | 816 EXPECT_EQ(Animation::Idle, animation->playStateInternal()); |
| 817 EXPECT_TRUE(std::isnan(animation->currentTime())); | 817 EXPECT_TRUE(std::isnan(animation->currentTime())); |
| 818 EXPECT_TRUE(std::isnan(animation->startTime())); | 818 EXPECT_TRUE(std::isnan(animation->startTime())); |
| 819 animation->pause(); | 819 animation->pause(); |
| 820 EXPECT_EQ(Animation::Pending, animation->playStateInternal()); | 820 EXPECT_EQ(Animation::Pending, animation->playStateInternal()); |
| 821 EXPECT_EQ(0, animation->currentTime()); | 821 EXPECT_EQ(0, animation->currentTime()); |
| 822 EXPECT_TRUE(std::isnan(animation->startTime())); | 822 EXPECT_TRUE(std::isnan(animation->startTime())); |
| 823 } | 823 } |
| 824 | 824 |
| 825 } // namespace blink | 825 } // namespace blink |
| OLD | NEW |