| Index: third_party/WebKit/LayoutTests/resources/bluetooth/heart-rate-iframe.html
|
| diff --git a/third_party/WebKit/LayoutTests/resources/bluetooth/heart-rate-iframe.html b/third_party/WebKit/LayoutTests/resources/bluetooth/heart-rate-iframe.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..4f1442af76d606e8f2facfc85393b5ad5d3810ef
|
| --- /dev/null
|
| +++ b/third_party/WebKit/LayoutTests/resources/bluetooth/heart-rate-iframe.html
|
| @@ -0,0 +1,28 @@
|
| +<!DOCTYPE html>
|
| +<script>
|
| + let device;
|
| + window.onmessage = messageEvent => {
|
| + if (messageEvent.data === 'RequestAndConnect') {
|
| + navigator.bluetooth.requestDevice({
|
| + filters: [{services: ['heart_rate']}]
|
| + })
|
| + .then(device => device.gatt.connect())
|
| + .then(gattServer => {
|
| + device = gattServer.device;
|
| + parent.postMessage('Connected', '*');
|
| + }).catch(err => {
|
| + console.error(err);
|
| + parent.postMessage('FAIL: ' + err, '*');
|
| + });
|
| + } else if (messageEvent.data === 'StartNotifications') {
|
| + device.gatt.getPrimaryService('heart_rate')
|
| + .then(service => service.getCharacteristic('heart_rate_measurement'))
|
| + .then(char => char.startNotifications())
|
| + .then(char => {
|
| + char.addEventListener('characteristicvaluechanged', function() {});
|
| + parent.postMessage('NotificationsStarted', '*');
|
| + });
|
| + }
|
| + };
|
| + parent.postMessage("Ready", "*");
|
| +</script>
|
|
|