summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/bluetooth/descriptor/readValue/read-succeeds.https.window.js
blob: d81db2f8c0ddb54042a6178677df309a7c6248ef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// META: script=/resources/testdriver.js
// META: script=/resources/testdriver-vendor.js
// META: script=/bluetooth/resources/bluetooth-test.js
// META: script=/bluetooth/resources/bluetooth-fake-devices.js
'use strict';
const test_desc = `A read request succeeds and returns the descriptor's value.`;

bluetooth_test(async () => {
  const {descriptor, fake_descriptor} = await getUserDescriptionDescriptor();

  const EXPECTED_VALUE = [0, 1, 2];
  await fake_descriptor.setNextReadResponse(GATT_SUCCESS, EXPECTED_VALUE);

  const value = await descriptor.readValue();
  assert_array_equals(Array.from(new Uint8Array(value.buffer)), EXPECTED_VALUE);
}, test_desc);