| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <script src="../../resources/testharness.js"></script> | 2 <script src="../../../resources/testharness.js"></script> |
| 3 <script src="../../resources/testharnessreport.js"></script> | 3 <script src="../../../resources/testharnessreport.js"></script> |
| 4 <script src="../../resources/bluetooth/bluetooth-helpers.js"></script> | 4 <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> |
| 5 <script> | 5 <script> |
| 6 'use strict'; | 6 'use strict'; |
| 7 promise_test(t => { | 7 promise_test(t => { |
| 8 return setBluetoothFakeAdapter('DisconnectingHeartRateAdapter') | 8 return setBluetoothFakeAdapter('DisconnectingHeartRateAdapter') |
| 9 .then(() => requestDeviceWithKeyDown({ | 9 .then(() => requestDeviceWithKeyDown({ |
| 10 filters: [{services: ['heart_rate']}], | 10 filters: [{services: ['heart_rate']}], |
| 11 optionalServices: [request_disconnection_service_uuid] | 11 optionalServices: [request_disconnection_service_uuid] |
| 12 })) | 12 })) |
| 13 .then(device => device.gatt.connect()) | 13 .then(device => device.gatt.connect()) |
| 14 .then(gattServer => get_request_disconnection(gattServer)) | 14 .then(gattServer => get_request_disconnection(gattServer)) |
| 15 .then(requestDisconnection => { | 15 .then(requestDisconnection => { |
| 16 requestDisconnection(); | 16 requestDisconnection(); |
| 17 requestDisconnection = undefined; | 17 requestDisconnection = undefined; |
| 18 return runGarbageCollection(); | 18 return runGarbageCollection(); |
| 19 // Wait 50ms after the GC runs for the disconnection event to come back. | 19 // Wait 50ms after the GC runs for the disconnection event to come back. |
| 20 // There's nothing to assert other than that only valid memory is used. | 20 // There's nothing to assert other than that only valid memory is used. |
| 21 }).then(() => new Promise(resolve => setTimeout(resolve, 50))); | 21 }).then(() => new Promise(resolve => setTimeout(resolve, 50))); |
| 22 }, 'A device disconnecting after the BluetoothDevice object has been gced ' + | 22 }, 'A device disconnecting after the BluetoothDevice object has been gced ' + |
| 23 'should not access freed memory.'); | 23 'should not access freed memory.'); |
| 24 </script> | 24 </script> |
| OLD | NEW |