Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / web-animations-api / player-state-changes.html
blob0b95f24f664b661b2a351e632603718d31c82ef5
1 <!DOCTYPE html>
2 <script src="../resources/testharness.js"></script>
3 <script src="../resources/testharnessreport.js"></script>
5 <script>
6 function assert_unresolved(value) {
7 assert_equals(value, null);
10 function idlePlayer() {
11 var player = document.documentElement.animate([], 100000);
12 player.cancel();
13 return player;
16 function runningPlayer() {
17 var player = document.documentElement.animate([], 100000);
18 player.startTime = document.timeline.currentTime;
19 return player;
22 function pendingStartTimePlayer() {
23 var player = document.documentElement.animate([], 100000);
24 return player;
27 function pendingStartTimeAndCurrentTimePlayer() {
28 var player = document.documentElement.animate([], 100000);
29 player.pause();
30 player.play();
31 return player;
34 function pausedPlayer() {
35 var player = document.documentElement.animate([], 100000);
36 player.pause();
37 player.currentTime = 0;
38 return player;
41 function finishedPlayer() {
42 var player = document.documentElement.animate([], 100000);
43 player.finish();
44 return player;
47 test(function() {
48 var player = idlePlayer();
49 assert_unresolved(player.startTime);
50 assert_unresolved(player.currentTime);
51 assert_equals(player.playState, 'idle');
52 }, "idle");
54 test(function() {
55 var player = pendingStartTimePlayer();
56 assert_unresolved(player.startTime);
57 assert_equals(player.currentTime, 0);
58 assert_equals(player.playState, 'pending');
59 }, "pending startTime");
61 test(function() {
62 var player = pendingStartTimeAndCurrentTimePlayer();
63 assert_unresolved(player.startTime);
64 assert_unresolved(player.currentTime);
65 assert_equals(player.playState, 'pending');
66 }, "pending startTime and currentTime");
68 test(function() {
69 var player = runningPlayer();
70 assert_equals(player.startTime, document.timeline.currentTime - player.currentTime);
71 assert_equals(player.currentTime, 0);
72 assert_equals(player.playState, 'running');
73 }, "running");
75 test(function() {
76 var player = pausedPlayer();
77 assert_unresolved(player.startTime);
78 assert_equals(player.currentTime, 0);
79 assert_equals(player.playState, 'paused');
80 }, "paused");
82 test(function() {
83 var player = finishedPlayer();
84 assert_equals(player.startTime, document.timeline.currentTime - player.currentTime);
85 assert_equals(player.currentTime, 100000);
86 assert_equals(player.playState, 'finished');
87 }, "finished");
89 test(function() {
90 var player = idlePlayer();
91 player.play();
92 assert_unresolved(player.startTime);
93 assert_equals(player.currentTime, 0);
94 assert_equals(player.playState, 'pending');
95 }, "idle -> play()");
97 test(function() {
98 var player = idlePlayer();
99 player.pause();
100 assert_unresolved(player.startTime);
101 assert_unresolved(player.currentTime);
102 assert_equals(player.playState, 'idle');
103 }, "idle -> pause()");
105 test(function() {
106 var player = idlePlayer();
107 player.cancel();
108 assert_unresolved(player.startTime);
109 assert_unresolved(player.currentTime);
110 assert_equals(player.playState, 'idle');
111 }, "idle -> cancel()");
113 test(function() {
114 var player = idlePlayer();
115 player.finish();
116 assert_unresolved(player.startTime);
117 assert_unresolved(player.currentTime);
118 assert_equals(player.playState, 'idle');
119 }, "idle -> finish()");
121 test(function() {
122 var player = idlePlayer();
123 player.reverse();
124 assert_unresolved(player.startTime);
125 assert_equals(player.currentTime, 100000);
126 assert_equals(player.playState, 'pending');
127 }, "idle -> reverse()");
129 test(function() {
130 var player = idlePlayer();
131 player.currentTime = 1000;
132 assert_unresolved(player.startTime);
133 assert_unresolved(player.currentTime);
134 assert_equals(player.playState, 'idle');
135 }, "idle -> set currentTime");
137 test(function() {
138 var player = idlePlayer();
139 player.startTime = 1000;
140 assert_unresolved(player.startTime);
141 assert_unresolved(player.currentTime);
142 assert_equals(player.playState, 'idle');
143 }, "idle -> set startTime");
145 test(function() {
146 var player = pendingStartTimePlayer();
147 player.play();
148 assert_unresolved(player.startTime);
149 assert_equals(player.currentTime, 0);
150 assert_equals(player.playState, 'pending');
151 }, "pending startTime -> play()");
153 test(function() {
154 var player = pendingStartTimePlayer();
155 player.pause();
156 assert_unresolved(player.startTime);
157 assert_unresolved(player.currentTime);
158 assert_equals(player.playState, 'pending');
159 }, "pending startTime -> pause()");
161 test(function() {
162 var player = pendingStartTimePlayer();
163 player.cancel();
164 assert_unresolved(player.startTime);
165 assert_unresolved(player.currentTime);
166 assert_equals(player.playState, 'idle');
167 }, "pending startTime -> cancel()");
169 test(function() {
170 var player = pendingStartTimePlayer();
171 player.finish();
172 assert_equals(player.startTime, document.timeline.currentTime - player.currentTime);
173 assert_equals(player.currentTime, 100000);
174 assert_equals(player.playState, 'finished');
175 }, "pending startTime -> finish()");
177 test(function() {
178 var player = pendingStartTimePlayer();
179 player.reverse();
180 assert_unresolved(player.startTime);
181 assert_equals(player.currentTime, 100000);
182 assert_equals(player.playState, 'pending');
183 }, "pending startTime -> reverse()");
185 test(function() {
186 var player = pendingStartTimePlayer();
187 player.currentTime = 1000;
188 assert_unresolved(player.startTime);
189 assert_equals(player.currentTime, 1000);
190 assert_equals(player.playState, 'pending');
191 }, "pending startTime -> set currentTime");
193 test(function() {
194 var player = pendingStartTimePlayer();
195 player.startTime = document.timeline.currentTime - 1000;
196 assert_equals(player.startTime, document.timeline.currentTime - 1000);
197 assert_equals(player.currentTime, 1000);
198 assert_equals(player.playState, 'running');
199 }, "pending startTime -> set startTime");
201 test(function() {
202 var player = pendingStartTimeAndCurrentTimePlayer();
203 player.play();
204 assert_unresolved(player.startTime);
205 assert_unresolved(player.currentTime);
206 assert_equals(player.playState, 'pending');
207 }, "pending startTime & currentTime -> play()");
209 test(function() {
210 var player = pendingStartTimeAndCurrentTimePlayer();
211 player.pause();
212 assert_unresolved(player.startTime);
213 assert_unresolved(player.currentTime);
214 assert_equals(player.playState, 'pending');
215 }, "pending startTime & currentTime -> pause()");
217 test(function() {
218 var player = pendingStartTimeAndCurrentTimePlayer();
219 player.cancel();
220 assert_unresolved(player.startTime);
221 assert_unresolved(player.currentTime);
222 assert_equals(player.playState, 'idle');
223 }, "pending startTime & currentTime -> cancel()");
225 test(function() {
226 var player = pendingStartTimeAndCurrentTimePlayer();
227 player.finish();
228 assert_equals(player.startTime, document.timeline.currentTime - player.currentTime);
229 assert_equals(player.currentTime, 100000);
230 assert_equals(player.playState, 'finished');
231 }, "pending startTime & currentTime -> finish()");
233 test(function() {
234 var player = pendingStartTimeAndCurrentTimePlayer();
235 player.reverse();
236 assert_unresolved(player.startTime);
237 assert_unresolved(player.currentTime);
238 assert_equals(player.playState, 'pending');
239 }, "pending startTime & currentTime -> reverse()");
241 test(function() {
242 var player = pendingStartTimeAndCurrentTimePlayer();
243 player.currentTime = 1000;
244 assert_unresolved(player.startTime);
245 assert_equals(player.currentTime, 1000);
246 assert_equals(player.playState, 'pending');
247 }, "pending startTime & currentTime -> set currentTime");
249 test(function() {
250 var player = pendingStartTimeAndCurrentTimePlayer();
251 player.startTime = document.timeline.currentTime;
252 assert_equals(player.startTime, document.timeline.currentTime);
253 assert_equals(player.currentTime, 0);
254 assert_equals(player.playState, 'running');
255 }, "pending startTime & currentTime -> set startTime");
257 test(function() {
258 var player = runningPlayer();
259 var startTime = player.startTime;
260 var currentTime = player.currentTime;
261 player.play();
262 assert_equals(player.startTime, startTime);
263 assert_equals(player.currentTime, currentTime);
264 assert_equals(player.playState, 'running');
265 }, "running -> play()");
267 test(function() {
268 var player = runningPlayer();
269 player.pause();
270 assert_unresolved(player.startTime);
271 assert_unresolved(player.currentTime);
272 assert_equals(player.playState, 'pending');
273 }, "running -> pause()");
275 test(function() {
276 var player = runningPlayer();
277 player.cancel();
278 assert_unresolved(player.startTime);
279 assert_unresolved(player.currentTime);
280 assert_equals(player.playState, 'idle');
281 }, "running -> cancel()");
283 test(function() {
284 var player = runningPlayer();
285 player.finish();
286 assert_equals(player.startTime, document.timeline.currentTime - player.currentTime);
287 assert_equals(player.currentTime, 100000);
288 assert_equals(player.playState, 'finished');
289 }, "running -> finish()");
291 test(function() {
292 var player = runningPlayer();
293 player.reverse();
294 assert_unresolved(player.startTime);
295 assert_unresolved(player.currentTime);
296 assert_equals(player.playState, 'pending');
297 }, "running -> reverse()");
299 test(function() {
300 var player = runningPlayer();
301 player.currentTime = 1000;
302 assert_equals(player.startTime, document.timeline.currentTime - player.currentTime);
303 assert_equals(player.currentTime, 1000);
304 assert_equals(player.playState, 'running');
305 }, "running -> set currentTime");
307 test(function() {
308 var player = runningPlayer();
309 player.startTime = document.timeline.currentTime - 1000;
310 assert_equals(player.startTime, document.timeline.currentTime - 1000);
311 assert_equals(player.currentTime, 1000);
312 assert_equals(player.playState, 'running');
313 }, "running -> set startTime");
315 test(function() {
316 var player = pausedPlayer();
317 player.play();
318 assert_unresolved(player.startTime);
319 assert_equals(player.currentTime, 0);
320 assert_equals(player.playState, 'pending');
321 }, "paused -> play()");
323 test(function() {
324 var player = pausedPlayer();
325 player.pause();
326 assert_unresolved(player.startTime);
327 assert_equals(player.currentTime, 0);
328 assert_equals(player.playState, 'paused');
329 }, "paused -> pause()");
331 test(function() {
332 var player = pausedPlayer();
333 player.cancel();
334 assert_unresolved(player.startTime);
335 assert_unresolved(player.currentTime);
336 assert_equals(player.playState, 'idle');
337 }, "paused -> cancel()");
339 test(function() {
340 var player = pausedPlayer();
341 player.finish();
342 assert_unresolved(player.startTime);
343 assert_equals(player.currentTime, 100000);
344 assert_equals(player.playState, 'paused');
345 }, "paused -> finish()");
347 test(function() {
348 var player = pausedPlayer();
349 player.reverse();
350 assert_unresolved(player.startTime);
351 assert_equals(player.currentTime, 100000);
352 assert_equals(player.playState, 'pending');
353 }, "paused -> reverse()");
355 test(function() {
356 var player = pausedPlayer();
357 player.currentTime = 1000;
358 assert_unresolved(player.startTime);
359 assert_equals(player.currentTime, 1000);
360 assert_equals(player.playState, 'paused');
361 }, "paused -> set currentTime");
363 test(function() {
364 var player = pausedPlayer();
365 player.startTime = 1000;
366 assert_unresolved(player.startTime);
367 assert_equals(player.currentTime, 0);
368 assert_equals(player.playState, 'paused');
369 }, "paused -> set startTime");
371 test(function() {
372 var player = finishedPlayer();
373 player.play();
374 assert_unresolved(player.startTime);
375 assert_equals(player.currentTime, 0);
376 assert_equals(player.playState, 'pending');
377 }, "finished -> play()");
379 test(function() {
380 var player = finishedPlayer();
381 player.pause();
382 assert_unresolved(player.startTime);
383 assert_equals(player.currentTime, 100000);
384 assert_equals(player.playState, 'paused');
385 }, "finished -> pause()");
387 test(function() {
388 var player = finishedPlayer();
389 player.cancel();
390 assert_unresolved(player.startTime);
391 assert_unresolved(player.currentTime);
392 assert_equals(player.playState, 'idle');
393 }, "finished -> cancel()");
395 test(function() {
396 var player = finishedPlayer();
397 player.finish();
398 assert_equals(player.startTime, document.timeline.currentTime - player.currentTime);
399 assert_equals(player.currentTime, 100000);
400 assert_equals(player.playState, 'finished');
401 }, "finished -> finish()");
403 test(function() {
404 var player = finishedPlayer();
405 player.reverse();
406 assert_unresolved(player.startTime);
407 assert_equals(player.currentTime, 100000);
408 assert_equals(player.playState, 'pending');
409 }, "finished -> reverse()");
411 test(function() {
412 var player = finishedPlayer();
413 player.currentTime = 1000;
414 assert_equals(player.startTime, document.timeline.currentTime - player.currentTime);
415 assert_equals(player.currentTime, 1000);
416 assert_equals(player.playState, 'running');
417 }, "finished -> set currentTime");
418 </script>