mirror of
https://github.com/servo/servo.git
synced 2025-08-27 08:08:19 +01:00
Update web-platform-tests to revision c26470dac73f2df9d4822a0d3482f7eb1ebf57d9
This commit is contained in:
parent
7de87c487b
commit
4d3c932c47
648 changed files with 9014 additions and 4821 deletions
|
@ -0,0 +1,17 @@
|
|||
<!DOCTYPE html>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/resources/testdriver.js"></script>
|
||||
<script src="/resources/testdriver-vendor.js"></script>
|
||||
<script src="/bluetooth/resources/bluetooth-helpers.js"></script>
|
||||
<script>
|
||||
'use strict';
|
||||
bluetooth_test(() => {
|
||||
return getDiscoveredHealthThermometerDevice()
|
||||
.then(({device, fake_peripheral}) => {
|
||||
return fake_peripheral.setNextGATTConnectionResponse({code: HCI_SUCCESS})
|
||||
.then(() => device.gatt.connect())
|
||||
.then(gatt => assert_true(gatt.connected));
|
||||
});
|
||||
}, 'Device will connect');
|
||||
</script>
|
|
@ -0,0 +1,22 @@
|
|||
<!DOCTYPE html>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/resources/testdriver.js"></script>
|
||||
<script src="/resources/testdriver-vendor.js"></script>
|
||||
<script src="/bluetooth/resources/bluetooth-helpers.js"></script>
|
||||
<script>
|
||||
'use strict';
|
||||
bluetooth_test(() => {
|
||||
return getDiscoveredHealthThermometerDevice()
|
||||
.then(({device, fake_peripheral}) => {
|
||||
return fake_peripheral.setNextGATTConnectionResponse({code: HCI_SUCCESS})
|
||||
.then(() => {
|
||||
// Don't return the promise and let |device| go out of scope
|
||||
// so that it gets garbage collected.
|
||||
device.gatt.connect();
|
||||
});
|
||||
})
|
||||
.then(runGarbageCollection)
|
||||
}, 'Garbage Collection ran during a connect call that succeeds. ' +
|
||||
'Should not crash.');
|
||||
</script>
|
|
@ -0,0 +1,25 @@
|
|||
<!DOCTYPE html>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/resources/testdriver.js"></script>
|
||||
<script src="/resources/testdriver-vendor.js"></script>
|
||||
<script src="/bluetooth/resources/bluetooth-helpers.js"></script>
|
||||
<script>
|
||||
'use strict';
|
||||
bluetooth_test(() => {
|
||||
return getDiscoveredHealthThermometerDevice()
|
||||
.then(({device, fake_peripheral}) => {
|
||||
return fake_peripheral
|
||||
.setNextGATTConnectionResponse({code: HCI_SUCCESS})
|
||||
.then(() => device.gatt.connect())
|
||||
.then(gatt1 => {
|
||||
// No second response is necessary because an ATT Bearer
|
||||
// already exists from the first connection.
|
||||
// See https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattserver-connect
|
||||
// step 5.1.
|
||||
return device.gatt.connect().then(gatt2 => [gatt1, gatt2]);
|
||||
});
|
||||
})
|
||||
.then(([gatt1, gatt2]) => assert_equals(gatt1, gatt2));
|
||||
}, 'Multiple connects should return the same gatt object.');
|
||||
</script>
|
|
@ -0,0 +1,19 @@
|
|||
<!DOCTYPE html>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/resources/testdriver.js"></script>
|
||||
<script src="/resources/testdriver-vendor.js"></script>
|
||||
<script src="/bluetooth/resources/bluetooth-helpers.js"></script>
|
||||
<script>
|
||||
'use strict';
|
||||
bluetooth_test(() => {
|
||||
return getDiscoveredHealthThermometerDevice()
|
||||
.then(({device, fake_peripheral}) => {
|
||||
return fake_peripheral.setNextGATTConnectionResponse({code: HCI_SUCCESS})
|
||||
.then(() => device.gatt.connect());
|
||||
})
|
||||
.then(gatt => {
|
||||
assert_equals(gatt.device, gatt.device);
|
||||
});
|
||||
}, "[SameObject] test for BluetoothRemoteGATTServer's device.");
|
||||
</script>
|
|
@ -0,0 +1,29 @@
|
|||
<!DOCTYPE html>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/resources/testdriver.js"></script>
|
||||
<script src="/resources/testdriver-vendor.js"></script>
|
||||
<script src="/bluetooth/resources/bluetooth-helpers.js"></script>
|
||||
<script>
|
||||
'use strict';
|
||||
const test_desc = 'Connect + Disconnect twice still results in ' +
|
||||
'\'connected\' being false.';
|
||||
let device, fake_peripheral;
|
||||
|
||||
// TODO(569716): Test that the disconnect signal was sent to the device.
|
||||
bluetooth_test(() => getDiscoveredHealthThermometerDevice()
|
||||
.then(_ => ({device, fake_peripheral} = _))
|
||||
.then(() => fake_peripheral.setNextGATTConnectionResponse({
|
||||
code: HCI_SUCCESS,
|
||||
}))
|
||||
.then(() => device.gatt.connect()
|
||||
.then(gattServer => {
|
||||
gattServer.disconnect();
|
||||
assert_false(gattServer.connected);
|
||||
})
|
||||
.then(() => device.gatt.connect())
|
||||
.then(gattServer => {
|
||||
gattServer.disconnect();
|
||||
assert_false(gattServer.connected);
|
||||
})), test_desc);
|
||||
</script>
|
|
@ -0,0 +1,36 @@
|
|||
<!DOCTYPE html>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/resources/testdriver.js"></script>
|
||||
<script src="/resources/testdriver-vendor.js"></script>
|
||||
<script src="/bluetooth/resources/bluetooth-helpers.js"></script>
|
||||
<body>
|
||||
<script>
|
||||
'use strict';
|
||||
const test_desc = 'Detach frame then garbage collect. We shouldn\'t crash.';
|
||||
let iframe = document.createElement('iframe');
|
||||
|
||||
bluetooth_test(() => setUpConnectableHealthThermometerDevice()
|
||||
// 1. Load the iframe.
|
||||
.then(() => new Promise(resolve => {
|
||||
iframe.src = '/bluetooth/resources/health-thermometer-iframe.html';
|
||||
document.body.appendChild(iframe);
|
||||
iframe.addEventListener('load', resolve);
|
||||
}))
|
||||
// 2. Connect device, detach the iframe, and run garbage collection.
|
||||
.then(() => new Promise(resolve => {
|
||||
callWithTrustedClick(() => {
|
||||
iframe.contentWindow.postMessage({
|
||||
type: 'RequestAndConnect',
|
||||
options: {filters: [{services: ['health_thermometer']}]}
|
||||
}, '*');
|
||||
});
|
||||
|
||||
window.onmessage = messageEvent => {
|
||||
assert_equals(messageEvent.data, 'Connected');
|
||||
iframe.remove();
|
||||
runGarbageCollection().then(resolve);
|
||||
}
|
||||
})), test_desc)
|
||||
</script>
|
||||
</body>
|
|
@ -0,0 +1,26 @@
|
|||
<!DOCTYPE html>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/resources/testdriver.js"></script>
|
||||
<script src="/resources/testdriver-vendor.js"></script>
|
||||
<script src="/bluetooth/resources/bluetooth-helpers.js"></script>
|
||||
<script>
|
||||
'use strict';
|
||||
const test_desc = 'Calling disconnect twice in a row still results in ' +
|
||||
'\'connected\' being false.';
|
||||
let device, fake_peripheral;
|
||||
|
||||
// TODO(569716): Test that the disconnect signal was sent to the device.
|
||||
bluetooth_test(() => getDiscoveredHealthThermometerDevice()
|
||||
.then(_ => ({device, fake_peripheral} = _))
|
||||
.then(() => fake_peripheral.setNextGATTConnectionResponse({
|
||||
code: HCI_SUCCESS,
|
||||
}))
|
||||
.then(() => device.gatt.connect())
|
||||
.then(gattServer => {
|
||||
gattServer.disconnect();
|
||||
assert_false(gattServer.connected);
|
||||
gattServer.disconnect();
|
||||
assert_false(gattServer.connected);
|
||||
}), test_desc);
|
||||
</script>
|
|
@ -0,0 +1,38 @@
|
|||
<!DOCTYPE html>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/resources/testdriver.js"></script>
|
||||
<script src="/resources/testdriver-vendor.js"></script>
|
||||
<script src="/bluetooth/resources/bluetooth-helpers.js"></script>
|
||||
<body>
|
||||
<script>
|
||||
'use strict';
|
||||
const test_desc = 'Garbage collect then detach frame. We shouldn\'t crash.';
|
||||
let iframe = document.createElement('iframe');
|
||||
|
||||
bluetooth_test(() => setUpConnectableHealthThermometerDevice()
|
||||
// 1. Load the iframe.
|
||||
.then((f) => new Promise(resolve => {
|
||||
iframe.src = '/bluetooth/resources/health-thermometer-iframe.html';
|
||||
document.body.appendChild(iframe);
|
||||
iframe.addEventListener('load', resolve);
|
||||
}))
|
||||
// 2. Connect device, run garbage collection, and detach iframe.
|
||||
.then(() => new Promise(resolve => {
|
||||
callWithTrustedClick(() => {
|
||||
iframe.contentWindow.postMessage({
|
||||
type: 'RequestAndConnect',
|
||||
options: {filters: [{services: ['health_thermometer']}]}
|
||||
}, '*');
|
||||
});
|
||||
|
||||
window.onmessage = messageEvent => {
|
||||
assert_equals(messageEvent.data, 'Connected');
|
||||
runGarbageCollection().then(() => {
|
||||
iframe.remove();
|
||||
resolve();
|
||||
});
|
||||
}
|
||||
})), test_desc)
|
||||
</script>
|
||||
</body>
|
Loading…
Add table
Add a link
Reference in a new issue