chromium/third_party/blink/web_tests/wpt_internal/bluetooth/descriptor/readValue/gen-descriptor-is-removed.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 = 'Descriptor gets removed. Reject with InvalidStateError.';
const expected = new DOMException('GATT Descriptor no longer exists.',
    'InvalidStateError');
let descriptor, fake_descriptor, fake_characteristic, fake_peripheral;

bluetooth_test(() => getUserDescriptionDescriptor()
    .then(_ =>
      ({descriptor, fake_descriptor, fake_characteristic, fake_peripheral} = _))
    .then(() => fake_descriptor.remove())
    .then(() => fake_peripheral.simulateGATTServicesChanged())
    .then(() => assert_promise_rejects_with_message(
        descriptor.readValue(),
        expected,
        'Descriptor got removed')),
    test_desc);

</script>