blob: 8e7655905ae53fde86925324f1161e12b18374e8 [file] [log] [blame]
<!DOCTYPE html>
<script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>
<script src="../../../resources/bluetooth/bluetooth-helpers.js"></script>
<script>
'use strict';
bluetooth_test(() => {
return setBluetoothFakeAdapter('BlocklistTestAdapter')
.then(() => requestDeviceWithKeyDown({
filters: [{services: [blocklist_test_service_uuid]}]}))
.then(device => device.gatt.connect())
.then(gattServer => gattServer.getPrimaryService(
blocklist_test_service_uuid))
.then(service => service.getCharacteristic(
blocklist_exclude_reads_characteristic_uuid))
.then(characteristic => {
return characteristic.writeValue(new Uint8Array(1 /* length */))
.then(() => assert_promise_rejects_with_message(
characteristic.readValue(), new DOMException(
'readValue() called on blocklisted object marked exclude-reads. ' +
'https://goo.gl/4NeimX',
'SecurityError'),
'readValue() should reject.'))
});
}, 'Characteristic with exclude-reads fullfills write and rejects read.');
</script>