tor-browser

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

gen-invalid-service-name.https.window.js (1164B)


      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 = 'Wrong Service name. Reject with TypeError.';
     11 const expected = new DOMException(
     12    'Failed to execute \'getPrimaryService\' on ' +
     13        '\'BluetoothRemoteGATTServer\': Invalid Service name: ' +
     14        '\'wrong_name\'. It must be a valid UUID alias (e.g. 0x1234), ' +
     15        'UUID (lowercase hex characters e.g. ' +
     16        '\'00001234-0000-1000-8000-00805f9b34fb\'), ' +
     17        'or recognized standard name from ' +
     18        'https://www.bluetooth.com/specifications/gatt/services' +
     19        ' e.g. \'alert_notification\'.',
     20    'TypeError');
     21 
     22 bluetooth_bidi_test(
     23    () => getConnectedHealthThermometerDevice().then(
     24        ({device}) => assert_promise_rejects_with_message(
     25            device.gatt.getPrimaryService('wrong_name'), expected,
     26            'Wrong Service name passed.')),
     27    test_desc);