OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <script src="../../../resources/testharness.js"></script> |
| 3 <script src="../../../resources/testharnessreport.js"></script> |
| 4 <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> |
| 5 <script> |
| 6 'use strict'; |
| 7 var device; |
| 8 var server; |
| 9 var numEvents = 0; |
| 10 promise_test(() => { |
| 11 return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter') |
| 12 .then(() => requestDeviceWithKeyDown({ |
| 13 filters: [{services: ['health_thermometer']}], |
| 14 optionalServices: [request_disconnection_service_uuid] |
| 15 })) |
| 16 .then(requestedDevice => { |
| 17 device = requestedDevice; |
| 18 return device.gatt.connect(); |
| 19 }) |
| 20 .then(gattServer => { |
| 21 server = gattServer; |
| 22 return get_request_disconnection(gattServer); |
| 23 }) |
| 24 .then(requestDisconnection => { |
| 25 let eventCounter = () => { ++numEvents; }; |
| 26 device.addEventListener('gattserverdisconnected', eventCounter); |
| 27 return Promise.all([requestDisconnection(), server.disconnect()]); |
| 28 }) |
| 29 .then(() => assert_equals(numEvents, 1)); |
| 30 }, 'A device disconnects while the platform is disconnecting that device, ' + |
| 31 'only one gattserverdisconnected event should fire.'); |
| 32 </script> |
OLD | NEW |