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

Side by Side Diff: LayoutTests/web-animations-api/timeline-time.html

Issue 251183006: Web Animations: Timeline should not advance during task execution (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Tick animation clock using approximate frame time. Created 6 years, 7 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 | Annotate | Revision Log
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <script src="../resources/testharness.js"></script> 2 <script src="../resources/testharness.js"></script>
3 <script src="../resources/testharnessreport.js"></script> 3 <script src="../resources/testharnessreport.js"></script>
4 4
5 <body> 5 <script>
6 <div id='element'></div> 6 test(function() {
7 </body> 7 var startTime = document.timeline.currentTime;
8 assert_greater_than_equal(startTime, 0);
9 var start = performance.now();
10 while (performance.now() < start + 250)
11 /* wait */;
12 assert_equals(document.timeline.currentTime, startTime);
13 }, 'document.timeline.currentTime should not change within a script block.');
8 14
9 <script> 15 (function() {
10 var element = document.getElementById('element'); 16 var timeoutTest = async_test('document.timeline.currentTime time should change after a script timeout');
11 var duration = 1; 17 var startTime = document.timeline.currentTime;
12 18
13 var animation = new Animation(element, 19 setTimeout(function() {
14 [{opacity: '1', offset: 0}, 20 timeoutTest.step(function() {
15 {opacity: '0', offset: 1}], 21 assert_greater_than(document.timeline.currentTime, startTime);
16 duration); 22 });
23 timeoutTest.done();
24 }, 100);
25 })();
17 26
18 test(function() { 27 (function() {
19 var startTime = document.timeline.currentTime; 28 var rafTest = async_test('document.timeline.currentTime time should be the sam e for all RAF callbacks in a frame');
20 var player = document.timeline.play(animation); 29 var startTime = document.timeline.currentTime;
21 player.finish(); 30 var firstRafTime;
22 var finishTime = document.timeline.currentTime; 31
23 assert_greater_than_equal(startTime, 0); 32 requestAnimationFrame(function() {
24 assert_equals(startTime, finishTime); 33 rafTest.step(function() {
25 }, 'document.timeline.currentTime should not change within a script block.'); 34 assert_greater_than(document.timeline.currentTime, startTime);
35 firstRafTime = document.timeline.currentTime;
36 });
37 });
38
39 requestAnimationFrame(function() {
40 rafTest.step(function() {
41 assert_equals(document.timeline.currentTime, firstRafTime);
42 });
43 rafTest.done();
44 });
45 })();
46
47 (function() {
48 var rafTest = async_test('document.timeline.currentTime time should be consist ent with the time value passed to RAF callbacks');
49 var firstRafTime;
50 var firstRafDelta;
51
52 requestAnimationFrame(function(t) {
53 rafTest.step(function() {
54 firstRafTime = document.timeline.currentTime;
55 firstRafDelta = document.timeline.currentTime - t;
56 });
57
58 requestAnimationFrame(function(t) {
59 rafTest.step(function() {
60 assert_greater_than(document.timeline.currentTime, firstRafTime);
61 assert_equals(document.timeline.currentTime - t, firstRafDelta);
62 });
63 rafTest.done();
64 });
65 });
66 })();
26 </script> 67 </script>
OLDNEW
« no previous file with comments | « no previous file | Source/core/animation/AnimationClock.h » ('j') | Source/core/animation/AnimationClock.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698