summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/bluetooth/device/watchAdvertisements/abort-before-watchAdvertisements.https.window.js
blob: e1ac1fb136902244055e88f859d9d536bc58951c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// 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 = 'watchAdvertisements() rejects if passed an aborted signal.';

bluetooth_test(async (t) => {
  let {device} = await getDiscoveredHealthThermometerDevice();
  let abortController = new AbortController();
  abortController.abort();

  await promise_rejects_dom(
      t, 'AbortError',
      device.watchAdvertisements({signal: abortController.signal}));
  assert_false(device.watchingAdvertisements);
}, test_desc);