| OLD | NEW |
| (Empty) |
| 1 <!DOCTYPE html> | |
| 2 <script src="../resources/testharness.js"></script> | |
| 3 <script src="../resources/testharness-helpers.js"></script> | |
| 4 <script src="../resources/testharnessreport.js"></script> | |
| 5 <script src="../resources/bluetooth/bluetooth-helpers.js"></script> | |
| 6 <script> | |
| 7 'use strict'; | |
| 8 | |
| 9 test(t => { assert_true(window.testRunner instanceof Object); t.done(); }, | |
| 10 'window.testRunner is required for the following tests.'); | |
| 11 | |
| 12 promise_test(() => { | |
| 13 return setBluetoothFakeAdapter('BlacklistTestAdapter') | |
| 14 .then(() => assert_promise_rejects_with_message( | |
| 15 requestDeviceWithKeyDown({ | |
| 16 filters: [{services: ['human_interface_device']}]}), | |
| 17 new DOMException( | |
| 18 'requestDevice() called with a filter containing a blacklisted UUID. ' + | |
| 19 'https://goo.gl/4NeimX', | |
| 20 'SecurityError'), | |
| 21 'Requesting blacklisted service rejects.')); | |
| 22 }, 'Reject with SecurityError if requesting a blacklisted service.'); | |
| 23 | |
| 24 promise_test(() => { | |
| 25 return setBluetoothFakeAdapter('BlacklistTestAdapter') | |
| 26 .then(() => requestDeviceWithKeyDown({ | |
| 27 filters: [{services: [blacklist_test_service_uuid]}], | |
| 28 optionalServices: ['human_interface_device'] | |
| 29 })) | |
| 30 .then(device => device.gatt.connect()) | |
| 31 .then(gattServer => { | |
| 32 return assert_promise_rejects_with_message( | |
| 33 gattServer.getPrimaryService('human_interface_device'), | |
| 34 new DOMException( | |
| 35 'Origin is not allowed to access the service. Remember to add the ' + | |
| 36 'service to a filter or to optionalServices in requestDevice().', | |
| 37 'SecurityError'), | |
| 38 'Blacklisted service not accessible.'); | |
| 39 }); | |
| 40 }, 'Blacklisted UUID in optionalServices is removed and access not granted.'); | |
| 41 </script> | |
| OLD | NEW |