OLD | NEW |
1 'use strict'; | 1 'use strict'; |
2 promise_test(t => { | 2 promise_test(t => { |
3 return setBluetoothFakeAdapter('DisconnectingHeartRateAdapter') | 3 return setBluetoothFakeAdapter('DisconnectingHeartRateAdapter') |
4 .then(() => requestDeviceWithKeyDown({ | 4 .then(() => requestDeviceWithKeyDown({ |
5 filters: [{services: ['heart_rate']}], | 5 filters: [{services: ['heart_rate']}], |
6 optionalServices: [request_disconnection_service_uuid] | 6 optionalServices: [request_disconnection_service_uuid] |
7 })) | 7 })) |
8 .then(device => { | 8 .then(device => { |
9 return device.gatt.connect() | 9 return device.gatt.connect() |
10 .then(gattServer => gattServer.getPrimaryService( | 10 .then(gattServer => get_request_disconnection(gattServer)) |
11 request_disconnection_service_uuid)) | 11 .then(requestDisconnection => requestDisconnection()) |
12 .then(service => service.getCharacteristic( | |
13 request_disconnection_characteristic_uuid)) | |
14 .then(requestDisconnection => requestDisconnection.writeValue( | |
15 new Uint8Array([0]))) | |
16 .then(() => assert_promise_rejects_with_message( | 12 .then(() => assert_promise_rejects_with_message( |
17 device.gatt.CALLS([ | 13 device.gatt.CALLS([ |
18 getPrimaryService('heart_rate')| | 14 getPrimaryService('heart_rate')| |
19 getPrimaryServices()| | 15 getPrimaryServices()| |
20 getPrimaryServices('heart_rate')[UUID]]), | 16 getPrimaryServices('heart_rate')[UUID]]), |
21 new DOMException( | 17 new DOMException( |
22 'GATT Server is disconnected. Cannot retrieve services.', | 18 'GATT Server is disconnected. Cannot retrieve services.', |
23 'NetworkError'))); | 19 'NetworkError'))); |
24 }); | 20 }); |
25 }, 'Device disconnects before FUNCTION_NAME. Reject with NetworkError.'); | 21 }, 'Device disconnects before FUNCTION_NAME. Reject with NetworkError.'); |
OLD | NEW |