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

Side by Side Diff: third_party/WebKit/LayoutTests/bluetooth/requestDevice/chooser/consecutive-calls.html

Issue 2217573002: bluetooth: Only add new devices, connected devices and devices that changed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bluetooth-add-or-update
Patch Set: Fix typo Created 4 years, 4 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/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
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>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698