Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(55)

Unified Diff: third_party/WebKit/LayoutTests/bluetooth/gattserverdisconnected-event/reconnect-during-disconnected-event.html

Issue 2072423002: bluetooth: Remove device before dispatching event (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@my-origin
Patch Set: Moar fixes Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/TestExpectations ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/bluetooth/gattserverdisconnected-event/reconnect-during-disconnected-event.html
diff --git a/third_party/WebKit/LayoutTests/bluetooth/gattserverdisconnected-event/reconnect-during-disconnected-event.html b/third_party/WebKit/LayoutTests/bluetooth/gattserverdisconnected-event/reconnect-during-disconnected-event.html
new file mode 100644
index 0000000000000000000000000000000000000000..6eb12f4a946ab81bebaf4d197addc56d2a177681
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/bluetooth/gattserverdisconnected-event/reconnect-during-disconnected-event.html
@@ -0,0 +1,39 @@
+<!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(t => {
+ return setBluetoothFakeAdapter('DisconnectingHeartRateAdapter')
+ .then(() => requestDeviceWithKeyDown({
+ filters: [{services: ['heart_rate']}],
+ optionalServices: [request_disconnection_service_uuid]
+ }))
+ .then(device => {
+ return device.gatt.connect()
+ .then(gattServer => gattServer.getPrimaryService(request_disconnection_service_uuid))
+ .then(service => service.getCharacteristic(request_disconnection_characteristic_uuid))
+ .then(requestDisconnection => {
+ // 1. Attach a listener that tries to reconnect.
+ let reconnection = new Promise(resolve => {
+ let wrapper = function(event) {
+ device.removeEventListener('gattserverdisconnected', wrapper);
+ device.gatt.connect().then(resolve);
+ };
+ device.addEventListener('gattserverdisconnected', wrapper);
+ });
+ // 2. Disconnect.
+ requestDisconnection.writeValue(new Uint8Array([0]));
+ return reconnection.then(() => {
+ // Resolves after disconnected event.
+ let disconnected = eventPromise(device, 'gattserverdisconnected');
+ // 3. Disconnect after reconnecting.
+ requestDisconnection.writeValue(new Uint8Array([0]));
+ return disconnected;
+ });
+ });
+ });
+}, 'A device that reconnects during the gattserverdisconnected event ' +
+ 'should still receive gattserverdisconnected events after re-connection.');
+</script>
« no previous file with comments | « third_party/WebKit/LayoutTests/TestExpectations ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698