diff options
Diffstat (limited to 'testing/web-platform/tests/bluetooth/adapter/adapter-added-getAvailability.https.window.js')
-rw-r--r-- | testing/web-platform/tests/bluetooth/adapter/adapter-added-getAvailability.https.window.js | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/testing/web-platform/tests/bluetooth/adapter/adapter-added-getAvailability.https.window.js b/testing/web-platform/tests/bluetooth/adapter/adapter-added-getAvailability.https.window.js new file mode 100644 index 0000000000..f8e25b2ac2 --- /dev/null +++ b/testing/web-platform/tests/bluetooth/adapter/adapter-added-getAvailability.https.window.js @@ -0,0 +1,23 @@ +// META: script=/resources/testdriver.js +// META: script=/resources/testdriver-vendor.js +// META: script=/bluetooth/resources/bluetooth-test.js +// META: script=/bluetooth/resources/bluetooth-fake-devices.js +'use strict'; +const test_desc = 'getAvailability() resolves with true after adapter is ' + + 'inserted into a system with a platform that supports Bluetooth LE.'; + +bluetooth_test(async () => { + const fake_central = + await navigator.bluetooth.test.simulateCentral({state: 'absent'}); + let availability = await navigator.bluetooth.getAvailability(); + assert_false( + availability, + 'getAvailability() resolves promise with false when adapter is absent.'); + + await fake_central.setState('powered-on'); + availability = await navigator.bluetooth.getAvailability(); + assert_true( + availability, + 'getAvailability() resolves promise with true after Bluetooth LE ' + + 'capable adapter has been has been added.'); +}, test_desc); |