blob: a1b72e3c2037c813f6ad3d474aba8babc175ee02 [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="/bluetooth/resources/bluetooth-test.js"></script>
<script src="/bluetooth/resources/bluetooth-fake-devices.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>