blob: c0535f214d085d3cc95196fe0257032835d87889 [file] [log] [blame]
<!doctype HTML>
<!--
Runs multiple acquires and updates.
-->
<style>
#container {
contain: style layout;
width: 150px;
height: 150px;
background: lightblue;
}
#child {
width: 50px;
height: 50px;
background: lightgreen;
}
</style>
<div id="log"></div>
<script>
// TODO(vmpstr): In WPT this needs to be replaced with reftest-wait.
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 runTest() {
let container = document.createElement("div");
Promise.all([
container.displayLock.acquire({ timeout: Infinity }),
container.displayLock.acquire({ timeout: Infinity }),
container.displayLock.acquire({ timeout: Infinity }),
container.displayLock.acquire({ timeout: Infinity })
]).then(() => {
let child = document.createElement("div");
child.id = "child";
container.appendChild(child);
container.id = "container";
document.body.appendChild(container);
Promise.all([
container.displayLock.update(),
container.displayLock.update(),
container.displayLock.update(),
container.displayLock.update()
]).then(() => {
container.displayLock.commit().then(
() => { finishTest("PASS"); },
(e) => { finishTest("FAIL " + e.message); });
});
});
}
window.onload = runTest;
</script>