tor-browser

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

disconnect-called-before.js (954B)


      1 'use strict';
      2 const test_desc = 'disconnect() called before FUNCTION_NAME. ' +
      3    '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    () => getConnectedHealthThermometerDevice({
     12            filters: [{services: ['health_thermometer']}],
     13            optionalServices: ['generic_access']
     14          })
     15              .then(_ => ({device} = _))
     16              .then(() => device.gatt.disconnect())
     17              .then(
     18                  () => assert_promise_rejects_with_message(
     19                      device.gatt.CALLS(
     20                          [getPrimaryService('health_thermometer') |
     21                           getPrimaryServices() |
     22                           getPrimaryServices('health_thermometer')[UUID]]),
     23                      expected)),
     24    test_desc);