| 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 630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 728 animation->cancel(); | 728 animation->cancel(); |
| 729 animation->update(TimingUpdateOnDemand); | 729 animation->update(TimingUpdateOnDemand); |
| 730 // This frame will fire the finish event event though no start time has been | 730 // This frame will fire the finish event event though no start time has been |
| 731 // received from the compositor yet, as cancel() nukes start times. | 731 // received from the compositor yet, as cancel() nukes start times. |
| 732 simulateFrame(0); | 732 simulateFrame(0); |
| 733 EXPECT_EQ(std::numeric_limits<double>::infinity(), animation->timeToEffectCh
ange()); | 733 EXPECT_EQ(std::numeric_limits<double>::infinity(), animation->timeToEffectCh
ange()); |
| 734 } | 734 } |
| 735 | 735 |
| 736 TEST_F(AnimationAnimationTest, AttachedAnimations) | 736 TEST_F(AnimationAnimationTest, AttachedAnimations) |
| 737 { | 737 { |
| 738 RefPtrWillBePersistent<Element> element = document->createElement("foo", ASS
ERT_NO_EXCEPTION); | 738 Persistent<Element> element = document->createElement("foo", ASSERT_NO_EXCEP
TION); |
| 739 | 739 |
| 740 Timing timing; | 740 Timing timing; |
| 741 KeyframeEffect* keyframeEffect = KeyframeEffect::create(element.get(), nullp
tr, timing); | 741 KeyframeEffect* keyframeEffect = KeyframeEffect::create(element.get(), nullp
tr, timing); |
| 742 Animation* animation = timeline->play(keyframeEffect); | 742 Animation* animation = timeline->play(keyframeEffect); |
| 743 simulateFrame(0); | 743 simulateFrame(0); |
| 744 timeline->serviceAnimations(TimingUpdateForAnimationFrame); | 744 timeline->serviceAnimations(TimingUpdateForAnimationFrame); |
| 745 EXPECT_EQ(1U, element->elementAnimations()->animations().find(animation)->va
lue); | 745 EXPECT_EQ(1U, element->elementAnimations()->animations().find(animation)->va
lue); |
| 746 | 746 |
| 747 Heap::collectAllGarbage(); | 747 Heap::collectAllGarbage(); |
| 748 EXPECT_TRUE(element->elementAnimations()->animations().isEmpty()); | 748 EXPECT_TRUE(element->elementAnimations()->animations().isEmpty()); |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 824 EXPECT_EQ(Animation::Idle, animation->playStateInternal()); | 824 EXPECT_EQ(Animation::Idle, animation->playStateInternal()); |
| 825 EXPECT_TRUE(std::isnan(animation->currentTime())); | 825 EXPECT_TRUE(std::isnan(animation->currentTime())); |
| 826 EXPECT_TRUE(std::isnan(animation->startTime())); | 826 EXPECT_TRUE(std::isnan(animation->startTime())); |
| 827 animation->pause(); | 827 animation->pause(); |
| 828 EXPECT_EQ(Animation::Idle, animation->playStateInternal()); | 828 EXPECT_EQ(Animation::Idle, animation->playStateInternal()); |
| 829 EXPECT_TRUE(std::isnan(animation->currentTime())); | 829 EXPECT_TRUE(std::isnan(animation->currentTime())); |
| 830 EXPECT_TRUE(std::isnan(animation->startTime())); | 830 EXPECT_TRUE(std::isnan(animation->startTime())); |
| 831 } | 831 } |
| 832 | 832 |
| 833 } // namespace blink | 833 } // namespace blink |
| OLD | NEW |