Update web-platform-tests to revision c26470dac73f2df9d4822a0d3482f7eb1ebf57d9

This commit is contained in:
Anthony Ramine 2018-01-10 14:28:20 +01:00
parent 7de87c487b
commit 4d3c932c47
648 changed files with 9014 additions and 4821 deletions

View file

@ -52,8 +52,8 @@ function performChromiumSetup() {
// problem for the new tests that do not use setBluetoothFakeAdapter().
// TODO(crbug.com/569709): Remove once setBluetoothFakeAdapter is no
// longer used.
.then(() => setBluetoothFakeAdapter ? setBluetoothFakeAdapter('')
: undefined);
.then(() => typeof setBluetoothFakeAdapter === 'undefined' ?
undefined : setBluetoothFakeAdapter(''));
}
@ -673,7 +673,14 @@ function getHealthThermometerDeviceWithServicesDiscovered(options) {
code: HCI_SUCCESS,
}))
.then(() => new Promise(resolve => {
iframe.src = '../../../resources/bluetooth/health-thermometer-iframe.html';
let src = '/bluetooth/resources/health-thermometer-iframe.html';
// TODO(509038): Can be removed once LayoutTests/bluetooth/* that use
// health-thermometer-iframe.html have been moved to
// LayoutTests/external/wpt/bluetooth/*
if (window.location.pathname.includes('/LayoutTests/')) {
src = '../../../external/wpt/bluetooth/resources/health-thermometer-iframe.html';
}
iframe.src = src;
document.body.appendChild(iframe);
iframe.addEventListener('load', resolve);
}))

View file

@ -0,0 +1,34 @@
<!DOCTYPE html>
<script>
let device;
function requestDeviceWithOptionsAndConnect(options) {
return navigator.bluetooth.requestDevice(options)
.then(device => device.gatt.connect());
}
window.onmessage = messageEvent => {
switch (messageEvent.data.type) {
case 'RequestAndConnect':
requestDeviceWithOptionsAndConnect(messageEvent.data.options)
.then(gatt => {
device = gatt.device;
parent.postMessage('Connected', '*');
}).catch(err => {
parent.postMessage(`FAIL: ${err}`, '*');
});
break;
case 'DiscoverServices':
requestDeviceWithOptionsAndConnect(messageEvent.data.options)
.then(gatt => gatt.getPrimaryServices())
.then(() => parent.postMessage('DiscoveryComplete', '*'))
.catch(err => {
parent.postMessage(`FAIL: ${err}`, '*');
});
break;
default:
parent.postMessage(`FAIL: Bad message type: ${messageEvent.data.type}`,
'*');
}
};
</script>