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 @@ ...@@ -6,26 +6,23 @@
<script src="../../resources/bluetooth/bluetooth-helpers.js"></script> <script src="../../resources/bluetooth/bluetooth-helpers.js"></script>
<script> <script>
'use strict'; 'use strict';
bluetooth_test(() => { const test_desc = 'Discover a device using alias, name, or UUID.';
let devices = [];
let push = device => devices.push(device); bluetooth_test(() => getHealthThermometerDevice()
// We can't use Promise.all() because Chrome will always close // Chrome will always close the previous chooser in the process of handling
// the previous chooser in the process of handling a user gesture // a user gesture for the next request, so these need to be done
// for the next request. // sequentially.
return setBluetoothFakeAdapter('HeartRateAdapter')
.then(() => requestDeviceWithTrustedClick({ .then(() => requestDeviceWithTrustedClick({
filters: [{services: [heart_rate.alias]}]})) filters: [{services: [health_thermometer.alias]}]
.then(push) }))
.then(device => assert_equals(device.constructor.name, 'BluetoothDevice'))
.then(() => requestDeviceWithTrustedClick({ .then(() => requestDeviceWithTrustedClick({
filters: [{services: [heart_rate.name]}]})) filters: [{services: [health_thermometer.name]}]
.then(push) }))
.then(device => assert_equals(device.constructor.name, 'BluetoothDevice'))
.then(() => requestDeviceWithTrustedClick({ .then(() => requestDeviceWithTrustedClick({
filters: [{services: [heart_rate.uuid]}]})) filters: [{services: [health_thermometer.uuid]}]
.then(push) }))
.then(() => { .then(device => assert_equals(device.constructor.name, 'BluetoothDevice')),
devices.forEach(device => { test_desc);
assert_equals(device.constructor.name, 'BluetoothDevice');
});
});
}, 'Mock will resolve.');
</script> </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