tor-browser

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

disconnect-called-during-error.js (812B)


      1 'use strict';
      2 const test_desc = 'disconnect() called during a FUNCTION_NAME ' +
      3    'call that fails. Reject with NetworkError.';
      4 const expected = new DOMException(
      5    'GATT Server is disconnected. Cannot retrieve services. (Re)connect ' +
      6        'first with `device.gatt.connect`.',
      7    'NetworkError');
      8 let device;
      9 
     10 bluetooth_bidi_test(
     11    () =>
     12        getEmptyHealthThermometerDevice().then(_ => ({device} = _)).then(() => {
     13          let promise = assert_promise_rejects_with_message(
     14              device.gatt.CALLS(
     15                  [getPrimaryService('health_thermometer') |
     16                   getPrimaryServices() |
     17                   getPrimaryServices('health_thermometer')[UUID]]),
     18              expected)
     19          device.gatt.disconnect();
     20          return promise;
     21        }),
     22    test_desc);