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

Unified Diff: third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptor/gen-descriptor-get-same-object.html

Issue 2466223002: Implement WebBluetooth getDescriptor[s] (Closed)
Patch Set: Implement WebBluetooth getDescriptor[s] Created 3 years, 11 months 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/characteristic/getDescriptor/gen-descriptor-get-same-object.html
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptor/gen-descriptor-get-same-object.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptor/gen-descriptor-get-same-object.html
new file mode 100644
index 0000000000000000000000000000000000000000..2006c95cf92094dd9127032895b293c766c7c836
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptor/gen-descriptor-get-same-object.html
@@ -0,0 +1,40 @@
+<!-- Generated by //third_party/WebKit/LayoutTests/bluetooth/generate.py -->
+<!DOCTYPE html>
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../resources/bluetooth/bluetooth-helpers.js"></script>
+<script>
+'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.getDescriptor(user_description.alias),
+ characteristic.getDescriptor(user_description.alias)]))
+ .then(descriptors_arrays => {
+
+ assert_true(descriptors_arrays.length > 0)
+
+ // 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 getDescriptor should return the same object.');
+
+</script>

Powered by Google App Engine
This is Rietveld 408576698