Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / media / media-controller-playback.html
blob8b7f86efc929327e779decebd05b4d0a650aee60
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src=media-file.js></script>
5 <script src=video-test.js></script>
7 <script>
8 var controller;
9 var video2;
11 function start() {
12 var videos = document.getElementsByTagName('video');
13 video = videos[0];
14 video2 = videos[1];
15 run('controller = video.controller');
16 controller.addEventListener('canplaythrough', canplaythrough, true);
17 var src = findMediaFile('video', 'content/test');
18 video.src = src;
19 video2.src = src;
22 function canplaythrough() {
23 consoleWrite("EVENT(canplaythrough)");
24 controller.removeEventListener('canplaythrough', canplaythrough, true);
26 testException("controller.currentTime = -Infinity", '"TypeError: Failed to set the \'currentTime\' property on \'MediaController\': The provided double value is non-finite."');
27 testException("controller.currentTime = Infinity", '"TypeError: Failed to set the \'currentTime\' property on \'MediaController\': The provided double value is non-finite."');
28 testException("controller.currentTime = NaN", '"TypeError: Failed to set the \'currentTime\' property on \'MediaController\': The provided double value is non-finite."');
30 controller.addEventListener('playing', playing, true);
31 run('controller.play()');
34 function playing() {
35 consoleWrite("EVENT(playing)");
36 controller.removeEventListener('playing', playing, true);
37 testExpected('controller.paused', false);
38 controller.addEventListener('ended', ended, true);
39 run('controller.currentTime = 5');
40 testExpected('controller.currentTime', 5);
41 testExpected('video.currentTime', 5);
42 testExpected('video2.currentTime', 5);
45 function ended() {
46 consoleWrite("EVENT(ended)");
47 controller.removeEventListener('ended', ended, true);
48 endTest();
50 </script>
51 </head>
52 <body onload="start()">
53 <video mediaGroup="group" controls></video>
54 <video mediaGroup="group" controls></video>
55 </body>
56 </html>