chromium/third_party/blink/web_tests/media/controls/controls-video-keynav.html

<DOCTYPE html>
<title>Test media controls video keyboard navigation</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(() => {
          assert_true(video.paused);
          var cur = video.currentTime;
          video.addEventListener('seeked', t.step_func(() => {
            assert_greater_than(video.currentTime, cur);
            video.addEventListener('seeked', t.step_func(() => {
              assert_equals(video.currentTime, video.duration);
              video.addEventListener('seeked', t.step_func(() => {
                assert_less_than(video.currentTime, video.duration);
                video.addEventListener('seeked', t.step_func_done(() => {
                  assert_equals(video.currentTime, 0);
                }), { once: true });
                // 'Home' sets the timeline to 0.
                eventSender.keyDown("Home");
              }), { once: true });
              // 'Left' scrubs the timeline back.
              eventSender.keyDown("ArrowLeft");
            }), { once: true });
            // 'End' sets the timeline to end.
            eventSender.keyDown("End");
          }), { once: true });
          // 'Right' scrubs the timeline forward.
          eventSender.keyDown("ArrowRight");
        }), { once: true });
        // 'Enter' again pauses the video.
        eventSender.keyDown("Enter");
      }), { once: true });
      // 'Enter' plays the video.
      eventSender.keyDown("Enter");
    }), { once: true });
});
</script>