blob: 6dd70c961b5c03128e45131da4525c022f4680cf [file] [log] [blame]
<!doctype html>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<script src="../http/tests/resources/permissions-helper.js"></script>
<p>Regression test to check if non-zero timestamp works well.</p>
<script>
promise_test(async () => {
await PermissionsHelper.setPermission('midi', 'granted');
await PermissionsHelper.setPermission('midi-sysex', 'granted');
let access = await navigator.requestMIDIAccess({sysex: true});
let input = access.inputs.values().next().value;
let output = access.outputs.values().next().value;
let expected_time = performance.now() + 1000;
let data = [0x80, 0x00, 0x00];
output.send(data, expected_time);
let event = await new Promise(resolve => {
input.addEventListener('midimessage', resolve);
});
assert_array_equals(data, event.data);
assert_greater_than_equal(performance.now(), expected_time);
}, 'Test MIDIOutput.send() with non-zero timestamp.');
</script>