Commit cee2ffda authored by Ovidio Henriquez's avatar Ovidio Henriquez Committed by Commit Bot

bluetooth: web: test: Update discovery succeeds

This change updates the discovery-succeeds.html test to use the Web
Bluetooth Test interface. This will help us migrate the test to the wpt/
directory, since testRunner is not going to be used anymore.

BUG=509038

Change-Id: Id5d7d72e100c2d477d4690090b715eb549dfad99
Reviewed-on: https://chromium-review.googlesource.com/817754Reviewed-by: default avatarConley Owens <cco3@chromium.org>
Reviewed-by: default avatarVincent Scheib <scheib@chromium.org>
Commit-Queue: Vincent Scheib <scheib@chromium.org>
Cr-Commit-Position: refs/heads/master@{#523297}
parent 92f494ea
......@@ -6,26 +6,23 @@
<script src="../../resources/bluetooth/bluetooth-helpers.js"></script>
<script>
'use strict';
bluetooth_test(() => {
let devices = [];
let push = device => devices.push(device);
// We can't use Promise.all() because Chrome will always close
// the previous chooser in the process of handling a user gesture
// for the next request.
return setBluetoothFakeAdapter('HeartRateAdapter')
const test_desc = 'Discover a device using alias, name, or UUID.';
bluetooth_test(() => getHealthThermometerDevice()
// Chrome will always close the previous chooser in the process of handling
// a user gesture for the next request, so these need to be done
// sequentially.
.then(() => requestDeviceWithTrustedClick({
filters: [{services: [heart_rate.alias]}]}))
.then(push)
filters: [{services: [health_thermometer.alias]}]
}))
.then(device => assert_equals(device.constructor.name, 'BluetoothDevice'))
.then(() => requestDeviceWithTrustedClick({
filters: [{services: [heart_rate.name]}]}))
.then(push)
filters: [{services: [health_thermometer.name]}]
}))
.then(device => assert_equals(device.constructor.name, 'BluetoothDevice'))
.then(() => requestDeviceWithTrustedClick({
filters: [{services: [heart_rate.uuid]}]}))
.then(push)
.then(() => {
devices.forEach(device => {
assert_equals(device.constructor.name, 'BluetoothDevice');
});
});
}, 'Mock will resolve.');
filters: [{services: [health_thermometer.uuid]}]
}))
.then(device => assert_equals(device.constructor.name, 'BluetoothDevice')),
test_desc);
</script>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment