device-posture-change-event.https.html (770B)
1 <!DOCTYPE html> 2 <script src="/resources/testharness.js"></script> 3 <script src="/resources/testharnessreport.js"></script> 4 <script src="/resources/testdriver.js"></script> 5 <script src="/resources/testdriver-vendor.js"></script> 6 <script> 7 'use strict'; 8 9 promise_test(async (t) => { 10 t.add_cleanup(async () => { 11 await test_driver.clear_device_posture(); 12 }); 13 const watcher = new EventWatcher(t, navigator.devicePosture, ['change']); 14 const postures = ['folded', 'continuous', 'folded']; 15 for (const posture of postures) { 16 await Promise.all([ 17 watcher.wait_for('change'), 18 test_driver.set_device_posture(posture) 19 ]); 20 assert_equals(posture, navigator.devicePosture.type); 21 } 22 }, 'Tests the Device Posture API change event handler.'); 23 </script>