Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(94)

Side by Side Diff: Source/core/animation/PlayerTest.cpp

Issue 172003002: Web Animations: Don't mark players as outdated upon currentTime access (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@currentplayers
Patch Set: add test Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/core/animation/Player.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 EXPECT_EQ(0, timeline->currentTime()); 106 EXPECT_EQ(0, timeline->currentTime());
107 EXPECT_EQ(0, player->currentTime()); 107 EXPECT_EQ(0, player->currentTime());
108 EXPECT_FALSE(player->paused()); 108 EXPECT_FALSE(player->paused());
109 EXPECT_EQ(1, player->playbackRate()); 109 EXPECT_EQ(1, player->playbackRate());
110 EXPECT_EQ(0, player->startTime()); 110 EXPECT_EQ(0, player->startTime());
111 EXPECT_EQ(0, player->timeLag()); 111 EXPECT_EQ(0, player->timeLag());
112 EXPECT_TRUE(player->hasStartTime()); 112 EXPECT_TRUE(player->hasStartTime());
113 } 113 }
114 114
115 115
116 TEST_F(AnimationPlayerTest, CurrentTimeDoesNotSetOutdated)
117 {
118 EXPECT_FALSE(player->outdated());
119 EXPECT_EQ(0, player->currentTime());
120 EXPECT_FALSE(player->outdated());
121 // FIXME: We should split updateTimeline into a version that doesn't update
122 // the player and one that does, as most of the tests don't require update()
123 // to be called.
124 document->animationClock().updateTime(10);
125 EXPECT_EQ(10, player->currentTime());
126 EXPECT_FALSE(player->outdated());
127 }
128
116 TEST_F(AnimationPlayerTest, SetCurrentTime) 129 TEST_F(AnimationPlayerTest, SetCurrentTime)
117 { 130 {
118 player->setCurrentTime(10); 131 player->setCurrentTime(10);
119 EXPECT_EQ(10, player->currentTime()); 132 EXPECT_EQ(10, player->currentTime());
120 updateTimeline(10); 133 updateTimeline(10);
121 EXPECT_EQ(20, player->currentTime()); 134 EXPECT_EQ(20, player->currentTime());
122 } 135 }
123 136
124 TEST_F(AnimationPlayerTest, SetCurrentTimeNegative) 137 TEST_F(AnimationPlayerTest, SetCurrentTimeNegative)
125 { 138 {
(...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after
673 RefPtr<Animation> animation = Animation::create(element, nullptr, timing); 686 RefPtr<Animation> animation = Animation::create(element, nullptr, timing);
674 RefPtr<Player> player = timeline->createPlayer(animation.get()); 687 RefPtr<Player> player = timeline->createPlayer(animation.get());
675 timeline->serviceAnimations(); 688 timeline->serviceAnimations();
676 EXPECT_EQ(1U, element->activeAnimations()->players().find(player.get())->val ue); 689 EXPECT_EQ(1U, element->activeAnimations()->players().find(player.get())->val ue);
677 690
678 player.release(); 691 player.release();
679 EXPECT_TRUE(element->activeAnimations()->players().isEmpty()); 692 EXPECT_TRUE(element->activeAnimations()->players().isEmpty());
680 } 693 }
681 694
682 } 695 }
OLDNEW
« no previous file with comments | « Source/core/animation/Player.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698