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

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

Issue 2910883002: Clean up duplicate tests in web-animations-api (Closed)
Patch Set: Rebase and remove one more reference to deleted test Created 3 years, 6 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>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="../external/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 // TODO(alancutter): Change this to a promise_test.
62 async_test(function(t) {
63 var animation1 = createDiv(t).animate(null, 0.05);
64 animation1.finished.then(function(event) {
65 validateFinishEvent(t, event, animation1);
66 animation1.currentTime = 0;
67 return animation1.finished;
68 }).then(function(event) {
69 var animation2 = createDiv(t).animate(null, 0.05);
70 // TODO(alancutter): Move this .then to the outer promise chain.
71 animation2.finished.then(function(event) {
72 validateFinishEvent(t, event, animation2);
73 animation2.play();
74 return animation2.finished;
75 })
76 return animation2.finished;
77 }).then(function(event) {
78 t.done();
79 })
80 }, "animation.finished calls can be chained");
81 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698