| <!DOCTYPE html> |
| <script src="../../../resources/testharness.js"></script> |
| <script src="../../../resources/testharnessreport.js"></script> |
| <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> |
| <script> |
| 'use strict'; |
| let test_desc = 'A device disconnecting while connected should fire the ' + |
| 'gattserverdisconnected event.'; |
| let device, fake_peripheral; |
| bluetooth_test(() => getHealthThermometerDevice() |
| .then(_ => ({device, fake_peripheral} = _)) |
| .then(() => { |
| fake_peripheral.simulateGATTDisconnection(); |
| return eventPromise(device, 'gattserverdisconnected'); |
| }) |
| .then(e => assert_true(e.bubbles)), test_desc); |
| </script> |