Index: third_party/WebKit/LayoutTests/bluetooth/getDescriptor/device-disconnects-during.html |
diff --git a/third_party/WebKit/LayoutTests/bluetooth/getDescriptor/device-disconnects-during.html b/third_party/WebKit/LayoutTests/bluetooth/getDescriptor/device-disconnects-during.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..bf6f06c833ae6e0a4bb78b4afdfc72b15bd4e92d |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/bluetooth/getDescriptor/device-disconnects-during.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(() => { |
+ return setBluetoothFakeAdapter('DisconnectingHeartRateAdapter') |
+ .then(() => requestDeviceWithKeyDown({ |
+ filters: [{services: ['heart_rate']}], |
+ optionalServices: [request_disconnection_service_uuid] |
+ })) |
+ .then(device => device.gatt.connect()) |
+ .then(gattServer => { |
+ return gattServer.getPrimaryService('heart_rate') |
+ .then(service => service.getCharacteristic('heart_rate_measurement')) |
+ .then(characteristic => { |
+ get_request_disconnection(gattServer) |
+ .then(requestDisconnection => { |
+ requestDisconnection() |
+ return assert_promise_rejects_with_message( |
+ characteristic.getDescriptor(user_description.alias), |
+ new DOMException( |
+ 'GATT Server is disconnected. Cannot retrieve characteristics.', |
+ 'NetworkError')) |
+ }) |
+ }) |
+ }) |
+}, 'Device disconnects before getDescriptor. Reject with NetworkError'); |
+</script> |