Index: third_party/WebKit/LayoutTests/bluetooth/getDescriptor/device-disconnects-before.html |
diff --git a/third_party/WebKit/LayoutTests/bluetooth/getDescriptor/device-disconnects-before.html b/third_party/WebKit/LayoutTests/bluetooth/getDescriptor/device-disconnects-before.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..c7fb3e3e42bd645f662e8b630f8b9d38d4f74ae2 |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/bluetooth/getDescriptor/device-disconnects-before.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()) |
+ .then(() => 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> |