summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/webmidi
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--testing/web-platform/tests/webmidi/META.yml3
-rw-r--r--testing/web-platform/tests/webmidi/idlharness.https.window.js40
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'] });
+ }
+ }
+);