Files
tubestation/testing/web-platform/tests/webmidi/idlharness.https.window.js
Michael Wilson 61bbce2cc4 Bug 1883492 [wpt PR 44913] - Block or allow all MIDI using the existing SysEx permission, a=testonly
Automatic update from web-platform-tests
Block or allow all MIDI using the existing SysEx permission

We have changed our approach for gating all MIDI access behind a
permission prompt.  Now, the existing SysEx permission and prompt will
be used to control all access to the Web MIDI API.

This CL does the following:
- Roll back registration of the basic MIDI content setting and
  request type
- Move the feature flag location from content/public/common to
  thrid_party/blink/public/common, since the feature is no longer
  related to content
- Update test_driver tests (including WPTs) to request the
  permission with the SysEx flag set to true
- Always show the SysEx version of the prompt by modifying
  midi_access_initializer.cc

Note that one external WPT is also being updated.  Although other
browsers may not need the sysex flag set to true for the idlharness
tests to pass, setting it to true should not cause the tests to fail
since it is stronger than the basic midi permission as per spec:
https://webaudio.github.io/web-midi-api/#permissions-integration

Bug: 1420307
Change-Id: I5a6c45641c440f34bfdba0fb2076ae030528c634
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5154368
Reviewed-by: Ravjit Uppal <ravjit@chromium.org>
Reviewed-by: Nate Fischer <ntfschr@chromium.org>
Reviewed-by: Sina Firoozabadi <sinafirooz@chromium.org>
Commit-Queue: Michael Wilson <mjwilson@chromium.org>
Reviewed-by: Hongchan Choi <hongchan@chromium.org>
Reviewed-by: Charlie Reis <creis@chromium.org>
Reviewed-by: Colin Blundell <blundell@chromium.org>
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1270342}

--

wpt-commits: d84308e8d47b71cca827b05999d6fa4ffc8fab88
wpt-pr: 44913
2024-03-14 08:39:29 +00:00

42 lines
1.3 KiB
JavaScript

// 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")'],
})
// Chromium requires the sysex permission to allow any type of MIDI
await test_driver.set_permission({name: 'midi', sysex: true}, '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'] });
}
}
);