blob: f2dcef7c3c037c0f0788503827a13e519e46e031 [file] [log] [blame]
<!doctype HTML>
<!--
Runs an acquire, then update and commit synchronously, both should succeed.
-->
<style>
#container {
contain: content;
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");
container.getDisplayLock().acquire().then(() => {
let child = document.createElement("div");
child.id = "child";
container.appendChild(child);
container.id = "container";
document.body.appendChild(container);
Promise.all([
container.getDisplayLock().update(),
container.getDisplayLock().commit()
]).then(() => { finishTest("PASS"); },
() => { finishTest("FAIL"); });
});
}
window.onload = runTest;
</script>