Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(524)

Unified Diff: third_party/WebKit/LayoutTests/bluetooth/script-tests/descriptor-get-same-object.js

Issue 2466223002: Implement WebBluetooth getDescriptor[s] (Closed)
Patch Set: Rebase Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/bluetooth/script-tests/descriptor-get-same-object.js
diff --git a/third_party/WebKit/LayoutTests/bluetooth/script-tests/descriptor-get-same-object.js b/third_party/WebKit/LayoutTests/bluetooth/script-tests/descriptor-get-same-object.js
new file mode 100644
index 0000000000000000000000000000000000000000..757912847d8970d28331f32d986a84413d055f07
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/bluetooth/script-tests/descriptor-get-same-object.js
@@ -0,0 +1,33 @@
+'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'))
+
ortuno 2016/12/02 06:14:50 nit: Remove blank line.
dougt 2016/12/02 18:31:28 Done.
+ .then(characteristic => Promise.all([
+ characteristic.CALLS([
+ getDescriptor(user_description.name)|
+ 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(
+ descriptor => assert_true(base_set.has(descriptor)));
+ }
+ });
+}, 'Calls to FUNCTION_NAME should return the same object.');

Powered by Google App Engine
This is Rietveld 408576698