| 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/Player.h" | 32 #include "core/animation/Player.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/DocumentTimeline.h" | 35 #include "core/animation/DocumentTimeline.h" |
| 37 #include "core/dom/Document.h" | 36 #include "core/dom/Document.h" |
| 38 #include "core/dom/QualifiedName.h" | 37 #include "core/dom/QualifiedName.h" |
| 39 #include "weborigin/KURL.h" | 38 #include "weborigin/KURL.h" |
| 40 #include <gtest/gtest.h> | 39 #include <gtest/gtest.h> |
| 41 | 40 |
| 42 using namespace WebCore; | 41 using namespace WebCore; |
| 43 | 42 |
| 44 namespace { | 43 namespace { |
| 45 | 44 |
| 46 class CoreAnimationPlayerTest : public ::testing::Test { | 45 class CoreAnimationPlayerTest : public ::testing::Test { |
| 47 protected: | 46 protected: |
| 48 virtual void SetUp() | 47 virtual void SetUp() |
| 49 { | 48 { |
| 50 document = Document::create(); | 49 document = Document::create(); |
| 51 timeline = DocumentTimeline::create(document.get()); | 50 timeline = DocumentTimeline::create(document.get()); |
| 52 player = Player::create(timeline.get(), 0); | 51 player = Player::create(timeline.get(), 0); |
| 53 timeline->setZeroTimeAsPerfTime(0); | 52 timeline->setZeroTimeAsPerfTime(0); |
| 54 document->animationClock().updateTime(0); | |
| 55 } | 53 } |
| 56 | 54 |
| 57 bool updateTimeline(double time, double* timeToEffectChange = 0) | 55 bool updateTimeline(double time, double* timeToEffectChange = 0) |
| 58 { | 56 { |
| 59 timeline->serviceAnimations(time); | 57 timeline->serviceAnimations(time); |
| 60 // The timeline does not know about our player, so we have to explicitly
call update(). | 58 // The timeline does not know about our player, so we have to explicitly
call update(). |
| 61 return player->update(timeToEffectChange); | 59 return player->update(timeToEffectChange); |
| 62 } | 60 } |
| 63 | 61 |
| 64 RefPtr<Document> document; | 62 RefPtr<Document> document; |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 EXPECT_EQ(0, timeToNextEffect); | 293 EXPECT_EQ(0, timeToNextEffect); |
| 296 | 294 |
| 297 updateTimeline(2, &timeToNextEffect); | 295 updateTimeline(2, &timeToNextEffect); |
| 298 EXPECT_EQ(std::numeric_limits<double>::infinity(), timeToNextEffect); | 296 EXPECT_EQ(std::numeric_limits<double>::infinity(), timeToNextEffect); |
| 299 | 297 |
| 300 updateTimeline(3, &timeToNextEffect); | 298 updateTimeline(3, &timeToNextEffect); |
| 301 EXPECT_EQ(std::numeric_limits<double>::infinity(), timeToNextEffect); | 299 EXPECT_EQ(std::numeric_limits<double>::infinity(), timeToNextEffect); |
| 302 } | 300 } |
| 303 | 301 |
| 304 } | 302 } |
| OLD | NEW |