https://github.com/web-platform-tests/wpt
Raw File
Tip revision: 32b86b82958c2f48931274b26840a1a4a45a8857 authored by Adam Rice on 20 March 2018, 12:30:43 UTC
Correctly reject in-progress body methods with AbortError
Tip revision: 32b86b8
consumes-user-gesture.https.html
<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
<script src="/bluetooth/resources/bluetooth-helpers.js"></script>
<script>
'use strict';
const test_desc = 'Consumes a user gesture.';
const expected = new DOMException(
    'Must be handling a user gesture to show a permission request.',
    'SecurityError');

bluetooth_test(() => setUpHealthThermometerAndHeartRateDevices()
    .then(() => callWithTrustedClick(() => {
      let first = navigator.bluetooth.requestDevice({
        filters: [{services: ['heart_rate']}]});
      let second = navigator.bluetooth.requestDevice({
        filters: [{services: ['heart_rate']}]});
      return Promise.all([
        first.then(device => assert_equals(
          device.constructor.name, 'BluetoothDevice')),
        assert_promise_rejects_with_message(second,
          expected, 'A request should consume a user gesture')
      ]);
    })), test_desc);
</script>
back to top