Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(435)

Side by Side Diff: third_party/WebKit/LayoutTests/bluetooth/requestDevice-blacklist.html

Issue 1815483003: bluetooth: Create Mojo equivalent of SetBluetoothMockDataSet (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bluetooth-mojo
Patch Set: MMerge with ToT Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <script src="../resources/testharness.js"></script> 2 <script src="../resources/testharness.js"></script>
3 <script src="../resources/testharness-helpers.js"></script> 3 <script src="../resources/testharness-helpers.js"></script>
4 <script src="../resources/testharnessreport.js"></script> 4 <script src="../resources/testharnessreport.js"></script>
5 <script src="resources/bluetooth-helpers.js"></script> 5 <script src="resources/bluetooth-helpers.js"></script>
6 <script> 6 <script>
7 'use strict'; 7 'use strict';
8 8
9 test(t => { assert_true(window.testRunner instanceof Object); t.done(); }, 9 test(t => { assert_true(window.testRunner instanceof Object); t.done(); },
10 'window.testRunner is required for the following tests.'); 10 'window.testRunner is required for the following tests.');
11 11
12 promise_test(() => { 12 promise_test(() => {
13 testRunner.setBluetoothMockDataSet('BlacklistTestAdapter'); 13 return setBluetoothFakeAdapter('BlacklistTestAdapter')
14 return assert_promise_rejects_with_message( 14 .then(() => assert_promise_rejects_with_message(
15 requestDeviceWithKeyDown( 15 requestDeviceWithKeyDown({
16 {filters: [{services: ['human_interface_device']}]}), 16 filters: [{services: ['human_interface_device']}]}),
17 new DOMException( 17 new DOMException(
18 'requestDevice() called with a filter containing a blacklisted UUID. ' + 18 'requestDevice() called with a filter containing a blacklisted UUID. ' +
19 'https://goo.gl/4NeimX', 19 'https://goo.gl/4NeimX',
20 'SecurityError'), 20 'SecurityError'),
21 'Requesting blacklisted service rejects.'); 21 'Requesting blacklisted service rejects.'));
22 }, 'Reject with SecurityError if requesting a blacklisted service.'); 22 }, 'Reject with SecurityError if requesting a blacklisted service.');
23 23
24 promise_test(() => { 24 promise_test(() => {
25 testRunner.setBluetoothMockDataSet('BlacklistTestAdapter'); 25 return setBluetoothFakeAdapter('BlacklistTestAdapter')
26 return requestDeviceWithKeyDown( 26 .then(() => requestDeviceWithKeyDown({
27 {
28 filters: [{services: [blacklist_test_service_uuid]}], 27 filters: [{services: [blacklist_test_service_uuid]}],
29 optionalServices: ['human_interface_device'] 28 optionalServices: ['human_interface_device']
30 }) 29 }))
31 .then(device => device.gatt.connect()) 30 .then(device => device.gatt.connect())
32 .then(gattServer => { 31 .then(gattServer => {
33 return assert_promise_rejects_with_message( 32 return assert_promise_rejects_with_message(
34 gattServer.getPrimaryService('human_interface_device'), 33 gattServer.getPrimaryService('human_interface_device'),
35 new DOMException( 34 new DOMException(
36 'Origin is not allowed to access the service. Remember to add the ' + 35 'Origin is not allowed to access the service. Remember to add the ' +
37 'service to a filter or to optionalServices in requestDevice().', 36 'service to a filter or to optionalServices in requestDevice().',
38 'SecurityError'), 37 'SecurityError'),
39 'Blacklisted service not accessible.'); 38 'Blacklisted service not accessible.');
40 }); 39 });
41 }, 'Blacklisted UUID in optionalServices is removed and access not granted.'); 40 }, 'Blacklisted UUID in optionalServices is removed and access not granted.');
42 </script> 41 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698