| OLD | NEW |
| (Empty) | |
| 1 'use strict'; |
| 2 promise_test(() => { |
| 3 return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter') |
| 4 .then(() => requestDeviceWithKeyDown({ |
| 5 filters: [{services: ['health_thermometer']}], |
| 6 optionalServices: [request_disconnection_service_uuid]})) |
| 7 .then(device => device.gatt.connect()) |
| 8 .then(gattServer => { |
| 9 let services; |
| 10 return gattServer |
| 11 .CALLS([ |
| 12 getPrimaryService('health_thermometer')| |
| 13 getPrimaryServices()| |
| 14 getPrimaryServices('health_thermometer')[UUID]]) |
| 15 .then(s => { |
| 16 // Convert to array if necessary. |
| 17 services = [].concat(s); |
| 18 return get_request_disconnection(gattServer); |
| 19 }) |
| 20 .then(requestDisconnection => requestDisconnection()) |
| 21 .then(() => gattServer.connect()) |
| 22 .then(() => services); |
| 23 }) |
| 24 .then(services => { |
| 25 let promises = Promise.resolve(); |
| 26 for (let service of services) { |
| 27 if (service.uuid == request_disconnection_service_uuid) { |
| 28 continue; |
| 29 } |
| 30 let error = new DOMException( |
| 31 'Service is no longer valid. Remember to retrieve the service ' + |
| 32 'again after reconnecting.', |
| 33 'InvalidStateError'); |
| 34 promises = promises.then(() => |
| 35 assert_promise_rejects_with_message( |
| 36 service.getCharacteristic('measurement_interval'), |
| 37 error)); |
| 38 promises = promises.then(() => |
| 39 assert_promise_rejects_with_message( |
| 40 service.getCharacteristics(), |
| 41 error)); |
| 42 promises = promises.then(() => |
| 43 assert_promise_rejects_with_message( |
| 44 service.getCharacteristics('measurement_interval'), |
| 45 error)); |
| 46 } |
| 47 return promises; |
| 48 }); |
| 49 }, 'Calls on services after device disconnects and we reconnect. ' + |
| 50 'Should reject with InvalidStateError.'); |
| OLD | NEW |