| OLD | NEW |
| 1 'use strict'; | 1 'use strict'; |
| 2 promise_test( | 2 promise_test( |
| 3 () => { | 3 () => { |
| 4 let val = new Uint8Array([1]); | 4 let val = new Uint8Array([1]); |
| 5 let promise; | 5 let promise; |
| 6 return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter') | 6 return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter') |
| 7 .then( | 7 .then( |
| 8 () => requestDeviceWithKeyDown( | 8 () => requestDeviceWithKeyDown( |
| 9 {filters: [{services: ['health_thermometer']}]})) | 9 {filters: [{services: ['health_thermometer']}]})) |
| 10 .then(device => device.gatt.connect()) | 10 .then(device => device.gatt.connect()) |
| 11 .then( | 11 .then( |
| 12 gattServer => gattServer.getPrimaryService('health_thermometer')) | 12 gattServer => gattServer.getPrimaryService('health_thermometer')) |
| 13 .then(service => service.getCharacteristic('measurement_interval')) | 13 .then(service => service.getCharacteristic('measurement_interval')) |
| 14 .then( | 14 .then( |
| 15 characteristic => | 15 characteristic => |
| 16 characteristic.getDescriptor(user_description.name)) | 16 characteristic.getDescriptor(user_description.name)) |
| 17 .then(descriptor => { | 17 .then(descriptor => { |
| 18 promise = assert_promise_rejects_with_message( | 18 promise = assert_promise_rejects_with_message( |
| 19 descriptor.CALLS([readValue()|writeValue(val)]), | 19 descriptor.CALLS([readValue()|writeValue(val)]), |
| 20 new DOMException( | 20 new DOMException( |
| 21 'GATT Server disconnected while performing a GATT operation.
', | 21 'GATT Server is disconnected. Cannot perform GATT operations.
' + |
| 22 '(Re)connect first with `device.gatt.connect`.', |
| 22 'NetworkError')); | 23 'NetworkError')); |
| 23 // Disconnect called to clear attributeInstanceMap and allow the | 24 // Disconnect called to clear attributeInstanceMap and allow the |
| 24 // object to get garbage collected. | 25 // object to get garbage collected. |
| 25 descriptor.characteristic.service.device.gatt.disconnect(); | 26 descriptor.characteristic.service.device.gatt.disconnect(); |
| 26 }) | 27 }) |
| 27 .then(runGarbageCollection) | 28 .then(runGarbageCollection) |
| 28 .then(() => promise); | 29 .then(() => promise); |
| 29 }, | 30 }, |
| 30 'Garbage collection ran during a FUNCTION_NAME call that succeeds. ' + | 31 'Garbage collection ran during a FUNCTION_NAME call that succeeds. ' + |
| 31 'Should not crash.'); | 32 'Should not crash.'); |
| OLD | NEW |