blob: d327924e6e3efd7cd0e23c79cd0a30c233abdcca [file] [log] [blame]
<!-- 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="../../../external/wpt/bluetooth/resources/bluetooth-helpers.js"></script>
<script>
'use strict';
let expected = new DOMException('Origin is not allowed to access the ' +
'service. Tip: Add the service UUID to ' +
'\'optionalServices\' in requestDevice() ' +
'options. https://goo.gl/HxfxSQ',
'SecurityError');
bluetooth_test(() => {
return setBluetoothFakeAdapter('DelayedServicesDiscoveryAdapter')
.then(() => requestDeviceWithTrustedClick({
filters: [{services: ['heart_rate']}]
}))
.then(device => device.gatt.connect())
.then(gatt => Promise.all([
assert_promise_rejects_with_message(
gatt.getPrimaryService(generic_access.alias), expected),
assert_promise_rejects_with_message(
gatt.getPrimaryService(generic_access.name), expected),
assert_promise_rejects_with_message(
gatt.getPrimaryService(generic_access.uuid), expected)]));
}, 'Delayed service discovery, request for present service without ' +
'permission. Reject with SecurityError.');
</script>