Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/descriptor-get-same-object.js |
| diff --git a/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/descriptor-get-same-object.js b/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/descriptor-get-same-object.js |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..21675f3e3a03ec75ae20416bb735fed13425aeaf |
| --- /dev/null |
| +++ b/third_party/WebKit/LayoutTests/bluetooth/script-tests/characteristic/descriptor-get-same-object.js |
| @@ -0,0 +1,32 @@ |
| +'use strict'; |
| +promise_test(() => { |
| + return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter') |
| + .then(() => requestDeviceWithKeyDown({ |
| + filters: [{services: ['health_thermometer']}]})) |
| + .then(device => device.gatt.connect()) |
| + .then(gattServer => gattServer.getPrimaryService('health_thermometer')) |
| + .then(service => service.getCharacteristic('measurement_interval')) |
| + .then(characteristic => Promise.all([ |
| + characteristic.CALLS([ |
| + getDescriptor(user_description.name)| |
|
ortuno
2016/12/07 08:05:12
We want to test that all argument variations i.e.
dougt
2016/12/07 19:48:57
Done.
|
| + getDescriptors()| |
| + getDescriptors(user_description.name)[UUID]]), |
| + characteristic.PREVIOUS_CALL])) |
| + .then(descriptors_arrays => { |
| + // Convert to arrays if necessary. |
| + for (let i = 0; i < descriptors_arrays.length; i++) { |
| + descriptors_arrays[i] = [].concat(descriptors_arrays[i]); |
| + } |
| + |
| + for (let i = 1; i < descriptors_arrays.length; i++) { |
| + assert_equals(descriptors_arrays[0].length, |
| + descriptors_arrays[i].length); |
| + } |
| + |
| + let base_set = new Set(descriptors_arrays[0]); |
| + for (let descriptors of descriptors_arrays) { |
| + descriptors.forEach( |
|
ortuno
2016/12/07 08:05:12
Also we are not really checking what happens when
dougt
2016/12/07 19:48:57
We are checking that all calls return identical re
ortuno
2016/12/08 05:42:51
Good thing to add to the test but I was thinking s
|
| + descriptor => assert_true(base_set.has(descriptor))); |
| + } |
| + }); |
| +}, 'Calls to FUNCTION_NAME should return the same object.'); |