blob: 4dca3ed5a571fc636fa57c4ae6287e63a1830d8f [file] [log] [blame]
<!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 = 'A read request succeeds and returns the characteristic\'s ' +
'value.';
const EXPECTED_VALUE = [0, 1, 2];
let characteristic, fake_characteristic;
bluetooth_test(() => getMeasurementIntervalCharacteristic()
.then(_ => ({characteristic, fake_characteristic} = _))
.then(() => fake_characteristic.setNextReadResponse(
GATT_SUCCESS,
EXPECTED_VALUE))
.then(() => characteristic.readValue())
.then(value => assert_array_equals(
new Uint8Array(value.buffer),
EXPECTED_VALUE)),
test_desc);
</script>