blob: ccdf1eb9b788f4775ab8a1ea8bd2b995da0fe37f [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script src="../resources/js-test.js"></script>
<script src="../http/tests/resources/permissions-helper.js"></script>
</head>
<body>
<script>
description("Tests navigator.requestMIDIAccess failure.");
shouldBeDefined("PermissionsHelper.setPermission");
function successCallback(access) {
testFailed("requestMIDIAccess() does not fail unexpectedly.");
finishJSTest();
}
function errorCallback(error) {
errorName = error.name;
shouldBe("errorName", "'InvalidStateError'");
testPassed("requestMIDIAccess() fail as expected.");
finishJSTest();
}
window.jsTestIsAsync = true;
// Set default permission behavior that grants non-sysex requests.
PermissionsHelper.setPermission('midi', 'granted').then(function() {
// set testRunner configuration so that requestMIDIAccess returns "InvalidStateError".
testRunner.setMIDIAccessorResult(false);
navigator.requestMIDIAccess().then(successCallback, errorCallback);
});
</script>
</body>
</html>