tor-browser

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

gen-disconnect-called-during-error.https.window.js (966B)


      1 // META: script=/resources/testdriver.js?feature=bidi
      2 // META: script=/resources/testdriver-vendor.js
      3 // META: script=/common/gc.js
      4 // META: script=/bluetooth/resources/bluetooth-test.js
      5 // META: script=/bluetooth/resources/bluetooth-fake-devices.js
      6 // META: timeout=long
      7 // Generated by
      8 // //bluetooth/bidi/generate.py
      9 'use strict';
     10 const test_desc = 'disconnect() called during a getPrimaryServices ' +
     11    'call that fails. Reject with NetworkError.';
     12 const expected = new DOMException(
     13    'GATT Server is disconnected. Cannot retrieve services. (Re)connect ' +
     14        'first with `device.gatt.connect`.',
     15    'NetworkError');
     16 let device;
     17 
     18 bluetooth_bidi_test(
     19    () =>
     20        getEmptyHealthThermometerDevice().then(_ => ({device} = _)).then(() => {
     21          let promise = assert_promise_rejects_with_message(
     22              device.gatt.getPrimaryServices(), expected)
     23          device.gatt.disconnect();
     24          return promise;
     25        }),
     26    test_desc);