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/resources/bluetooth/bluetooth-helpers.js

Issue 2867713008: bluetooth: Implement known_service_uuids for Peripherals. (Closed)
Patch Set: Fix test Created 3 years, 7 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
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 08901e571c71394ea2dcdd3f8f1e8e23283ad9cb..60cd8ae5619bf403441a7d903737571ecb0e2ee1 100644
--- a/third_party/WebKit/LayoutTests/resources/bluetooth/bluetooth-helpers.js
+++ b/third_party/WebKit/LayoutTests/resources/bluetooth/bluetooth-helpers.js
@@ -12,6 +12,10 @@ var request_disconnection_characteristic_uuid =
// Descriptors:
var blocklist_test_descriptor_uuid = "bad2ddcf-60db-45cd-bef9-fd72b153cf7c";
+// Addresses for peripherals.
+const ADDRESS1 = '00:00:00:00:00:00';
scheib 2017/05/09 23:33:54 Will any code other than setup methods use these v
ortuno 2017/05/10 06:32:50 We might when we add advertisements but I'm OK wit
scheib 2017/05/10 17:51:14 OK, yeah we could just use a random number literal
+const ADDRESS2 = '11:11:11:11:11:11';
+
// Sometimes we need to test that using either the name, alias, or UUID
// produces the same result. The following objects help us do that.
var generic_access = {
@@ -423,10 +427,25 @@ function generateRequestDeviceArgsWithServices(services = ['heart_rate']) {
}];
}
-function setUpPreconnectedDevice({address = '00:00:00:00:00:00', name}) {
+function setUpPreconnectedDevice({
+ address = ADDRESS1, name = 'LE Device', knownServiceUUIDs = []}) {
return navigator.bluetooth.test.simulateCentral({state: 'powered-on'})
.then(fake_central => fake_central.simulatePreconnectedPeripheral({
address: address,
- name: name
+ name: name,
+ knownServiceUUIDs: knownServiceUUIDs,
}));
}
+
+function setUpHealthThermometerHeartRate() {
scheib 2017/05/09 23:33:54 setUpHealthThermometerAndHeartRateDevices
ortuno 2017/05/10 06:32:50 Done. I was trying to keep our names as short as p
+ return setUpPreconnectedDevice({
scheib 2017/05/09 23:33:54 Calling setUpPreconnectedDevice multiple times, re
ortuno 2017/05/10 06:32:50 I was hoping to make it so that a test could call
+ address: ADDRESS1,
+ name: 'Health Thermometer',
+ knownServiceUUIDs: ['generic_access', 'health_thermometer'],
+ })
+ .then(() => setUpPreconnectedDevice({
+ address: ADDRESS2,
+ name: 'Heart Rate',
+ knownServiceUUIDs: ['generic_access', 'heart_rate'],
+ }));
+}

Powered by Google App Engine
This is Rietveld 408576698