Commit 444da9a6 authored by Luke Bjerring's avatar Luke Bjerring Committed by Commit Bot

Update webusb test

Upstream re-attempt at https://github.com/web-platform-tests/wpt/pull/9854.
Adds more untested IDL deps.

Change-Id: Icf7bda0f264ec66f4980e0742485eb406e334c19
Reviewed-on: https://chromium-review.googlesource.com/1089862
Commit-Queue: Luke Bj <lukebjerring@chromium.org>
Reviewed-by: default avatarReilly Grant <reillyg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#567118}
parent 783afea4
// Copied from https://wicg.github.io/webusb/#idl-index minus the // GENERATED CONTENT - DO NOT EDIT
// definitions related to Permissions API integration which is unstable. // Content of this file was automatically extracted from the
// "WebUSB API" spec.
// See: https://wicg.github.io/webusb/
dictionary USBDeviceFilter { dictionary USBDeviceFilter {
unsigned short vendorId; unsigned short vendorId;
...@@ -14,7 +16,7 @@ dictionary USBDeviceRequestOptions { ...@@ -14,7 +16,7 @@ dictionary USBDeviceRequestOptions {
required sequence<USBDeviceFilter> filters; required sequence<USBDeviceFilter> filters;
}; };
[Exposed=(DedicatedWorker, SharedWorker, Window), SecureContext] [Exposed=(DedicatedWorker,SharedWorker,Window), SecureContext]
interface USB : EventTarget { interface USB : EventTarget {
attribute EventHandler onconnect; attribute EventHandler onconnect;
attribute EventHandler ondisconnect; attribute EventHandler ondisconnect;
...@@ -27,7 +29,7 @@ partial interface Navigator { ...@@ -27,7 +29,7 @@ partial interface Navigator {
[SameObject] readonly attribute USB usb; [SameObject] readonly attribute USB usb;
}; };
[Exposed=(DedicatedWorker, SharedWorker), SecureContext] [Exposed=(DedicatedWorker,SharedWorker), SecureContext]
partial interface WorkerNavigator { partial interface WorkerNavigator {
[SameObject] readonly attribute USB usb; [SameObject] readonly attribute USB usb;
}; };
...@@ -38,13 +40,13 @@ dictionary USBConnectionEventInit : EventInit { ...@@ -38,13 +40,13 @@ dictionary USBConnectionEventInit : EventInit {
[ [
Constructor(DOMString type, USBConnectionEventInit eventInitDict), Constructor(DOMString type, USBConnectionEventInit eventInitDict),
Exposed=(DedicatedWorker, SharedWorker, Window) Exposed=(DedicatedWorker,SharedWorker,Window)
] ]
interface USBConnectionEvent : Event { interface USBConnectionEvent : Event {
[SameObject] readonly attribute USBDevice device; [SameObject] readonly attribute USBDevice device;
}; };
[Exposed=(DedicatedWorker, SharedWorker, Window)] [Exposed=(DedicatedWorker,SharedWorker,Window)]
interface USBDevice { interface USBDevice {
readonly attribute octet usbVersionMajor; readonly attribute octet usbVersionMajor;
readonly attribute octet usbVersionMinor; readonly attribute octet usbVersionMinor;
...@@ -108,7 +110,7 @@ dictionary USBControlTransferParameters { ...@@ -108,7 +110,7 @@ dictionary USBControlTransferParameters {
[ [
Constructor(USBTransferStatus status, optional DataView? data), Constructor(USBTransferStatus status, optional DataView? data),
Exposed=(DedicatedWorker, SharedWorker, Window) Exposed=(DedicatedWorker,SharedWorker,Window)
] ]
interface USBInTransferResult { interface USBInTransferResult {
readonly attribute DataView? data; readonly attribute DataView? data;
...@@ -117,7 +119,7 @@ interface USBInTransferResult { ...@@ -117,7 +119,7 @@ interface USBInTransferResult {
[ [
Constructor(USBTransferStatus status, optional unsigned long bytesWritten = 0), Constructor(USBTransferStatus status, optional unsigned long bytesWritten = 0),
Exposed=(DedicatedWorker, SharedWorker, Window) Exposed=(DedicatedWorker,SharedWorker,Window)
] ]
interface USBOutTransferResult { interface USBOutTransferResult {
readonly attribute unsigned long bytesWritten; readonly attribute unsigned long bytesWritten;
...@@ -126,7 +128,7 @@ interface USBOutTransferResult { ...@@ -126,7 +128,7 @@ interface USBOutTransferResult {
[ [
Constructor(USBTransferStatus status, optional DataView? data), Constructor(USBTransferStatus status, optional DataView? data),
Exposed=(DedicatedWorker, SharedWorker, Window) Exposed=(DedicatedWorker,SharedWorker,Window)
] ]
interface USBIsochronousInTransferPacket { interface USBIsochronousInTransferPacket {
readonly attribute DataView? data; readonly attribute DataView? data;
...@@ -135,7 +137,7 @@ interface USBIsochronousInTransferPacket { ...@@ -135,7 +137,7 @@ interface USBIsochronousInTransferPacket {
[ [
Constructor(sequence<USBIsochronousInTransferPacket> packets, optional DataView? data), Constructor(sequence<USBIsochronousInTransferPacket> packets, optional DataView? data),
Exposed=(DedicatedWorker, SharedWorker, Window) Exposed=(DedicatedWorker,SharedWorker,Window)
] ]
interface USBIsochronousInTransferResult { interface USBIsochronousInTransferResult {
readonly attribute DataView? data; readonly attribute DataView? data;
...@@ -144,7 +146,7 @@ interface USBIsochronousInTransferResult { ...@@ -144,7 +146,7 @@ interface USBIsochronousInTransferResult {
[ [
Constructor(USBTransferStatus status, optional unsigned long bytesWritten = 0), Constructor(USBTransferStatus status, optional unsigned long bytesWritten = 0),
Exposed=(DedicatedWorker, SharedWorker, Window) Exposed=(DedicatedWorker,SharedWorker,Window)
] ]
interface USBIsochronousOutTransferPacket { interface USBIsochronousOutTransferPacket {
readonly attribute unsigned long bytesWritten; readonly attribute unsigned long bytesWritten;
...@@ -153,7 +155,7 @@ interface USBIsochronousOutTransferPacket { ...@@ -153,7 +155,7 @@ interface USBIsochronousOutTransferPacket {
[ [
Constructor(sequence<USBIsochronousOutTransferPacket> packets), Constructor(sequence<USBIsochronousOutTransferPacket> packets),
Exposed=(DedicatedWorker, SharedWorker, Window) Exposed=(DedicatedWorker,SharedWorker,Window)
] ]
interface USBIsochronousOutTransferResult { interface USBIsochronousOutTransferResult {
readonly attribute FrozenArray<USBIsochronousOutTransferPacket> packets; readonly attribute FrozenArray<USBIsochronousOutTransferPacket> packets;
...@@ -161,7 +163,7 @@ interface USBIsochronousOutTransferResult { ...@@ -161,7 +163,7 @@ interface USBIsochronousOutTransferResult {
[ [
Constructor(USBDevice device, octet configurationValue), Constructor(USBDevice device, octet configurationValue),
Exposed=(DedicatedWorker, SharedWorker, Window) Exposed=(DedicatedWorker,SharedWorker,Window)
] ]
interface USBConfiguration { interface USBConfiguration {
readonly attribute octet configurationValue; readonly attribute octet configurationValue;
...@@ -171,7 +173,7 @@ interface USBConfiguration { ...@@ -171,7 +173,7 @@ interface USBConfiguration {
[ [
Constructor(USBConfiguration configuration, octet interfaceNumber), Constructor(USBConfiguration configuration, octet interfaceNumber),
Exposed=(DedicatedWorker, SharedWorker, Window) Exposed=(DedicatedWorker,SharedWorker,Window)
] ]
interface USBInterface { interface USBInterface {
readonly attribute octet interfaceNumber; readonly attribute octet interfaceNumber;
...@@ -182,7 +184,7 @@ interface USBInterface { ...@@ -182,7 +184,7 @@ interface USBInterface {
[ [
Constructor(USBInterface deviceInterface, octet alternateSetting), Constructor(USBInterface deviceInterface, octet alternateSetting),
Exposed=(DedicatedWorker, SharedWorker, Window) Exposed=(DedicatedWorker,SharedWorker,Window)
] ]
interface USBAlternateInterface { interface USBAlternateInterface {
readonly attribute octet alternateSetting; readonly attribute octet alternateSetting;
...@@ -206,7 +208,7 @@ enum USBEndpointType { ...@@ -206,7 +208,7 @@ enum USBEndpointType {
[ [
Constructor(USBAlternateInterface alternate, octet endpointNumber, USBDirection direction), Constructor(USBAlternateInterface alternate, octet endpointNumber, USBDirection direction),
Exposed=(DedicatedWorker, SharedWorker, Window) Exposed=(DedicatedWorker,SharedWorker,Window)
] ]
interface USBEndpoint { interface USBEndpoint {
readonly attribute octet endpointNumber; readonly attribute octet endpointNumber;
...@@ -214,3 +216,21 @@ interface USBEndpoint { ...@@ -214,3 +216,21 @@ interface USBEndpoint {
readonly attribute USBEndpointType type; readonly attribute USBEndpointType type;
readonly attribute unsigned long packetSize; readonly attribute unsigned long packetSize;
}; };
dictionary USBPermissionDescriptor : PermissionDescriptor {
sequence<USBDeviceFilter> filters;
};
dictionary AllowedUSBDevice {
required octet vendorId;
required octet productId;
DOMString serialNumber;
};
dictionary USBPermissionStorage {
sequence<AllowedUSBDevice> allowedDevices = [];
};
interface USBPermissionResult : PermissionStatus {
attribute FrozenArray<USBDevice> devices;
};
...@@ -3,7 +3,7 @@ PASS WebUSB IDL test ...@@ -3,7 +3,7 @@ PASS WebUSB IDL test
PASS Partial interface Navigator: original interface defined PASS Partial interface Navigator: original interface defined
PASS Partial interface Navigator: valid exposure set PASS Partial interface Navigator: valid exposure set
PASS Partial interface WorkerNavigator: original interface defined PASS Partial interface WorkerNavigator: original interface defined
FAIL Partial interface WorkerNavigator: valid exposure set Partial WorkerNavigator interface is exposed to 'DedicatedWorker', the original interface is not. PASS Partial interface WorkerNavigator: valid exposure set
PASS USB interface: existence and properties of interface object PASS USB interface: existence and properties of interface object
PASS USB interface object length PASS USB interface object length
PASS USB interface object name PASS USB interface object name
...@@ -312,9 +312,17 @@ PASS USBEndpoint interface: usbEndpoint must inherit property "endpointNumber" w ...@@ -312,9 +312,17 @@ PASS USBEndpoint interface: usbEndpoint must inherit property "endpointNumber" w
PASS USBEndpoint interface: usbEndpoint must inherit property "direction" with the proper type PASS USBEndpoint interface: usbEndpoint must inherit property "direction" with the proper type
PASS USBEndpoint interface: usbEndpoint must inherit property "type" with the proper type PASS USBEndpoint interface: usbEndpoint must inherit property "type" with the proper type
PASS USBEndpoint interface: usbEndpoint must inherit property "packetSize" with the proper type PASS USBEndpoint interface: usbEndpoint must inherit property "packetSize" with the proper type
FAIL USBPermissionResult interface: existence and properties of interface object assert_own_property: self does not have own property "USBPermissionResult" expected property "USBPermissionResult" missing
FAIL USBPermissionResult interface object length assert_own_property: self does not have own property "USBPermissionResult" expected property "USBPermissionResult" missing
FAIL USBPermissionResult interface object name assert_own_property: self does not have own property "USBPermissionResult" expected property "USBPermissionResult" missing
FAIL USBPermissionResult interface: existence and properties of interface prototype object assert_own_property: self does not have own property "USBPermissionResult" expected property "USBPermissionResult" missing
FAIL USBPermissionResult interface: existence and properties of interface prototype object's "constructor" property assert_own_property: self does not have own property "USBPermissionResult" expected property "USBPermissionResult" missing
FAIL USBPermissionResult interface: existence and properties of interface prototype object's @@unscopables property assert_own_property: self does not have own property "USBPermissionResult" expected property "USBPermissionResult" missing
FAIL USBPermissionResult interface: attribute devices assert_own_property: self does not have own property "USBPermissionResult" expected property "USBPermissionResult" missing
PASS Unscopable handled correctly for devices property on USBPermissionResult
PASS Navigator interface: attribute usb PASS Navigator interface: attribute usb
PASS Unscopable handled correctly for usb property on Navigator PASS Unscopable handled correctly for usb property on Navigator
PASS Navigator interface: navigator must inherit property "usb" with the proper type PASS Navigator interface: navigator must inherit property "usb" with the proper type
FAIL WorkerNavigator interface: member usb Cannot use 'in' operator to search for 'usb' in undefined PASS WorkerNavigator interface: existence and properties of interface object
Harness: the test ran to completion. Harness: the test ran to completion.
...@@ -24,18 +24,18 @@ ...@@ -24,18 +24,18 @@
var usbConnectionEvent; var usbConnectionEvent;
usb_test(async () => { usb_test(async () => {
let response = await fetch('/interfaces/webusb.idl'); const idl = await fetch('/interfaces/webusb.idl').then(r => r.text());
let idl_text = await response.text(); const html = await fetch('/interfaces/html.idl').then(r => r.text());
let idl_array = new IdlArray(); const dom = await fetch('/interfaces/dom.idl').then(r => r.text());
idl_array.add_idls(idl_text);
const idl_array = new IdlArray();
idl_array.add_idls(idl);
idl_array.add_dependency_idls(html);
idl_array.add_dependency_idls(dom);
// Untested IDL interfaces // Untested IDL interfaces
idl_array.add_untested_idls('interface Event {};'); idl_array.add_untested_idls('dictionary PermissionDescriptor {};');
idl_array.add_untested_idls('interface EventHandler {};'); idl_array.add_untested_idls('interface PermissionStatus {};');
idl_array.add_untested_idls('dictionary EventInit {};');
idl_array.add_untested_idls('interface EventTarget {};');
idl_array.add_untested_idls('interface Navigator {};');
idl_array.add_untested_idls('interface WorkerNavigator {};');
let {device} = await getFakeDevice(); let {device} = await getFakeDevice();
......
...@@ -14,19 +14,18 @@ var usbEndpoint; ...@@ -14,19 +14,18 @@ var usbEndpoint;
var usbConnectionEvent; var usbConnectionEvent;
usb_test(async () => { usb_test(async () => {
let webUSBResponse = await fetch('/interfaces/webusb.idl'); const idl = await fetch('/interfaces/webusb.idl').then(r => r.text());
let domResponse = await fetch('/interfaces/dom.idl'); const html = await fetch('/interfaces/html.idl').then(r => r.text());
let webusb_idl_text = await webUSBResponse.text(); const dom = await fetch('/interfaces/dom.idl').then(r => r.text());
let dom_idl_text = await domResponse.text();
let idl_array = new IdlArray(); let idl_array = new IdlArray();
idl_array.add_idls(webusb_idl_text); idl_array.add_idls(idl);
idl_array.add_dependency_idls(html);
idl_array.add_dependency_idls(dom);
// Untested IDL interfaces // Untested IDL interfaces
idl_array.add_untested_idls(dom_idl_text, { only: ['Event', 'EventTarget'] }); idl_array.add_untested_idls('dictionary PermissionDescriptor {};');
idl_array.add_untested_idls('interface EventHandler {};'); idl_array.add_untested_idls('interface PermissionStatus {};');
idl_array.add_untested_idls('dictionary EventInit {};');
idl_array.add_untested_idls('interface Navigator {};');
idl_array.add_untested_idls('interface WorkerNavigator {};');
let {device} = await getFakeDevice(); let {device} = await getFakeDevice();
...@@ -58,4 +57,4 @@ usb_test(async () => { ...@@ -58,4 +57,4 @@ usb_test(async () => {
idl_array.test(); idl_array.test();
}, 'WebUSB on Workers IDL test'); }, 'WebUSB on Workers IDL test');
done(); done();
\ No newline at end of file
...@@ -3,7 +3,7 @@ PASS WebUSB on Workers IDL test ...@@ -3,7 +3,7 @@ PASS WebUSB on Workers IDL test
PASS Partial interface Navigator: original interface defined PASS Partial interface Navigator: original interface defined
PASS Partial interface Navigator: valid exposure set PASS Partial interface Navigator: valid exposure set
PASS Partial interface WorkerNavigator: original interface defined PASS Partial interface WorkerNavigator: original interface defined
FAIL Partial interface WorkerNavigator: valid exposure set Partial WorkerNavigator interface is exposed to 'DedicatedWorker', the original interface is not. PASS Partial interface WorkerNavigator: valid exposure set
PASS USB interface: existence and properties of interface object PASS USB interface: existence and properties of interface object
PASS USB interface object length PASS USB interface object length
PASS USB interface object name PASS USB interface object name
...@@ -310,9 +310,11 @@ PASS USBEndpoint interface: usbEndpoint must inherit property "endpointNumber" w ...@@ -310,9 +310,11 @@ PASS USBEndpoint interface: usbEndpoint must inherit property "endpointNumber" w
PASS USBEndpoint interface: usbEndpoint must inherit property "direction" with the proper type PASS USBEndpoint interface: usbEndpoint must inherit property "direction" with the proper type
PASS USBEndpoint interface: usbEndpoint must inherit property "type" with the proper type PASS USBEndpoint interface: usbEndpoint must inherit property "type" with the proper type
PASS USBEndpoint interface: usbEndpoint must inherit property "packetSize" with the proper type PASS USBEndpoint interface: usbEndpoint must inherit property "packetSize" with the proper type
PASS EventHandler interface: existence and properties of interface object PASS USBPermissionResult interface: existence and properties of interface object
PASS Navigator interface: existence and properties of interface object PASS Navigator interface: existence and properties of interface object
FAIL WorkerNavigator interface: existence and properties of interface object assert_false: expected false got true PASS WorkerNavigator interface: attribute usb
PASS Unscopable handled correctly for usb property on WorkerNavigator
PASS WorkerNavigator interface: navigator must inherit property "usb" with the proper type PASS WorkerNavigator interface: navigator must inherit property "usb" with the proper type
FAIL PermissionStatus interface: existence and properties of interface object assert_false: expected false got true
Harness: the test ran to completion. Harness: the test ran to completion.
...@@ -3,7 +3,7 @@ PASS WebUSB on Workers IDL test ...@@ -3,7 +3,7 @@ PASS WebUSB on Workers IDL test
PASS Partial interface Navigator: original interface defined PASS Partial interface Navigator: original interface defined
PASS Partial interface Navigator: valid exposure set PASS Partial interface Navigator: valid exposure set
PASS Partial interface WorkerNavigator: original interface defined PASS Partial interface WorkerNavigator: original interface defined
FAIL Partial interface WorkerNavigator: valid exposure set Partial WorkerNavigator interface is exposed to 'DedicatedWorker', the original interface is not. PASS Partial interface WorkerNavigator: valid exposure set
PASS USB interface: existence and properties of interface object PASS USB interface: existence and properties of interface object
PASS USB interface object length PASS USB interface object length
PASS USB interface object name PASS USB interface object name
...@@ -310,9 +310,11 @@ PASS USBEndpoint interface: usbEndpoint must inherit property "endpointNumber" w ...@@ -310,9 +310,11 @@ PASS USBEndpoint interface: usbEndpoint must inherit property "endpointNumber" w
PASS USBEndpoint interface: usbEndpoint must inherit property "direction" with the proper type PASS USBEndpoint interface: usbEndpoint must inherit property "direction" with the proper type
PASS USBEndpoint interface: usbEndpoint must inherit property "type" with the proper type PASS USBEndpoint interface: usbEndpoint must inherit property "type" with the proper type
PASS USBEndpoint interface: usbEndpoint must inherit property "packetSize" with the proper type PASS USBEndpoint interface: usbEndpoint must inherit property "packetSize" with the proper type
PASS EventHandler interface: existence and properties of interface object PASS USBPermissionResult interface: existence and properties of interface object
PASS Navigator interface: existence and properties of interface object PASS Navigator interface: existence and properties of interface object
FAIL WorkerNavigator interface: existence and properties of interface object assert_false: expected false got true PASS WorkerNavigator interface: attribute usb
PASS Unscopable handled correctly for usb property on WorkerNavigator
PASS WorkerNavigator interface: navigator must inherit property "usb" with the proper type PASS WorkerNavigator interface: navigator must inherit property "usb" with the proper type
FAIL PermissionStatus interface: existence and properties of interface object assert_false: expected false got true
Harness: the test ran to completion. Harness: the test ran to completion.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment