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