diff options
Diffstat (limited to 'testing/web-platform/tests/device-posture/device-posture-event-listener.https.html')
-rw-r--r-- | testing/web-platform/tests/device-posture/device-posture-event-listener.https.html | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/testing/web-platform/tests/device-posture/device-posture-event-listener.https.html b/testing/web-platform/tests/device-posture/device-posture-event-listener.https.html new file mode 100644 index 0000000000..f4e21c89cc --- /dev/null +++ b/testing/web-platform/tests/device-posture/device-posture-event-listener.https.html @@ -0,0 +1,25 @@ +<!DOCTYPE html> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/resources/testdriver.js"></script> +<script src="/resources/testdriver-vendor.js"></script> +<script> +'use strict'; + +promise_test(async (t) => { + t.add_cleanup(async () => { + await test_driver.clear_device_posture(); + }); + assert_equals(navigator.devicePosture.type, 'continuous'); + + const promise = new Promise(resolve => { + navigator.devicePosture.addEventListener( + 'change', + () => { resolve(navigator.devicePosture.type); }, + { once: true } + ); + }); + await test_driver.set_device_posture('folded'); + assert_equals(await promise, 'folded'); +}, 'Tests the Device Posture API addEventListener change event handler.'); +</script> |