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

Side by Side Diff: third_party/WebKit/LayoutTests/web-animations-api/animation-onfinish.html

Issue 2140023002: Clean up player-finish-*.html tests to match W3C (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Done Created 4 years, 5 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 | « no previous file | third_party/WebKit/LayoutTests/web-animations-api/player-finish-event.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <meta charset=utf-8>
3 <title>Tests for the finish event</title>
4 <link rel="help" href="https://w3c.github.io/web-animations/#the-current-finishe d-promise">
5 <script src="../resources/testharness.js"></script>
6 <script src="../resources/testharnessreport.js"></script>
7 <script src="../imported/wpt/web-animations/testcommon.js"></script>
8 <body>
9 <script>
10 'use strict';
11 function validateFinishEvent(t, event, animation) {
12 t.step(function() {
13 assert_equals(event, animation, 'Animation should be target');
14 assert_times_equal(event.currentTime, animation.currentTime, 'Event currentT ime should be animation currentTime');
15 });
16 }
17
18 async_test(function(t) {
19 var div = createDiv(t);
20 var animation = div.animate(null, 70.0);
21 animation.finished.then(function(event) {
22 t.unreached_func("Seeking to finish should not queue finished event");
23 })
24 animation.finish();
25 animation.currentTime = 0;
26 animation.pause();
27 t.done();
28 }, "animation.finished doesn't run when the animation seeks to finish");
29
30 async_test(function(t) {
31 var div = createDiv(t);
32 var animation = div.animate(null, 70.0);
33 animation.finished.then(function (event) {
34 t.unreached_func("Seeking past finish should not queue finished event");
35 })
36 animation.currentTime = 80.0;
37 animation.currentTime = 0;
38 animation.pause();
39 t.done();
40 }, "animation.finished doesn't run when the animation seeks past finish");
41
42 async_test(function(t) {
43 var div = createDiv(t);
44 var animation = div.animate(null, 90.0);
45 animation.finished.then(function(event) {
46 validateFinishEvent(t, event, animation);
47 t.done();
48 })
49 animation.finish();
50 }, "animation.finished runs when the animation completes with .finish()");
51
52 async_test(function(t) {
53 var div = createDiv(t);
54 var animation = div.animate(null, 100);
55 animation.finished.then(function(event) {
56 validateFinishEvent(t, event, animation);
57 t.done();
58 })
59 }, "animation.finished runs when the animation completes");
60
61 async_test(function(t) {
alancutter (OOO until 2018) 2016/07/13 23:41:47 This would be better as a promise_test() so that i
62 var animation1 = createDiv(t).animate(null, 0.05);
63 animation1.finished.then(function(event) {
64 validateFinishEvent(t, event, animation1);
65 animation1.currentTime = 0;
66 return animation1.finished;
67 }).then(function(event) {
68 var animation2 = createDiv(t).animate(null, 0.05);
69 animation2.finished.then(function(event) {
70 validateFinishEvent(t, event, animation2);
71 animation2.play();
72 return animation2.finished;
73 })
74 return animation2.finished;
75 }).then(function(event) {
alancutter (OOO until 2018) 2016/07/13 23:41:47 Almost. The inner then() on line 69 just needs to
76 t.done();
77 })
78 }, "animation.finished calls can be chained");
79 </script>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/web-animations-api/player-finish-event.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698