Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / web-animations-api / player.html
blobce94dd659855e1a19ff4b5aa0eead490b72bc37d
1 <!DOCTYPE html>
2 <script src="../resources/testharness.js"></script>
3 <script src="../resources/testharnessreport.js"></script>
5 <div id='element'></div>
7 <script>
8 var element = document.getElementById('element');
9 test(function() {
10 var player = element.animate([{left: '0px', offset: 0}, {left: '100px', offset: 1}], 10000);
11 var animation = player.source;
12 assert_equals(animation.player, player);
13 assert_equals(player.currentTime, 0);
14 player.currentTime = 5000;
15 assert_equals(player.currentTime, 5000);
16 assert_equals(player.timeLag, -5000);
18 player.startTime += 1000;
20 assert_equals(player.currentTime, 4000);
22 player.pause();
23 assert_true(player.paused);
24 player.play();
25 assert_false(player.paused);
27 player.finish();
28 assert_equals(player.currentTime, 10000);
29 assert_true(player.finished);
31 player.reverse();
32 assert_equals(player.playbackRate, -1);
34 player.playbackRate = -2;
35 assert_equals(player.playbackRate, -2);
37 player.cancel();
38 assert_equals(animation.player, null);
39 }, 'Player sanity tests');
41 test(function() {
42 var player = element.animate([{left: '0px', offset: 0}, {left: '100px', offset: 1}], {iterations: Infinity, duration: 10});
43 assert_throws('INVALID_STATE_ERR', function() { player.finish(); });
44 }, 'Player.finish() raises exception if source content end is infinity');
46 test(function() {
47 var player = element.animate([{left: '0px', offset: 0}, {left: '100px', offset: 1}], 10000);
48 for (var attr of ['startTime', 'currentTime', 'playbackRate']) {
49 assert_throws(new TypeError, function() { player[attr] = NaN; }, attr);
50 assert_throws(new TypeError, function() { player[attr] = Infinity; }, attr);
52 }, 'Player.startTime/currentTime/playbackRate throw if passed non-finite numbers.');
53 </script>