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

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

Issue 2476173002: bluetooth: Invalidate characteristics when disconnecting (Closed)
Patch Set: Created 4 years, 1 month 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 unified diff | Download patch
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <script src="../../resources/testharness.js"></script> 2 <script src="../../resources/testharness.js"></script>
3 <script src="../../resources/testharnessreport.js"></script> 3 <script src="../../resources/testharnessreport.js"></script>
4 <script src="../../resources/bluetooth/bluetooth-helpers.js"></script> 4 <script src="../../resources/bluetooth/bluetooth-helpers.js"></script>
5 <script> 5 <script>
6 'use strict'; 6 'use strict';
7 promise_test(t => { 7 promise_test(t => {
8 return setBluetoothFakeAdapter('DisconnectingHeartRateAdapter') 8 return setBluetoothFakeAdapter('DisconnectingHeartRateAdapter')
9 .then(() => requestDeviceWithKeyDown({ 9 .then(() => requestDeviceWithKeyDown({
10 filters: [{services: ['heart_rate']}], 10 filters: [{services: ['heart_rate']}],
11 optionalServices: [request_disconnection_service_uuid] 11 optionalServices: [request_disconnection_service_uuid]
12 })) 12 }))
13 .then(device => { 13 .then(device => {
14 return device.gatt.connect() 14 return device.gatt.connect().then(gattServer => {
15 .then(gattServer => get_request_disconnection(gattServer)) 15 return get_request_disconnection(gattServer)
16 .then(requestDisconnection => { 16 .then(requestDisconnection1 => {
17 // 1. Attach a listener that tries to reconnect. 17 // 1. Attach a listener that tries to reconnect.
18 let reconnection = new Promise(resolve => { 18 let reconnection = new Promise(resolve => {
scheib 2016/11/08 01:44:26 name suggestions? s/reconnection/waitUntilReconne
ortuno 2016/11/08 04:51:47 Done.
19 let wrapper = function(event) { 19 let wrapper = function(event) {
scheib 2016/11/08 01:44:26 s/wrapper/reconnectThenResolve/ ?
ortuno 2016/11/08 04:51:47 Done.
20 device.removeEventListener('gattserverdisconnected', wrapper); 20 device.removeEventListener('gattserverdisconnected', wrapper);
21 device.gatt.connect().then(resolve); 21 device.gatt.connect().then(resolve);
22 }; 22 };
23 device.addEventListener('gattserverdisconnected', wrapper); 23 device.addEventListener('gattserverdisconnected', wrapper);
24 });
25 // 2. Disconnect.
26 requestDisconnection1();
27 return reconnection
28 .then(() => get_request_disconnection(gattServer))
29 .then(requestDisconnection2 => {
30 // Resolves after disconnected event.
31 let disconnected = eventPromise(device, 'gattserverdisconnected' );
32 // 3. Disconnect after reconnecting.
33 requestDisconnection2();
34 return disconnected;
35 });
24 }); 36 });
25 // 2. Disconnect. 37 });
26 requestDisconnection();
27 return reconnection.then(() => {
28 // Resolves after disconnected event.
29 let disconnected = eventPromise(device, 'gattserverdisconnected');
30 // 3. Disconnect after reconnecting.
31 requestDisconnection();
32 return disconnected;
33 });
34 });
35 }); 38 });
36 }, 'A device that reconnects during the gattserverdisconnected event ' + 39 }, 'A device that reconnects during the gattserverdisconnected event ' +
37 'should still receive gattserverdisconnected events after re-connection.'); 40 'should still receive gattserverdisconnected events after re-connection.');
38 </script> 41 </script>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/bluetooth/getCharacteristic/gen-characteristic-device-disconnects-invalidates-objects.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698