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