OLD | NEW |
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 src="../../../resources/bluetooth/web-bluetooth-test.js"></script> |
| 6 <script src="../../../resources/mojo-helpers.js"></script> |
5 <script> | 7 <script> |
6 'use strict'; | 8 'use strict'; |
7 promise_test(() => { | 9 promise_test(() => { |
8 return setBluetoothFakeAdapter('HeartRateAdapter') | 10 return getDiscoveredHealthThermometerDevice() |
9 .then(() => requestDeviceWithKeyDown({ | 11 .then(([device, fake_peripheral]) => { |
10 filters: [{services: ['heart_rate']}]})) | 12 return fake_peripheral |
11 .then(device => { | 13 .setNextGATTConnectionResponse({code: HCI_SUCCESS}) |
12 return Promise.all([device.gatt.connect(), device.gatt.connect()]) | 14 .then(() => device.gatt.connect()) |
13 }).then(gattServers => { | 15 .then(gatt1 => { |
14 assert_equals(gattServers[0], gattServers[1]); | 16 // No second response is necessary because an ATT Bearer |
15 }); | 17 // already exists from the first connection. |
| 18 // See https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothre
motegattserver-connect |
| 19 // step 5.1. |
| 20 return device.gatt.connect().then(gatt2 => [gatt1, gatt2]); |
| 21 }); |
| 22 }) |
| 23 .then(([gatt1, gatt2]) => assert_equals(gatt1, gatt2)); |
16 }, 'Multiple connects should return the same gatt object.'); | 24 }, 'Multiple connects should return the same gatt object.'); |
17 </script> | 25 </script> |
OLD | NEW |