LibWeb: Import serial idl harness wpt tests

This commit is contained in:
Edwin Hoksberg 2025-08-06 13:17:40 +02:00 committed by Jelle Raaijmakers
commit ef9a3a2327
Notes: github-actions[bot] 2025-08-08 08:24:25 +00:00
4 changed files with 189 additions and 0 deletions

View file

@ -0,0 +1,62 @@
Harness status: OK
Found 57 tests
57 Pass
Pass idl_test setup
Pass idl_test validation
Pass Partial interface Navigator: original interface defined
Pass Partial interface Navigator: valid exposure set
Pass Partial interface Navigator: member names are unique
Pass Partial interface WorkerNavigator: original interface defined
Pass Partial interface WorkerNavigator: valid exposure set
Pass Partial interface WorkerNavigator: member names are unique
Pass Partial interface Navigator[2]: member names are unique
Pass Partial interface mixin NavigatorID: member names are unique
Pass Navigator includes NavigatorID: member names are unique
Pass Navigator includes NavigatorLanguage: member names are unique
Pass Navigator includes NavigatorOnLine: member names are unique
Pass Navigator includes NavigatorContentUtils: member names are unique
Pass Navigator includes NavigatorCookies: member names are unique
Pass Navigator includes NavigatorPlugins: member names are unique
Pass Navigator includes NavigatorConcurrentHardware: member names are unique
Pass WorkerNavigator includes NavigatorID: member names are unique
Pass WorkerNavigator includes NavigatorLanguage: member names are unique
Pass WorkerNavigator includes NavigatorOnLine: member names are unique
Pass WorkerNavigator includes NavigatorConcurrentHardware: member names are unique
Pass Serial interface: existence and properties of interface object
Pass Serial interface object length
Pass Serial interface object name
Pass Serial interface: existence and properties of interface prototype object
Pass Serial interface: existence and properties of interface prototype object's "constructor" property
Pass Serial interface: existence and properties of interface prototype object's @@unscopables property
Pass Serial interface: attribute onconnect
Pass Serial interface: attribute ondisconnect
Pass Serial interface: operation getPorts()
Pass Serial interface: operation requestPort(optional SerialPortRequestOptions)
Pass Serial must be primary interface of navigator.serial
Pass Stringification of navigator.serial
Pass Serial interface: navigator.serial must inherit property "onconnect" with the proper type
Pass Serial interface: navigator.serial must inherit property "ondisconnect" with the proper type
Pass Serial interface: navigator.serial must inherit property "getPorts()" with the proper type
Pass Serial interface: navigator.serial must inherit property "requestPort(optional SerialPortRequestOptions)" with the proper type
Pass Serial interface: calling requestPort(optional SerialPortRequestOptions) on navigator.serial with too few arguments must throw TypeError
Pass SerialPort interface: existence and properties of interface object
Pass SerialPort interface object length
Pass SerialPort interface object name
Pass SerialPort interface: existence and properties of interface prototype object
Pass SerialPort interface: existence and properties of interface prototype object's "constructor" property
Pass SerialPort interface: existence and properties of interface prototype object's @@unscopables property
Pass SerialPort interface: attribute onconnect
Pass SerialPort interface: attribute ondisconnect
Pass SerialPort interface: attribute connected
Pass SerialPort interface: attribute readable
Pass SerialPort interface: attribute writable
Pass SerialPort interface: operation getInfo()
Pass SerialPort interface: operation open(SerialOptions)
Pass SerialPort interface: operation setSignals(optional SerialOutputSignals)
Pass SerialPort interface: operation getSignals()
Pass SerialPort interface: operation close()
Pass SerialPort interface: operation forget()
Pass Navigator interface: attribute serial
Pass Navigator interface: navigator must inherit property "serial" with the proper type

View file

@ -0,0 +1,89 @@
// GENERATED CONTENT - DO NOT EDIT
// Content was automatically extracted by Reffy into webref
// (https://github.com/w3c/webref)
// Source: Web Serial API (https://wicg.github.io/serial/)
[Exposed=Window, SecureContext]
partial interface Navigator {
[SameObject] readonly attribute Serial serial;
};
[Exposed=DedicatedWorker, SecureContext]
partial interface WorkerNavigator {
[SameObject] readonly attribute Serial serial;
};
[Exposed=(DedicatedWorker, Window), SecureContext]
interface Serial : EventTarget {
attribute EventHandler onconnect;
attribute EventHandler ondisconnect;
Promise<sequence<SerialPort>> getPorts();
[Exposed=Window] Promise<SerialPort> requestPort(optional SerialPortRequestOptions options = {});
};
dictionary SerialPortRequestOptions {
sequence<SerialPortFilter> filters;
sequence<BluetoothServiceUUID> allowedBluetoothServiceClassIds;
};
dictionary SerialPortFilter {
unsigned short usbVendorId;
unsigned short usbProductId;
BluetoothServiceUUID bluetoothServiceClassId;
};
[Exposed=(DedicatedWorker,Window), SecureContext]
interface SerialPort : EventTarget {
attribute EventHandler onconnect;
attribute EventHandler ondisconnect;
readonly attribute boolean connected;
readonly attribute ReadableStream readable;
readonly attribute WritableStream writable;
SerialPortInfo getInfo();
Promise<undefined> open(SerialOptions options);
Promise<undefined> setSignals(optional SerialOutputSignals signals = {});
Promise<SerialInputSignals> getSignals();
Promise<undefined> close();
Promise<undefined> forget();
};
dictionary SerialPortInfo {
unsigned short usbVendorId;
unsigned short usbProductId;
BluetoothServiceUUID bluetoothServiceClassId;
};
dictionary SerialOptions {
[EnforceRange] required unsigned long baudRate;
[EnforceRange] octet dataBits = 8;
[EnforceRange] octet stopBits = 1;
ParityType parity = "none";
[EnforceRange] unsigned long bufferSize = 255;
FlowControlType flowControl = "none";
};
enum ParityType {
"none",
"even",
"odd"
};
enum FlowControlType {
"none",
"hardware"
};
dictionary SerialOutputSignals {
boolean dataTerminalReady;
boolean requestToSend;
boolean break;
};
dictionary SerialInputSignals {
required boolean dataCarrierDetect;
required boolean clearToSend;
required boolean ringIndicator;
required boolean dataSetReady;
};

View file

@ -0,0 +1,16 @@
<!doctype html>
<meta charset=utf-8>
<script>
self.GLOBAL = {
isWindow: function() { return true; },
isWorker: function() { return false; },
isShadowRealm: function() { return false; },
};
</script>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<script src="../resources/WebIDLParser.js"></script>
<script src="../resources/idlharness.js"></script>
<div id=log></div>
<script src="../serial/idlharness.https.any.js"></script>

View file

@ -0,0 +1,22 @@
// META: script=/resources/WebIDLParser.js
// META: script=/resources/idlharness.js
'use strict';
idl_test(
['serial'],
['html', 'dom'],
idl_array => {
idl_array.add_objects({
Serial: ['navigator.serial'],
// TODO: SerialPort
// TODO: SerialPortInfo
});
if (self.GLOBAL.isWorker()) {
idl_array.add_objects({ WorkerNavigator: ['navigator'] });
} else {
idl_array.add_objects({ Navigator: ['navigator'] });
}
}
);