summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/bluetooth/requestDevice/canonicalizeFilter/data-prefix-and-mask-size.https.window.js
blob: fa2645093a6adec4e21da973df84f419a45fca8d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// 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 =
    'Manufacturer data mask size must be equal to dataPrefix size.';

bluetooth_test(async (t) => {
  const companyIdentifier = 0x0001;
  const dataPrefix = new Uint8Array([0x01, 0x02, 0x03, 0x04]);
  const mask = new Uint8Array([0xff]);

  await promise_rejects_js(
      t, TypeError,
      requestDeviceWithTrustedClick(
          {filters: [{manufacturerData: [{companyIdentifier, mask}]}]}));
  await promise_rejects_js(
      t, TypeError, requestDeviceWithTrustedClick({
        filters: [{manufacturerData: [{companyIdentifier, dataPrefix, mask}]}]
      }));
}, test_desc);