OLD | NEW |
(Empty) | |
| 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> |
| 7 'use strict'; |
| 8 promise_test(() => { |
| 9 return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter') |
| 10 .then(() => requestDeviceWithKeyDown({ |
| 11 filters: [{services: ['health_thermometer']}]})) |
| 12 .then(device => device.gatt.connect()) |
| 13 .then(gattServer => gattServer.getPrimaryService('health_thermometer')) |
| 14 .then(service => service.getCharacteristic('measurement_interval')) |
| 15 .then(characteristic => Promise.all([ |
| 16 characteristic.getDescriptor(user_description.alias), |
| 17 characteristic.getDescriptor(user_description.alias)])) |
| 18 .then(descriptors_arrays => { |
| 19 |
| 20 assert_true(descriptors_arrays.length > 0) |
| 21 |
| 22 // Convert to arrays if necessary. |
| 23 for (let i = 0; i < descriptors_arrays.length; i++) { |
| 24 descriptors_arrays[i] = [].concat(descriptors_arrays[i]); |
| 25 } |
| 26 |
| 27 for (let i = 1; i < descriptors_arrays.length; i++) { |
| 28 assert_equals(descriptors_arrays[0].length, |
| 29 descriptors_arrays[i].length); |
| 30 } |
| 31 |
| 32 let base_set = new Set(descriptors_arrays[0]); |
| 33 for (let descriptors of descriptors_arrays) { |
| 34 descriptors.forEach( |
| 35 descriptor => assert_true(base_set.has(descriptor))); |
| 36 } |
| 37 }); |
| 38 }, 'Calls to getDescriptor should return the same object.'); |
| 39 |
| 40 </script> |
OLD | NEW |