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 promise_test(t => { |
| 8 return setBluetoothFakeAdapter('DisconnectingHeartRateAdapter') |
| 9 .then(() => requestDeviceWithKeyDown({ |
| 10 filters: [{services: ['heart_rate']}], |
| 11 optionalServices: [request_disconnection_service_uuid] |
| 12 })) |
| 13 .then(device => device.gatt.connect()) |
| 14 .then(gattServer => gattServer.getPrimaryService(request_disconnection_servi
ce_uuid)) |
| 15 .then(service => service.getCharacteristic(request_disconnection_characteris
tic_uuid)) |
| 16 .then(requestDisconnection => { |
| 17 requestDisconnection.writeValue(new Uint8Array([0])); |
| 18 requestDisconnection = undefined; |
| 19 return runGarbageCollection(); |
| 20 // Wait 50ms after the GC runs for the disconnection event to come back. |
| 21 // There's nothing to assert other than that only valid memory is used. |
| 22 }).then(() => new Promise(resolve => setTimeout(resolve, 50))); |
| 23 }, 'A device disconnecting after the BluetoothDevice object has been gced ' + |
| 24 'should not access freed memory.'); |
| 25 </script> |
OLD | NEW |