| OLD | NEW |
| 1 'use strict'; | 1 'use strict'; |
| 2 promise_test(() => { | 2 promise_test(() => { |
| 3 return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter') | 3 return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter') |
| 4 .then(() => requestDeviceWithKeyDown({ | 4 .then(() => requestDeviceWithKeyDown({ |
| 5 filters: [{services: ['health_thermometer']}], | 5 filters: [{services: ['health_thermometer']}], |
| 6 optionalServices: [request_disconnection_service_uuid]})) | 6 optionalServices: [request_disconnection_service_uuid]})) |
| 7 .then(device => device.gatt.connect()) | 7 .then(device => device.gatt.connect()) |
| 8 .then(gattServer => { | 8 .then(gattServer => { |
| 9 let services; | 9 let services; |
| 10 return gattServer | 10 return gattServer |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 .then(() => gattServer.connect()) | 21 .then(() => gattServer.connect()) |
| 22 .then(() => services); | 22 .then(() => services); |
| 23 }) | 23 }) |
| 24 .then(services => { | 24 .then(services => { |
| 25 let promises = Promise.resolve(); | 25 let promises = Promise.resolve(); |
| 26 for (let service of services) { | 26 for (let service of services) { |
| 27 if (service.uuid == request_disconnection_service_uuid) { | 27 if (service.uuid == request_disconnection_service_uuid) { |
| 28 continue; | 28 continue; |
| 29 } | 29 } |
| 30 let error = new DOMException( | 30 let error = new DOMException( |
| 31 'Service is no longer valid. Remember to retrieve the service ' + | 31 'Service with UUID ' + service.uuid + |
| 32 ' is no longer valid. Remember to retrieve the service ' + |
| 32 'again after reconnecting.', | 33 'again after reconnecting.', |
| 33 'InvalidStateError'); | 34 'InvalidStateError'); |
| 34 promises = promises.then(() => | 35 promises = promises.then(() => |
| 35 assert_promise_rejects_with_message( | 36 assert_promise_rejects_with_message( |
| 36 service.getCharacteristic('measurement_interval'), | 37 service.getCharacteristic('measurement_interval'), |
| 37 error)); | 38 error)); |
| 38 promises = promises.then(() => | 39 promises = promises.then(() => |
| 39 assert_promise_rejects_with_message( | 40 assert_promise_rejects_with_message( |
| 40 service.getCharacteristics(), | 41 service.getCharacteristics(), |
| 41 error)); | 42 error)); |
| 42 promises = promises.then(() => | 43 promises = promises.then(() => |
| 43 assert_promise_rejects_with_message( | 44 assert_promise_rejects_with_message( |
| 44 service.getCharacteristics('measurement_interval'), | 45 service.getCharacteristics('measurement_interval'), |
| 45 error)); | 46 error)); |
| 46 } | 47 } |
| 47 return promises; | 48 return promises; |
| 48 }); | 49 }); |
| 49 }, 'Calls on services after device disconnects and we reconnect. ' + | 50 }, 'Calls on services after device disconnects and we reconnect. ' + |
| 50 'Should reject with InvalidStateError.'); | 51 'Should reject with InvalidStateError.'); |
| OLD | NEW |