| OLD | NEW |
| 1 <!-- Generated by //third_party/WebKit/LayoutTests/bluetooth/generate.py --> |
| 2 <!DOCTYPE html> |
| 3 <script src="../../../resources/testharness.js"></script> |
| 4 <script src="../../../resources/testharnessreport.js"></script> |
| 5 <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> |
| 6 <script> |
| 1 promise_test( | 7 promise_test( |
| 2 () => { | 8 () => { |
| 3 let val = new Uint8Array([1]); | 9 let val = new Uint8Array([1]); |
| 4 return setBluetoothFakeAdapter( | 10 return setBluetoothFakeAdapter( |
| 5 'DisconnectingDuringFailureGATTOperationAdapter') | 11 'DisconnectingDuringFailureGATTOperationAdapter') |
| 6 .then( | 12 .then( |
| 7 () => requestDeviceWithKeyDown( | 13 () => requestDeviceWithKeyDown( |
| 8 {filters: [{services: ['health_thermometer']}]})) | 14 {filters: [{services: ['health_thermometer']}]})) |
| 9 .then(device => device.gatt.connect()) | 15 .then(device => device.gatt.connect()) |
| 10 .then(gatt => gatt.getPrimaryService('health_thermometer')) | 16 .then(gatt => gatt.getPrimaryService('health_thermometer')) |
| 11 .then(service => service.getCharacteristic('measurement_interval')) | 17 .then(service => service.getCharacteristic('measurement_interval')) |
| 12 .then( | 18 .then( |
| 13 characteristic => | 19 characteristic => |
| 14 characteristic.getDescriptor(user_description.name)) | 20 characteristic.getDescriptor(user_description.name)) |
| 15 .then(descriptor => { | 21 .then(descriptor => { |
| 16 let disconnected = eventPromise( | 22 let disconnected = eventPromise( |
| 17 descriptor.characteristic.service.device, | 23 descriptor.characteristic.service.device, |
| 18 'gattserverdisconnected'); | 24 'gattserverdisconnected'); |
| 19 let promise = assert_promise_rejects_with_message( | 25 let promise = assert_promise_rejects_with_message( |
| 20 descriptor.CALLS([readValue()]), | 26 descriptor.writeValue(val), |
| 21 new DOMException( | 27 new DOMException( |
| 22 'GATT Server disconnected while performing a GATT operation.
', | 28 'GATT Server disconnected while performing a GATT operation.
', |
| 23 'NetworkError')); | 29 'NetworkError')); |
| 24 return disconnected | 30 return disconnected |
| 25 .then( | 31 .then( |
| 26 () => | 32 () => |
| 27 descriptor.characteristic.service.device.gatt.connect()) | 33 descriptor.characteristic.service.device.gatt.connect()) |
| 28 .then(() => promise); | 34 .then(() => promise); |
| 29 }); | 35 }); |
| 30 }, | 36 }, |
| 31 'Device reconnects during a FUNCTION_NAME call that fails. Reject ' + | 37 'Device reconnects during a writeValue call that fails. Reject ' + |
| 32 'with NetworkError.'); | 38 'with NetworkError.'); |
| 39 |
| 40 </script> |
| OLD | NEW |