Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

<!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');
assert_true(matchMedia('(device-posture: continuous)').matches);
const foldedMQL = window.matchMedia('(device-posture: folded)');
const promise = new Promise(resolve => {
foldedMQL.addEventListener(
'change',
() => { resolve(foldedMQL.matches); },
{ once: true }
);
});
await test_driver.set_device_posture('folded');
assert_true(await promise);
}, 'Tests the Device Posture API Media Query change event handler.');
</script>