mirror of
https://github.com/servo/servo.git
synced 2025-08-04 05:00:08 +01:00
Update web-platform-tests to revision 74bae78af4b95a2f0ca3a81df9c7fe3143f24bbc
This commit is contained in:
parent
fb95f9df9c
commit
02c1eed999
150 changed files with 2395 additions and 829 deletions
|
@ -7,10 +7,12 @@
|
|||
const test_desc = 'Bluetooth IDL test';
|
||||
|
||||
test(() => {
|
||||
assert_throws(new TypeError(), () => new Bluetooth(),
|
||||
'the constructor should not be callable with "new"');
|
||||
assert_throws(new TypeError(), () => Bluetooth(),
|
||||
'the constructor should not be callable');
|
||||
assert_throws(
|
||||
new TypeError(), () => new Bluetooth(),
|
||||
'the constructor should not be callable with "new"');
|
||||
assert_throws(
|
||||
new TypeError(), () => Bluetooth(),
|
||||
'the constructor should not be callable');
|
||||
|
||||
// Bluetooth implements BluetoothDiscovery;
|
||||
assert_true('requestDevice' in navigator.bluetooth);
|
||||
|
|
|
@ -9,23 +9,28 @@
|
|||
const test_desc_idl = 'BluetoothDevice IDL test.';
|
||||
|
||||
test(() => {
|
||||
assert_throws(new TypeError(), () => new BluetoothDevice(),
|
||||
assert_throws(
|
||||
new TypeError(), () => new BluetoothDevice(),
|
||||
'the constructor should not be callable with "new"');
|
||||
assert_throws(new TypeError(), () => BluetoothDevice(),
|
||||
assert_throws(
|
||||
new TypeError(), () => BluetoothDevice(),
|
||||
'the constructor should not be callable');
|
||||
}, test_desc_idl);
|
||||
|
||||
const test_desc_attr = 'BluetoothDevice attributes.';
|
||||
let device;
|
||||
bluetooth_test(() => getConnectedHealthThermometerDevice()
|
||||
.then(({device}) => {
|
||||
assert_equals(device.constructor.name, 'BluetoothDevice');
|
||||
var old_device_id = device.id;
|
||||
assert_throws(new TypeError(), () => device.id = 'overwritten',
|
||||
'the device id should not be writable');
|
||||
assert_throws(new TypeError(), () => device.name = 'overwritten',
|
||||
'the device name should not be writable');
|
||||
assert_equals(device.id, old_device_id);
|
||||
assert_equals(device.name, 'Health Thermometer');
|
||||
}), test_desc_attr);
|
||||
bluetooth_test(
|
||||
() => getConnectedHealthThermometerDevice().then(({device}) => {
|
||||
assert_equals(device.constructor.name, 'BluetoothDevice');
|
||||
var old_device_id = device.id;
|
||||
assert_throws(
|
||||
new TypeError(), () => device.id = 'overwritten',
|
||||
'the device id should not be writable');
|
||||
assert_throws(
|
||||
new TypeError(), () => device.name = 'overwritten',
|
||||
'the device name should not be writable');
|
||||
assert_equals(device.id, old_device_id);
|
||||
assert_equals(device.name, 'Health Thermometer');
|
||||
}),
|
||||
test_desc_attr);
|
||||
</script>
|
||||
|
|
|
@ -19,22 +19,25 @@ test(() => {
|
|||
assert_equals(BluetoothUUID.getDescriptor(NaN), base_uuid);
|
||||
}, 'NaN returns basic uuid');
|
||||
|
||||
test(() => {
|
||||
let max_uuid = 'ffffffff-0000-1000-8000-00805f9b34fb';
|
||||
let nine_digits = 0xfffffffff;
|
||||
let thirteen_digits = 0xfffffffffffff;
|
||||
let fourteen_digits = 0xffffffffffffff;
|
||||
assert_equals(BluetoothUUID.getService(nine_digits), max_uuid);
|
||||
assert_equals(BluetoothUUID.getCharacteristic(nine_digits), max_uuid);
|
||||
assert_equals(BluetoothUUID.getDescriptor(nine_digits), max_uuid);
|
||||
assert_equals(BluetoothUUID.getService(thirteen_digits), max_uuid);
|
||||
assert_equals(BluetoothUUID.getCharacteristic(thirteen_digits), max_uuid);
|
||||
assert_equals(BluetoothUUID.getDescriptor(thirteen_digits), max_uuid);
|
||||
assert_equals(BluetoothUUID.getService(fourteen_digits), base_uuid);
|
||||
assert_equals(BluetoothUUID.getCharacteristic(fourteen_digits), base_uuid);
|
||||
assert_equals(BluetoothUUID.getDescriptor(fourteen_digits), base_uuid);
|
||||
}, 'Values between 0xfffffffff (8 digits) and 0xffffffffffffff (14 digits)' +
|
||||
'should return max UUID');
|
||||
test(
|
||||
() => {
|
||||
let max_uuid = 'ffffffff-0000-1000-8000-00805f9b34fb';
|
||||
let nine_digits = 0xfffffffff;
|
||||
let thirteen_digits = 0xfffffffffffff;
|
||||
let fourteen_digits = 0xffffffffffffff;
|
||||
assert_equals(BluetoothUUID.getService(nine_digits), max_uuid);
|
||||
assert_equals(BluetoothUUID.getCharacteristic(nine_digits), max_uuid);
|
||||
assert_equals(BluetoothUUID.getDescriptor(nine_digits), max_uuid);
|
||||
assert_equals(BluetoothUUID.getService(thirteen_digits), max_uuid);
|
||||
assert_equals(BluetoothUUID.getCharacteristic(thirteen_digits), max_uuid);
|
||||
assert_equals(BluetoothUUID.getDescriptor(thirteen_digits), max_uuid);
|
||||
assert_equals(BluetoothUUID.getService(fourteen_digits), base_uuid);
|
||||
assert_equals(
|
||||
BluetoothUUID.getCharacteristic(fourteen_digits), base_uuid);
|
||||
assert_equals(BluetoothUUID.getDescriptor(fourteen_digits), base_uuid);
|
||||
},
|
||||
'Values between 0xfffffffff (8 digits) and 0xffffffffffffff (14 digits)' +
|
||||
'should return max UUID');
|
||||
|
||||
test(() => {
|
||||
assert_equals(BluetoothUUID.getService(Infinity), base_uuid);
|
||||
|
@ -54,7 +57,8 @@ test(() => {
|
|||
let adeadbeef_alias = 0xADEADBEEF;
|
||||
let adeadbeef_uuid = 'deadbeef-0000-1000-8000-00805f9b34fb';
|
||||
assert_equals(BluetoothUUID.getService(adeadbeef_alias), adeadbeef_uuid);
|
||||
assert_equals(BluetoothUUID.getCharacteristic(adeadbeef_alias), adeadbeef_uuid);
|
||||
assert_equals(
|
||||
BluetoothUUID.getCharacteristic(adeadbeef_alias), adeadbeef_uuid);
|
||||
assert_equals(BluetoothUUID.getDescriptor(adeadbeef_alias), adeadbeef_uuid);
|
||||
}, 'Only first 32bits should be used.');
|
||||
|
||||
|
@ -68,31 +72,40 @@ test(() => {
|
|||
test(() => {
|
||||
let all_caps_uuid = '1A2B3C4D-5E6F-7A8B-9C0D-1E2F3A4B5C6D';
|
||||
assert_throws(TypeError(), () => BluetoothUUID.getService(all_caps_uuid));
|
||||
assert_throws(TypeError(), () => BluetoothUUID.getCharacteristic(all_caps_uuid));
|
||||
assert_throws(
|
||||
TypeError(), () => BluetoothUUID.getCharacteristic(all_caps_uuid));
|
||||
assert_throws(TypeError(), () => BluetoothUUID.getDescriptor(all_caps_uuid));
|
||||
}, 'A UUID String with uppercase letters is an invalid UUID.');
|
||||
|
||||
test(() => {
|
||||
let string_alias = 'deadbeef';
|
||||
assert_throws(TypeError(), () => BluetoothUUID.getService(string_alias));
|
||||
assert_throws(TypeError(), () => BluetoothUUID.getCharacteristic(string_alias));
|
||||
assert_throws(
|
||||
TypeError(), () => BluetoothUUID.getCharacteristic(string_alias));
|
||||
assert_throws(TypeError(), () => BluetoothUUID.getDescriptor(string_alias));
|
||||
}, 'A 32bit *String* alias is invalid.');
|
||||
|
||||
test(() => {
|
||||
let invalid_character_uuid = '0000000g-0000-1000-8000-00805f9b34fb';
|
||||
assert_throws(TypeError(), () => BluetoothUUID.getService(invalid_character_uuid));
|
||||
assert_throws(TypeError(), () => BluetoothUUID.getCharacteristic(invalid_character_uuid));
|
||||
assert_throws(TypeError(), () => BluetoothUUID.getDescriptor(invalid_character_uuid));
|
||||
assert_throws(
|
||||
TypeError(), () => BluetoothUUID.getService(invalid_character_uuid));
|
||||
assert_throws(
|
||||
TypeError(),
|
||||
() => BluetoothUUID.getCharacteristic(invalid_character_uuid));
|
||||
assert_throws(
|
||||
TypeError(), () => BluetoothUUID.getDescriptor(invalid_character_uuid));
|
||||
}, 'A UUID with invalid characters is an invalid UUID.');
|
||||
|
||||
test(() => {
|
||||
assert_equals(BluetoothUUID.getService('alert_notification'),
|
||||
'00001811-0000-1000-8000-00805f9b34fb');
|
||||
assert_equals(BluetoothUUID.getCharacteristic('aerobic_heart_rate_lower_limit'),
|
||||
'00002a7e-0000-1000-8000-00805f9b34fb');
|
||||
assert_equals(BluetoothUUID.getDescriptor('gatt.characteristic_extended_properties'),
|
||||
'00002900-0000-1000-8000-00805f9b34fb');
|
||||
assert_equals(
|
||||
BluetoothUUID.getService('alert_notification'),
|
||||
'00001811-0000-1000-8000-00805f9b34fb');
|
||||
assert_equals(
|
||||
BluetoothUUID.getCharacteristic('aerobic_heart_rate_lower_limit'),
|
||||
'00002a7e-0000-1000-8000-00805f9b34fb');
|
||||
assert_equals(
|
||||
BluetoothUUID.getDescriptor('gatt.characteristic_extended_properties'),
|
||||
'00002900-0000-1000-8000-00805f9b34fb');
|
||||
}, 'A valid UUID from a name.');
|
||||
|
||||
test(() => {
|
||||
|
@ -136,7 +149,8 @@ test(() => {
|
|||
assert_throws(new TypeError, () => BluetoothUUID.canonicalUUID(undefined));
|
||||
assert_equals(BluetoothUUID.canonicalUUID(null), base_uuid);
|
||||
assert_equals(BluetoothUUID.canonicalUUID(false), base_uuid);
|
||||
assert_equals(BluetoothUUID.canonicalUUID(true), BluetoothUUID.canonicalUUID(1));
|
||||
assert_equals(
|
||||
BluetoothUUID.canonicalUUID(true), BluetoothUUID.canonicalUUID(1));
|
||||
assert_throws(new TypeError, () => BluetoothUUID.canonicalUUID(NaN));
|
||||
|
||||
// getService
|
||||
|
|
|
@ -6,8 +6,7 @@
|
|||
const test_desc = '[SameObject] test for navigator.bluetooth';
|
||||
|
||||
test(() => {
|
||||
assert_true('bluetooth' in navigator,
|
||||
'navigator.bluetooth exists.');
|
||||
assert_true('bluetooth' in navigator, 'navigator.bluetooth exists.');
|
||||
}, 'navigator.bluetooth IDL test');
|
||||
|
||||
test(() => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue