tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

characteristic-is-removed.js (1317B)


      1 'use strict';
      2 const test_desc = 'Characteristic gets removed. Reject with InvalidStateError.';
      3 const expected = new DOMException(
      4    'GATT Characteristic no longer exists.', 'InvalidStateError');
      5 let fake_peripheral, characteristic, fake_characteristic;
      6 
      7 bluetooth_bidi_test(
      8    () =>
      9        getMeasurementIntervalCharacteristic()
     10            .then(
     11                _ => (
     12                    {fake_peripheral, characteristic, fake_characteristic} = _))
     13            .then(() => characteristic.getDescriptor(user_description.name))
     14            .then(
     15                () => null,
     16                (e) => assert_unreached('Caught error unexpectedly.', e))
     17            .then(() => fake_characteristic.remove())
     18            .then(
     19                () => assert_promise_rejects_with_message(
     20                    characteristic.CALLS(
     21                        [getDescriptor(user_description.name) |
     22                         getDescriptors(user_description.name)[UUID] |
     23                         getDescriptors() | readValue() |
     24                         writeValue(new Uint8Array(1)) |
     25                         writeValueWithResponse(new Uint8Array(1)) |
     26                         writeValueWithoutResponse(new Uint8Array(1)) |
     27                         startNotifications()]),
     28                    expected)),
     29    test_desc);