chromium/third_party/blink/web_tests/wpt_internal/bluetooth/server/getPrimaryServices/gen-delayed-discovery-no-permission-present-service-with-uuid.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';
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.getPrimaryServices(generic_access.alias), expected),
      assert_promise_rejects_with_message(
        gatt.getPrimaryServices(generic_access.name), expected),
      assert_promise_rejects_with_message(
        gatt.getPrimaryServices(generic_access.uuid), expected)]));
}, 'Delayed service discovery, request for present service without ' +
   'permission. Reject with SecurityError.');

</script>