diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /testing/web-platform/tests/webmidi | |
parent | Initial commit. (diff) | |
download | firefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz firefox-26a029d407be480d791972afb5975cf62c9360a6.zip |
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/webmidi')
-rw-r--r-- | testing/web-platform/tests/webmidi/META.yml | 3 | ||||
-rw-r--r-- | testing/web-platform/tests/webmidi/idlharness.https.window.js | 40 |
2 files changed, 43 insertions, 0 deletions
diff --git a/testing/web-platform/tests/webmidi/META.yml b/testing/web-platform/tests/webmidi/META.yml new file mode 100644 index 0000000000..f39d412288 --- /dev/null +++ b/testing/web-platform/tests/webmidi/META.yml @@ -0,0 +1,3 @@ +spec: https://webaudio.github.io/web-midi-api/ +suggested_reviewers: + - cwilso diff --git a/testing/web-platform/tests/webmidi/idlharness.https.window.js b/testing/web-platform/tests/webmidi/idlharness.https.window.js new file mode 100644 index 0000000000..8fbd6a903c --- /dev/null +++ b/testing/web-platform/tests/webmidi/idlharness.https.window.js @@ -0,0 +1,40 @@ +// META: script=/resources/WebIDLParser.js +// META: script=/resources/idlharness.js +// META: script=/resources/testdriver.js +// META: script=/resources/testdriver-vendor.js +// META: timeout=long + +// https://webaudio.github.io/web-midi-api/ + +'use strict'; + +idl_test( + ['webmidi'], + ['html', 'dom', 'permissions'], + async idl_array => { + idl_array.add_objects({ + MIDIPort: [], + MIDIMessageEvent: [ + 'new MIDIMessageEvent("type", { data: new Uint8Array([0]) })' + ], + MIDIConnectionEvent: ['new MIDIConnectionEvent("type")'], + }) + + await test_driver.set_permission({name: 'midi'}, 'granted'); + + self.access = await navigator.requestMIDIAccess(); + self.inputs = access.inputs; + self.outputs = access.outputs; + idl_array.add_objects({ MIDIInputMap: ['inputs'] }); + idl_array.add_objects({ MIDIOutputMap: ['outputs'] }); + idl_array.add_objects({ MIDIAccess: ['access'] }); + if (inputs.size) { + self.input = Array.from(access.inputs.values())[0]; + idl_array.add_objects({ MIDIInput: ['input'] }); + } + if (outputs.size) { + self.output = Array.from(access.outputs.values())[0]; + idl_array.add_objects({ MIDIOutput: ['output'] }); + } + } +); |