Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/bluetooth/server/connect/same-gatt-server-both-receive-disconnect-event.html |
| diff --git a/third_party/WebKit/LayoutTests/bluetooth/server/connect/same-gatt-server-both-receive-disconnect-event.html b/third_party/WebKit/LayoutTests/bluetooth/server/connect/same-gatt-server-both-receive-disconnect-event.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..19978c551af17992935984e82a4c2270e2a264e3 |
| --- /dev/null |
| +++ b/third_party/WebKit/LayoutTests/bluetooth/server/connect/same-gatt-server-both-receive-disconnect-event.html |
| @@ -0,0 +1,26 @@ |
| +<!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'; |
| +var device; |
| +promise_test(() => { |
| + return setBluetoothFakeAdapter('DisconnectingHeartRateAdapter') |
|
ortuno
2017/03/01 04:52:06
DisconnectingHealthThermometer please.
juncai
2017/03/02 03:23:46
Done.
|
| + .then(() => requestDeviceWithKeyDown({ |
| + filters: [{services: ['heart_rate']}], |
| + optionalServices: [request_disconnection_service_uuid] |
| + })) |
| + .then(requestedDevice => { |
| + device = requestedDevice; |
| + return Promise.all([device.gatt.connect(), device.gatt.connect()]); |
| + }).then(gattServers => { |
| + return Promise.all([get_request_disconnection(gattServers[0]), get_request_disconnection(gattServers[1])]); |
|
ortuno
2017/03/01 04:52:06
No need to get two requests or the bubbles check:
juncai
2017/03/02 03:23:45
Done.
|
| + }).then(requestDisconnection => { |
| + // This promise hangs unless gattserverdisconnected is fired. |
| + let disconnected = eventPromise(device, 'gattserverdisconnected'); |
| + return Promise.all([requestDisconnection[0](), requestDisconnection[1](), |
| + disconnected]); |
| + }).then(([, , disconnected]) => assert_true(disconnected.bubbles)); |
| +}, 'Same gatt server should both receive disconnect event.'); |
|
ortuno
2017/03/01 04:52:05
A device disconnecting after two consecutive conne
juncai
2017/03/02 03:23:44
Done.
|
| +</script> |