blob: 40b82d0b1f5ba7d263fc39f3c0db1d98ed188ba2 [file] [log] [blame]
<!DOCTYPE html>
<title>This tests that media element in a standalone media document cannot be focused directly using focus() method or by mouse click.</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<iframe width="380" height="330"></iframe>
<script>
async_test(function(t) {
var iframe = document.querySelector("iframe");
iframe.src = "../../media/" + "content/test.ogv";
iframe.onload = t.step_func(function() {
var standaloneMediaDocument = iframe.contentDocument;
var video = standaloneMediaDocument.querySelector("video");
video.onclick = t.step_func_done(function() {
// Should not focus video element by mouse click.
assert_not_equals(standaloneMediaDocument.activeElement, video);
});
// Should not focus video element by calling focus() method.
video.focus();
assert_not_equals(standaloneMediaDocument.activeElement, video);
// Simulate click event to try focus video element.
var mouseEvent = new MouseEvent("click");
video.dispatchEvent(mouseEvent);
});
});
</script>