https://github.com/web-platform-tests/wpt
Raw File
Tip revision: 8504f7d8f23bceb9b2e8e619afde234056a2e0bc authored by Anne van Kesteren on 21 March 2018, 14:23:38 UTC
Make MessagePort's close() detach
Tip revision: 8504f7d
setactionhandler.html
<!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);
}, "Test that setActionHandler() can be executed for supported actions");

test(function(t) {
  assert_throws(
      new TypeError("Failed to execute 'setActionHandler' on 'MediaSession':" +
                    "The provided value 'invalid' is not a valid enum value" +
                    "of type MediaSessionAction."),
      _ => { window.navigator.mediaSession.setActionHandler("invalid", null); });
}, "Test that setActionHandler() throws exception for unsupported actions");

</script>
back to top