chromium/third_party/blink/web_tests/wpt_internal/bluetooth/characteristic/getDescriptor/gen-descriptor-blocklisted.https.html

<!-- Generated by //third_party/blink/web_tests/bluetooth/generate.py -->
<!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-test.js"></script>
<script src="/bluetooth/resources/bluetooth-fake-devices.js"></script>
<script src="/common/gc.js"></script>
<script>
'use strict';
const test_desc = 'Make sure that getDescriptor can not access blocklisted ' +
    'descriptors.';
const expected = new DOMException(
    'getDescriptor(s) called with blocklisted UUID. https://goo.gl/4NeimX',
    'SecurityError');

// 1. Connect to the device and retrieve the GATT characteristic.
bluetooth_test(() => getBlocklistExcludeReadsCharacteristic()
    // 2. Attempt to call getDescriptor with a blocklisted UUID.
    .then(({characteristic}) => assert_promise_rejects_with_message(
        // Using UUIDs instead of names to avoid making a name<>uuid mapping.
        characteristic.getDescriptor('bad2ddcf-60db-45cd-bef9-fd72b153cf7c'),
        expected,
        'getDescriptor should reject.')),
    test_desc);

</script>