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 |
| 16 .then(characteristic => Promise.all([ |
| 17 characteristic.getDescriptor(user_description.name), |
| 18 characteristic.getDescriptor(user_description.name)])) |
| 19 .then(descriptors_arrays => { |
| 20 // Convert to arrays if necessary. |
| 21 for (let i = 0; i < descriptors_arrays.length; i++) { |
| 22 descriptors_arrays[i] = [].concat(descriptors_arrays[i]); |
| 23 } |
| 24 |
| 25 for (let i = 1; i < descriptors_arrays.length; i++) { |
| 26 assert_equals(descriptors_arrays[0].length, |
| 27 descriptors_arrays[i].length); |
| 28 } |
| 29 |
| 30 let base_set = new Set(descriptors_arrays[0]); |
| 31 for (let descriptors of descriptors_arrays) { |
| 32 descriptors.forEach( |
| 33 descriptor => assert_true(base_set.has(descriptor))); |
| 34 } |
| 35 }); |
| 36 }, 'Calls to getDescriptor should return the same object.'); |
| 37 |
| 38 </script> |
OLD | NEW |