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

Side by Side Diff: third_party/WebKit/LayoutTests/bluetooth/requestDevice/restart-scan-includes-previous-device.html

Issue 2026413002: bluetooth: Repopulate chooser with existing devices (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@my-origin
Patch Set: DCHECK chooser Created 4 years, 6 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
« no previous file with comments | « third_party/WebKit/LayoutTests/bluetooth/requestDevice/restart-scan-finds-new-device.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 testRunner.setBluetoothManualChooser(true); 8 testRunner.setBluetoothManualChooser(true);
9 9
10 // Open the chooser, looking for a Heart Rate device. 10 // Open the chooser, looking for a Heart Rate device.
11 let requestDevicePromise = 11 let requestDevicePromise =
12 setBluetoothFakeAdapter('SecondDiscoveryFindsHeartRateAdapter') 12 setBluetoothFakeAdapter('HeartRateAdapter')
13 .then(() => requestDeviceWithKeyDown({ 13 .then(() => requestDeviceWithKeyDown({
14 filters: [{services: ['heart_rate']}] 14 filters: [{services: ['heart_rate']}]
15 })); 15 }));
16 16
17 // The adapter finds nothing, so we just see discovery start and stop. 17 // The existing Heart Rate Device is added to the chooser.
18 return getBluetoothManualChooserEvents(3).then(events => { 18 return getBluetoothManualChooserEvents(4).then(events => {
19 assert_array_equals(events, 19 assert_equals(events.length, 4, events);
20 ['chooser-opened(file://)', 20 assert_equals(events[0], 'chooser-opened(file://)');
21 'discovering', 21 let idsByName = new AddDeviceEventSet();
22 'discovery-idle', 22 idsByName.assert_add_device_event(events[1]);
23 ]); 23 assert_true(idsByName.has('Heart Rate Device'));
24 assert_equals(events[2], 'discovering');
25 assert_equals(events[3], 'discovery-idle');
24 26
25 // On the second discovery, the adapter finds the Heart Rate device. 27 // After restarting a scan the existing device should be added to the
28 // chooser.
26 testRunner.sendBluetoothManualChooserEvent('rescan', ''); 29 testRunner.sendBluetoothManualChooserEvent('rescan', '');
27 return getBluetoothManualChooserEvents(3); 30 return getBluetoothManualChooserEvents(3);
28 }).then(events => { 31 }).then(events => {
32 let idsByName = new AddDeviceEventSet();
29 assert_equals(events.length, 3, events); 33 assert_equals(events.length, 3, events);
30 assert_equals(events[0], 'discovering', 'events[0]'); 34 idsByName.assert_add_device_event(events[0]);
31 let idsByName = new AddDeviceEventSet();
32 idsByName.assert_add_device_event(events[1]);
33 assert_true(idsByName.has('Heart Rate Device')); 35 assert_true(idsByName.has('Heart Rate Device'));
36 assert_equals(events[1], 'discovering', events[0]);
34 assert_equals(events[2], 'discovery-idle'); 37 assert_equals(events[2], 'discovery-idle');
35 38
36 // Select it and let the test complete. 39 // Select it and let the test complete.
37 testRunner.sendBluetoothManualChooserEvent('selected', 40 testRunner.sendBluetoothManualChooserEvent('selected',
38 idsByName.get('Heart Rate Device' )); 41 idsByName.get('Heart Rate Device' ));
39 return requestDevicePromise; 42 return requestDevicePromise;
40 }).then(device => assert_equals(device.name, 'Heart Rate Device')); 43 }).then(device => assert_equals(device.name, 'Heart Rate Device'));
41 }, 'The chooser can restart the BT scan.'); 44 }, 'The chooser shows previously discovered devices.');
42 </script> 45 </script>
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/bluetooth/requestDevice/restart-scan-finds-new-device.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698