OLD | NEW |
1 <html> | 1 <html> |
2 <head> | 2 <head> |
3 <script src=media-file.js></script> | 3 <script src=media-file.js></script> |
4 <script> | 4 <script> |
5 if (window.layoutTestController) { | 5 if (window.layoutTestController) { |
6 layoutTestController.dumpAsText(); | 6 layoutTestController.dumpAsText(); |
7 layoutTestController.waitUntilDone(); | 7 layoutTestController.waitUntilDone(); |
8 } | 8 } |
9 | 9 |
10 var video; | 10 var video; |
11 function log(msg) | 11 function log(msg) |
12 { | 12 { |
13 document.getElementById('console').appendChild(document.createTextNo
de(msg + "\n")); | 13 document.getElementById('console').appendChild(document.createTextNo
de(msg + "\n")); |
14 } | 14 } |
15 | 15 |
16 function test() | 16 function test() |
17 { | 17 { |
18 video = document.getElementById('fr').contentDocument.getElementsByT
agName('video')[0]; | 18 video = document.getElementById('fr').contentDocument.getElementsByT
agName('video')[0]; |
19 video.addEventListener('canplaythrough', test2); | 19 if (video.readyState >= 4) |
| 20 test2(); |
| 21 else |
| 22 video.addEventListener('canplaythrough', test2); |
20 } | 23 } |
21 function test2() | 24 function test2() |
22 { | 25 { |
23 var doubleClick = document.createEvent("MouseEvents"); | 26 var doubleClick = document.createEvent("MouseEvents"); |
24 doubleClick.initMouseEvent("dblclick", true, true, window, 2, 0, 0,
0, 0, false, false, false, false, 0, document); | 27 doubleClick.initMouseEvent("dblclick", true, true, window, 2, 0, 0,
0, 0, false, false, false, false, 0, document); |
25 var click = document.createEvent("MouseEvents"); | 28 var click = document.createEvent("MouseEvents"); |
26 click.initMouseEvent("click", true, true, window, 1, 0, 0, 0, 0, fal
se, false, false, false, 0, document); | 29 click.initMouseEvent("click", true, true, window, 1, 0, 0, 0, 0, fal
se, false, false, false, 0, document); |
27 video.dispatchEvent(doubleClick); | 30 video.dispatchEvent(doubleClick); |
28 if (!video.paused) | 31 if (!video.paused) |
29 log("PASS: video is playing"); | 32 log("PASS: video is playing"); |
(...skipping 14 matching lines...) Expand all Loading... |
44 <iframe id="fr"></iframe> | 47 <iframe id="fr"></iframe> |
45 <script> | 48 <script> |
46 var frame = document.getElementById("fr"); | 49 var frame = document.getElementById("fr"); |
47 frame.src = findMediaFile("video", "content/test"); | 50 frame.src = findMediaFile("video", "content/test"); |
48 frame.addEventListener("load", test); | 51 frame.addEventListener("load", test); |
49 </script> | 52 </script> |
50 <p>This tests that clicking on a standalone video will pause and double-clic
king will play.</p> | 53 <p>This tests that clicking on a standalone video will pause and double-clic
king will play.</p> |
51 <pre id="console"></pre> | 54 <pre id="console"></pre> |
52 </body> | 55 </body> |
53 </html> | 56 </html> |
OLD | NEW |