OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <script src="../../resources/testharness.js"></script> | 2 <script src="../../../resources/testharness.js"></script> |
3 <script src="../../resources/testharnessreport.js"></script> | 3 <script src="../../../resources/testharnessreport.js"></script> |
4 <script src="../../resources/bluetooth/bluetooth-helpers.js"></script> | 4 <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> |
5 <script> | 5 <script> |
6 'use strict'; | 6 'use strict'; |
7 promise_test(() => { | 7 promise_test(() => { |
8 function assert_expected_events(events) { | 8 function assert_expected_events(events) { |
9 assert_equals(events.length, 4); | 9 assert_equals(events.length, 4); |
10 assert_equals(events[0], 'chooser-opened(file://)'); | 10 assert_equals(events[0], 'chooser-opened(file://)'); |
| 11 assert_equals(events[1], 'discovering'); |
11 let idsByName = new AddDeviceEventSet(); | 12 let idsByName = new AddDeviceEventSet(); |
12 idsByName.assert_add_device_event(events[1]); | 13 idsByName.assert_add_device_event(events[2]); |
13 assert_true(idsByName.has('Heart Rate Device')); | 14 assert_true(idsByName.has('Heart Rate Device')); |
14 assert_equals(events[2], 'discovering'); | |
15 assert_equals(events[3], 'discovery-idle'); | 15 assert_equals(events[3], 'discovery-idle'); |
16 return idsByName; | 16 return idsByName; |
17 }; | 17 }; |
18 | 18 |
19 testRunner.setBluetoothManualChooser(true); | 19 testRunner.setBluetoothManualChooser(true); |
20 // Open a chooser. | 20 // Open a chooser. |
21 let firstRequestDevicePromise = setBluetoothFakeAdapter('HeartRateAdapter') | 21 let firstRequestDevicePromise = setBluetoothFakeAdapter('HeartRateAdapter') |
22 .then(() => assert_promise_rejects_with_message( | 22 .then(() => assert_promise_rejects_with_message( |
23 requestDeviceWithKeyDown({filters: [{services: ['heart_rate']}]}), | 23 requestDeviceWithKeyDown({filters: [{services: ['heart_rate']}]}), |
24 new DOMException('User cancelled the requestDevice() chooser.', | 24 new DOMException('User cancelled the requestDevice() chooser.', |
(...skipping 13 matching lines...) Expand all Loading... |
38 testRunner.sendBluetoothManualChooserEvent( | 38 testRunner.sendBluetoothManualChooserEvent( |
39 'selected', idsByName.get('Heart Rate Device')); | 39 'selected', idsByName.get('Heart Rate Device')); |
40 return Promise.all([ | 40 return Promise.all([ |
41 firstRequestDevicePromise, | 41 firstRequestDevicePromise, |
42 secondRequestDevicePromise]); | 42 secondRequestDevicePromise]); |
43 }); | 43 }); |
44 }); | 44 }); |
45 }, 'A second call to requestDevice with the chooser opened will close the ' + | 45 }, 'A second call to requestDevice with the chooser opened will close the ' + |
46 'previous chooser.'); | 46 'previous chooser.'); |
47 </script> | 47 </script> |
OLD | NEW |