tor-browser

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

simulate_service.https.html (1441B)


      1 <!DOCTYPE html>
      2 <meta charset="utf-8" />
      3 <meta name="timeout" content="long">
      4 <title>TestDriver bidi.bluetooth.simulate_service method</title>
      5 <script src="/resources/testharness.js"></script>
      6 <script src="/resources/testharnessreport.js"></script>
      7 <script src="/resources/testdriver.js?feature=bidi"></script>
      8 <script src="/resources/testdriver-vendor.js"></script>
      9 <script src="resources/bidi-bluetooth-helper.js"></script>
     10 
     11 <script>
     12    promise_setup(async () => {
     13        await test_driver.bidi.bluetooth.request_device_prompt_updated.subscribe();
     14        await test_driver.bidi.bluetooth.gatt_connection_attempted.subscribe();
     15    });
     16 
     17    bluetooth_test(async (t) => {
     18        const handle_prompt_promise = selectFirstDeviceOnDevicePromptUpdated();
     19        const [device] = await Promise.all([requestDeviceWithTrustedClick({
     20            acceptAllDevices: true,
     21            optionalServices: [HEART_RATE_SERVICE_UUID]
     22        }), handle_prompt_promise]);
     23 
     24        await createGattConnection(device);
     25        await test_driver.bidi.bluetooth.simulate_service({
     26            address: DEVICE_ADDRESS,
     27            uuid: HEART_RATE_SERVICE_UUID,
     28            type: 'add',
     29        });
     30        services = await device.gatt.getPrimaryServices();
     31        assert_equals(
     32            JSON.stringify(services.map(service => service.uuid)),
     33            JSON.stringify([HEART_RATE_SERVICE_UUID])
     34        );
     35    }, "simulate a GATT service.");
     36 </script>