Index: third_party/WebKit/LayoutTests/resources/bluetooth/bluetooth-helpers.js |
diff --git a/third_party/WebKit/LayoutTests/resources/bluetooth/bluetooth-helpers.js b/third_party/WebKit/LayoutTests/resources/bluetooth/bluetooth-helpers.js |
index 97919a8691d3bcc0d269fe6a4832f239646c09ce..26519e6913620a19fb30ddf198df9024857299b1 100644 |
--- a/third_party/WebKit/LayoutTests/resources/bluetooth/bluetooth-helpers.js |
+++ b/third_party/WebKit/LayoutTests/resources/bluetooth/bluetooth-helpers.js |
@@ -1,5 +1,11 @@ |
'use strict'; |
+// HCI Error Codes. Used for simulateGATT[Dis]ConnectionResponse. |
+// For a complete list of possible error codes see |
+// BT 4.2 Vol 2 Part D 1.3 List Of Error Codes. |
+const HCI_SUCCESS = 0x0000; |
+const HCI_CONNECTION_TIMEOUT = 0x0008; |
+ |
// Bluetooth UUID constants: |
// Services: |
var blocklist_test_service_uuid = "611c954a-263b-4f4a-aab6-01ddb953f985"; |
@@ -447,3 +453,19 @@ function setUpHealthThermometerAndHeartRateDevices() { |
knownServiceUUIDs: ['generic_access', 'heart_rate'], |
})])); |
} |
+ |
+function getConnectedHealthThermometerDevice( |
ortuno
2017/05/12 00:53:44
Forgot to mention this. This changes our testing p
|
+ options = {filters: [{services: ['health_thermometer']}]}) { |
+ return setUpPreconnectedDevice({ |
+ address: '09:09:09:09:09:09', |
+ name: 'Health Thermometer', |
+ knownServiceUUIDs: ['generic_access', 'health_thermometer'], |
+ }) |
+ .then(fake_peripheral => { |
+ return requestDeviceWithKeyDown(options) |
scheib
2017/05/12 05:43:56
options parameter needed here ... because sometime
ortuno
2017/05/15 07:01:31
Yeah, there are quite a few tests that check getPr
|
+ .then(device => Promise.all([ |
+ device.gatt.connect(), |
+ fake_peripheral.simulateGATTConnectionResponse({code: HCI_SUCCESS})])) |
+ .then(([gatt]) => [gatt.device, fake_peripheral]); |
+ }); |
+} |