| OLD | NEW |
| 1 <!-- Generated by //third_party/WebKit/LayoutTests/bluetooth/generate.py --> | 1 <!-- Generated by //third_party/WebKit/LayoutTests/bluetooth/generate.py --> |
| 2 <!DOCTYPE html> | 2 <!DOCTYPE html> |
| 3 <script src="../../../resources/testharness.js"></script> | 3 <script src="../../../resources/testharness.js"></script> |
| 4 <script src="../../../resources/testharnessreport.js"></script> | 4 <script src="../../../resources/testharnessreport.js"></script> |
| 5 <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> | 5 <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> |
| 6 <script> | 6 <script> |
| 7 'use strict'; | 7 'use strict'; |
| 8 promise_test( | 8 promise_test( |
| 9 () => { | 9 () => { |
| 10 let val = new Uint8Array([1]); |
| 10 return setBluetoothFakeAdapter('FailingGATTOperationsAdapter') | 11 return setBluetoothFakeAdapter('FailingGATTOperationsAdapter') |
| 11 .then( | 12 .then( |
| 12 () => requestDeviceWithKeyDown( | 13 () => requestDeviceWithKeyDown( |
| 13 {filters: [{services: [errorUUID(0xA0)]}]})) | 14 {filters: [{services: [errorUUID(0xA0)]}]})) |
| 14 .then(device => device.gatt.connect()) | 15 .then(device => device.gatt.connect()) |
| 15 .then(gattServer => gattServer.getPrimaryService(errorUUID(0xA0))) | 16 .then(gattServer => gattServer.getPrimaryService(errorUUID(0xA0))) |
| 16 .then( | 17 .then( |
| 17 service => { | 18 service => { |
| 18 service.getCharacteristic(errorUUID(0xA1)) | 19 service.getCharacteristic(errorUUID(0xA1)) |
| 19 .then(characteristic => { | 20 .then(characteristic => { |
| 20 let tests = Promise.resolve(); | 21 let tests = Promise.resolve(); |
| 21 gatt_errors_tests.forEach(testSpec => { | 22 gatt_errors_tests.forEach(testSpec => { |
| 22 tests = | 23 tests = |
| 23 tests | 24 tests |
| 24 .then( | 25 .then( |
| 25 () => characteristic.getDescriptor( | 26 () => characteristic.getDescriptor( |
| 26 testSpec.uuid)) | 27 testSpec.uuid)) |
| 27 .then( | 28 .then( |
| 28 descriptor => | 29 descriptor => |
| 29 assert_promise_rejects_with_message( | 30 assert_promise_rejects_with_message( |
| 30 descriptor.readValue(), | 31 descriptor.readValue(), |
| 31 testSpec.error, | 32 testSpec.error, |
| 32 testSpec.testName)); | 33 testSpec.testName)); |
| 33 }); | 34 }); |
| 34 return tests; | 35 return tests; |
| 35 })})}, | 36 })})}, |
| 36 'readValue fails. Should reject with appropriate error.'); | 37 'readValue fails. Should reject with appropriate error.'); |
| 37 | 38 |
| 38 </script> | 39 </script> |
| OLD | NEW |