device-posture-clear.https.html (947B)
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 originalPosture = navigator.devicePosture.type; 14 const posture = originalPosture ? 'folded' : 'continuous'; 15 16 const watcher = new EventWatcher(t, navigator.devicePosture, ['change']); 17 await Promise.all([ 18 watcher.wait_for('change'), 19 test_driver.set_device_posture(posture) 20 ]); 21 assert_equals(navigator.devicePosture.type, posture); 22 23 await Promise.all([ 24 watcher.wait_for('change'), 25 test_driver.clear_device_posture() 26 ]); 27 assert_equals(navigator.devicePosture.type, originalPosture); 28 }, 'Tests that device posture override can be removed.'); 29 </script>