chromium/third_party/blink/web_tests/wpt_internal/bluetooth/descriptor/readValue/descriptor-is-blocklisted.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-test.js"></script>
<script src="/bluetooth/resources/bluetooth-fake-devices.js"></script>
<script>
'use strict';
const test_desc = 'An attempt to call readValue on a blocked descriptor must ' +
    'generate a SecurityError';
const expected = new DOMException(
    'readValue() called on blocklisted object marked exclude-reads. ' +
    'https://goo.gl/4NeimX',
    'SecurityError');
let descriptor, fake_descriptor;

// 1. Connect to the device and retrieve the GATT descriptor.
bluetooth_test(() => getBlocklistExcludeReadsDescriptor()
    .then(_ => ({descriptor, fake_descriptor} = _))
    // 2. Attempt to write and read the descriptor.
    .then(() => fake_descriptor.setNextWriteResponse(HCI_SUCCESS))
    .then(() => descriptor.writeValue(new Uint8Array(1 /* length */)))
    .then(() => assert_promise_rejects_with_message(
        descriptor.readValue(),
        expected,
        'readValue() should reject.')),
    test_desc);
</script>