| <html> |
| <head> |
| <script> |
| var video; |
| function log(msg) |
| { |
| document.getElementById('console').appendChild(document.createTextNode(msg + "\n")); |
| } |
| |
| function test() |
| { |
| if (window.layoutTestController) { |
| layoutTestController.dumpAsText(); |
| layoutTestController.waitUntilDone(); |
| } |
| video = document.getElementById('fr').contentDocument.getElementsByTagName('video')[0]; |
| video.addEventListener('canplaythrough', test2); |
| } |
| function test2() |
| { |
| var doubleClick = document.createEvent("MouseEvents"); |
| doubleClick.initMouseEvent("dblclick", true, true, window, 2, 0, 0, 0, 0, false, false, false, false, 0, document); |
| var click = document.createEvent("MouseEvents"); |
| click.initMouseEvent("click", true, true, window, 1, 0, 0, 0, 0, false, false, false, false, 0, document); |
| video.dispatchEvent(doubleClick); |
| if (!video.paused) |
| log("PASS: video is playing"); |
| else |
| log("FAIL: video should be playing"); |
| video.dispatchEvent(click); |
| if (video.paused) |
| log("PASS: video is paused"); |
| else |
| log("FAIL: video should be paused"); |
| |
| if (window.layoutTestController) |
| layoutTestController.notifyDone(); |
| } |
| </script> |
| </head> |
| <body onload="test()"> |
| <iframe src="content/test.mp4" id="fr"></iframe> |
| <p>This tests that clicking on a standalone video will pause and double-clicking will play.</p> |
| <pre id="console"></pre> |
| </body> |
| </html> |