<!DOCTYPE html>
<html>
<head>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
</head>
<body>
<script type="module">
import {MockMIDIService} from './resources/mock-midiservice.js';
import {setMidiPermission} from './resources/permissions-helper.js';
const mock = new MockMIDIService();
promise_test(async _ => {
await setMidiPermission({sysex: true}, 'granted');
const access = await navigator.requestMIDIAccess({sysex: true});
assert_true(access.sysexEnabled);
}, 'sysex permission grants are properly handled');
promise_test(async t => {
await test_driver.set_permission({name: 'midi'}, 'granted');
await test_driver.set_permission({name: 'midi', sysex: true}, 'denied');
return promise_rejects_dom(t, 'SecurityError',
navigator.requestMIDIAccess({sysex: true}));
}, 'sysex permission rejections are properly handled');
</script>
</body>
</html>