blob: 074ef7ca9aeb2fd9d0ef11fa8e8aa160e13d5001 [file] [log] [blame]
'use strict';
bluetooth_test(() => {
let promise;
return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter')
.then(() => requestDeviceWithTrustedClick({
filters: [{services: ['health_thermometer']}]}))
.then(device => device.gatt.connect())
.then(gattServer => gattServer.getPrimaryService('health_thermometer'))
.then(service => {
promise = assert_promise_rejects_with_message(
service.CALLS([
getCharacteristic('measurement_interval')|
getCharacteristics()|
getCharacteristics('measurement_interval')[UUID]]),
new DOMException(
'GATT Server is disconnected. Cannot retrieve characteristics. ' +
'(Re)connect first with `device.gatt.connect`.',
'NetworkError'));
// Disconnect called to clear attributeInstanceMap and allow the
// object to get garbage collected.
service.device.gatt.disconnect();
})
.then(runGarbageCollection)
.then(() => promise);
}, 'Garbage Collection ran during a FUNCTION_NAME call that succeeds. ' +
'Should not crash.');