blob: 657d653ce371288af64193e5bae2c3c28ace3c85 [file] [log] [blame]
<!doctype HTML>
<!--
Runs an acquireDisplayLock, which suspends the context.
The context is then resumed which is when the promise resolves.
-->
<style>
#container {
contain: content;
width: 100px;
height: 100px;
}
</style>
<div id="log"></div>
<script>
if (window.testRunner)
window.testRunner.waitUntilDone();
function finishTest(status_string) {
if (document.getElementById("log").innerHTML === "")
document.getElementById("log").innerHTML = status_string;
if (window.testRunner)
window.testRunner.notifyDone();
}
function acquire() {
let current_status = "FAIL";
let resume_handle;
let container = document.createElement("div");
container.id = "container";
container.acquireDisplayLock((context) => {
resume_handle = context.suspend();
}).then(
() => { finishTest(current_status); },
() => { finishTest("FAIL - rejected"); });
document.body.appendChild(container);
setTimeout(() => {
current_status = "PASS";
resume_handle.resume();
}, 100);
}
window.onload = acquire;
</script>