Index: third_party/WebKit/LayoutTests/bluetooth/requestDevice.html |
diff --git a/third_party/WebKit/LayoutTests/bluetooth/requestDevice.html b/third_party/WebKit/LayoutTests/bluetooth/requestDevice.html |
index efd10a41f8c48974a0c71fe64f36ebe6332b0641..525d6ab3b83812578788d2e87a4cca0f88cd3d3d 100644 |
--- a/third_party/WebKit/LayoutTests/bluetooth/requestDevice.html |
+++ b/third_party/WebKit/LayoutTests/bluetooth/requestDevice.html |
@@ -191,4 +191,39 @@ promise_test(() => { |
filters: [{services: ['generic_access', 'battery_service']}] |
}), 'NotFoundError'); |
}, 'Too-strict filters do prevent matching.'); |
+ |
+promise_test(() => { |
+ testRunner.setBluetoothMockDataSet('SecondDiscoveryFindsHeartRateAdapter'); |
+ testRunner.setBluetoothManualChooser(); |
+ |
+ // Open the chooser, looking for a Heart Rate device. |
+ let requestDevicePromise = requestDeviceWithKeyDown({ |
+ filters: [{services: ['heart_rate']}] |
+ }); |
+ |
+ // The adapter finds nothing, so we just see discovery start and stop. |
+ getBluetoothManualChooserEvents(3).then(events => { |
+ assert_array_equals(events, |
+ ['chooser-opened(file:///)', |
+ 'discovering', |
+ 'discovery-idle', |
+ ]); |
+ |
+ // On the second discovery, the adapter finds the Heart Rate device. |
+ testRunner.sendBluetoothManualChooserEvent('rescan', ''); |
+ return getBluetoothManualChooserEvents(3); |
+ }).then(events => { |
+ assert_equals(events.length, 3, events); |
+ assert_equals(events[0], 'discovering', 'events[0]'); |
+ let idsByName = new AddDeviceEventSet(); |
+ idsByName.assert_add_device_event(events[1]); |
+ assert_true(idsByName.has('Heart Rate Device')); |
+ assert_equals(events[2], 'discovery-idle'); |
+ |
+ // Select it and let the test complete. |
+ testRunner.sendBluetoothManualChooserEvent('selected', |
+ idsByName.get('Heart Rate Device')); |
+ return requestDevicePromise; |
+ }).then(device => assert_equals(device.name, 'Heart Rate Device')); |
+}, 'The chooser can restart the BT scan.'); |
</script> |