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 => gattServer.getPrimaryService(request_disconnection_servi
ce_uuid)) | 14 .then(gattServer => get_request_disconnection(gattServer)) |
15 .then(service => service.getCharacteristic(request_disconnection_characteris
tic_uuid)) | |
16 .then(requestDisconnection => { | 15 .then(requestDisconnection => { |
17 requestDisconnection.writeValue(new Uint8Array([0])); | 16 requestDisconnection(); |
18 requestDisconnection = undefined; | 17 requestDisconnection = undefined; |
19 return runGarbageCollection(); | 18 return runGarbageCollection(); |
20 // 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. |
21 // 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. |
22 }).then(() => new Promise(resolve => setTimeout(resolve, 50))); | 21 }).then(() => new Promise(resolve => setTimeout(resolve, 50))); |
23 }, 'A device disconnecting after the BluetoothDevice object has been gced ' + | 22 }, 'A device disconnecting after the BluetoothDevice object has been gced ' + |
24 'should not access freed memory.'); | 23 'should not access freed memory.'); |
25 </script> | 24 </script> |
OLD | NEW |