<DOCTYPE html>
<title>Test media controls video keyboard navigation for space bar</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../media-controls.js"></script>
<video controls></video>
<script>
test(_ => {
assert_true('eventSender' in window);
}, 'eventSender required');
async_test(function(t) {
var video = document.querySelector("video");
video.src = "../content/test.ogv";
assert_equals(video.volume, 1);
assert_equals(video.currentTime, 0);
// Focus the video.
video.focus();
video.addEventListener('canplaythrough', t.step_func(() => {
video.addEventListener('play', t.step_func(() => {
assert_false(video.paused);
video.addEventListener('pause', t.step_func_done(() => {
assert_true(video.paused);
}), { once: true });
// 'Space' again pauses the video.
eventSender.keyDown(" ");
}), { once: true });
// 'Space' plays the video.
eventSender.keyDown(" ");
}), { once : true });
});
</script>