Index: third_party/WebKit/LayoutTests/bluetooth/requestDevice/stop-discovery-by-adapter-discovering-changed.html |
diff --git a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/stop-discovery-by-adapter-discovering-changed.html b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/stop-discovery-by-adapter-discovering-changed.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..c4d6dfec8b81473c79f8cfa9955b6e0b38214643 |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/stop-discovery-by-adapter-discovering-changed.html |
@@ -0,0 +1,30 @@ |
+<!DOCTYPE html> |
+<script src="../../resources/testharness.js"></script> |
+<script src="../../resources/testharnessreport.js"></script> |
+<script src="../../resources/bluetooth/bluetooth-helpers.js"></script> |
+<script> |
+'use strict'; |
+promise_test(() => { |
+ testRunner.setBluetoothManualChooser(true); |
+ let requestDevicePromise = |
+ setBluetoothFakeAdapter('SecondDiscoveryFindsHeartRateAdapter') |
+ .then(() => requestDeviceWithKeyDown({ |
+ filters: [{services: ['heart_rate']}]})); |
+ return getBluetoothManualChooserEvents(2) |
+ .then(events => { |
+ assert_array_equals(events, |
+ ['chooser-opened(file://)', |
+ 'discovering'], |
+ events); |
+ testRunner.sendBluetoothManualChooserEvent('adapter-discovering-changed', ''); |
+ return getBluetoothManualChooserEvents(1); |
+ }).then(events => { |
+ assert_equals(events[0], 'discovery-idle'); |
+ return assert_promise_rejects_with_message( |
+ requestDevicePromise, |
+ new DOMException('User cancelled the requestDevice() chooser.', |
+ 'NotFoundError'), |
+ 'The adapter failed to start a discovery session.'); |
+ }); |
+}, 'Discovery session fails to start.'); |
+</script> |