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

Side by Side Diff: third_party/WebKit/LayoutTests/imported/web-platform-tests/web-animations/animation-effect-timing/endDelay.html

Issue 1866333004: Import web-platform-tests@5a8700479d98852455bee6117558897867eb278a (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@wpt-sync
Patch Set: Add Failure option for two TestExpectations entries Created 4 years, 8 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
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <meta charset=utf-8>
3 <title>endDelay tests</title>
4 <link rel="help" href="http://w3c.github.io/web-animations/#dom-animationeffectt iming-enddelay">
5 <link rel="author" title="Ryo Motozawa" href="mailto:motozawa@mozilla-japan.org" >
6 <script src="../../../../resources/testharness.js"></script>
7 <script src="../../../../resources/testharnessreport.js"></script>
8 <script src="../testcommon.js"></script>
9 <body>
10 <div id="log"></div>
11 <script>
12 'use strict';
13
14 test(function(t) {
15 var div = createDiv(t);
16 var anim = div.animate({ opacity: [ 0, 1 ] }, 2000);
17 anim.effect.timing.endDelay = 123.45;
18 assert_approx_equals(anim.effect.timing.endDelay, 123.45, 0.000001,
19 'set endDelay 123.45');
20 assert_approx_equals(anim.effect.getComputedTiming().endDelay, 123.45,
21 0.000001,
22 'getComputedTiming() after set endDelay 123.45');
23 }, 'set endDelay 123.45');
24
25 test(function(t) {
26 var div = createDiv(t);
27 var anim = div.animate({ opacity: [ 0, 1 ] }, 2000);
28 anim.effect.timing.endDelay = -1000;
29 assert_equals(anim.effect.timing.endDelay, -1000, 'set endDelay -1000');
30 assert_equals(anim.effect.getComputedTiming().endDelay, -1000,
31 'getComputedTiming() after set endDelay -1000');
32 }, 'set endDelay -1000');
33
34 test(function(t) {
35 var div = createDiv(t);
36 var anim = div.animate({ opacity: [ 0, 1 ] }, 2000);
37 assert_throws({name: "TypeError"}, function() {
38 anim.effect.timing.endDelay = Infinity;
39 }, 'we can not assign Infinity to timing.endDelay');
40 }, 'set endDelay Infinity');
41
42 test(function(t) {
43 var div = createDiv(t);
44 var anim = div.animate({ opacity: [ 0, 1 ] }, 2000);
45 assert_throws({name: "TypeError"}, function() {
46 anim.effect.timing.endDelay = -Infinity;
47 }, 'we can not assign negative Infinity to timing.endDelay');
48 }, 'set endDelay negative Infinity');
49
50 async_test(function(t) {
51 var div = createDiv(t);
52 var anim = div.animate({ opacity: [ 0, 1 ] },
53 { duration: 100000, endDelay: 50000 });
54 anim.onfinish = t.step_func(function(event) {
55 assert_unreached('onfinish event should not be fired');
56 });
57
58 anim.ready.then(function() {
59 anim.currentTime = 100000;
60 return waitForAnimationFrames(2);
61 }).then(t.step_func(function() {
62 t.done();
63 }));
64 }, 'onfinish event is not fired duration endDelay');
65
66 async_test(function(t) {
67 var div = createDiv(t);
68 var anim = div.animate({ opacity: [ 0, 1 ] },
69 { duration: 100000, endDelay: 30000 });
70 var finishedTimelineTime;
71 anim.finished.then(function() {
72 finishedTimelineTime = anim.timeline.currentTime;
73 });
74
75 var receivedEvents = [];
76 anim.onfinish = function(event) {
77 receivedEvents.push(event);
78 }
79
80 anim.ready.then(function() {
81 anim.currentTime = 110000; // during endDelay
82 return waitForAnimationFrames(2);
83 }).then(t.step_func(function() {
84 assert_equals(receivedEvents.length, 0,
85 'onfinish event is should not be fired' +
86 'when currentTime is during endDelay');
87 anim.currentTime = 130000; // after endTime
88 return waitForAnimationFrames(2);
89 })).then(t.step_func_done(function() {
90 assert_equals(receivedEvents.length, 1, 'length of array should be one');
91 assert_equals(receivedEvents[0].timelineTime, finishedTimelineTime,
92 'receivedEvents[0].timelineTime should equal to the animation timeline '
93 + 'when finished promise is resolved');
94 }));
95 }, 'onfinish event is fired currentTime is after endTime');
96
97 </script>
98 </body>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698