tor-browser

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

simulate_gatt_disconnection.https.html (1219B)


      1 <!DOCTYPE html>
      2 <meta charset="utf-8" />
      3 <meta name="timeout" content="long">
      4 <title>TestDriver bidi.bluetooth.simulate_gatt_disconnection 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        }), handle_prompt_promise]);
     22 
     23        await createGattConnection(device);
     24        assert_true(device.gatt.connected);
     25        await test_driver.bidi.bluetooth.simulate_gatt_disconnection({
     26            address: DEVICE_ADDRESS,
     27        });
     28        assert_false(device.gatt.connected);
     29    }, "simulate a GATT disconnection.");
     30 </script>