<!DOCTYPE html>
<title>Test that setting MediaSession event handler should notify the service</title>
<script src=/resources/testharness.js></script>
<script src="/resources/testharnessreport.js"></script>
<script>

test(function(t) {
  window.navigator.mediaSession.setActionHandler("play", null);
  window.navigator.mediaSession.setActionHandler("pause", null);
  window.navigator.mediaSession.setActionHandler("previoustrack", null);
  window.navigator.mediaSession.setActionHandler("nexttrack", null);
  window.navigator.mediaSession.setActionHandler("seekbackward", null);
  window.navigator.mediaSession.setActionHandler("seekforward", null);
  window.navigator.mediaSession.setActionHandler("stop", null);
  window.navigator.mediaSession.setActionHandler("seekto", null);
  window.navigator.mediaSession.setActionHandler("skipad", null);
}, "Test that setActionHandler() can be executed for supported actions");

test(function(t) {
  assert_throws_js(
      TypeError,
      _ => { window.navigator.mediaSession.setActionHandler("invalid", null); });
}, "Test that setActionHandler() throws exception for unsupported actions");

</script>
