Commit 7b525e54 authored by Vladimir Levin's avatar Vladimir Levin Committed by Commit Bot

DL: Remove displayLock references in web_tests.

This patch removes references to displayLock JavaScript object in
display-lock tests. It also removes updateAndCommit() tests.

R=chrishtr@chromium.org, rakina@chromium.org

Bug: 1007291
Change-Id: I7f111ef97f11284310c177d6f29c63148fad498b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1831980Reviewed-by: default avatarChris Harrelson <chrishtr@chromium.org>
Commit-Queue: vmpstr <vmpstr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#701210}
parent adb44654
...@@ -540,7 +540,7 @@ void DisplayLockContext::CommitForActivation() { ...@@ -540,7 +540,7 @@ void DisplayLockContext::CommitForActivation() {
// Since setting the attribute might trigger a commit if we are still locked, // Since setting the attribute might trigger a commit if we are still locked,
// we set it after we start the commit. // we set it after we start the commit.
if (element_->hasAttribute(html_names::kRendersubtreeAttr)) if (element_->hasAttribute(html_names::kRendersubtreeAttr))
element_->setAttribute(html_names::kRendersubtreeAttr, "visible"); element_->setAttribute(html_names::kRendersubtreeAttr, "");
} }
bool DisplayLockContext::ShouldCommitForActivation() const { bool DisplayLockContext::ShouldCommitForActivation() const {
......
...@@ -40,8 +40,6 @@ async_test((t) => { ...@@ -40,8 +40,6 @@ async_test((t) => {
t.step(() => { t.step(() => {
assert_equals(container.renderSubtree, cloned.renderSubtree); assert_equals(container.renderSubtree, cloned.renderSubtree);
assert_true(container.displayLock.locked, "original is locked");
assert_true(cloned.displayLock.locked, "cloned copy is locked");
t.done(); t.done();
}); });
} }
......
<!doctype HTML>
<html class="reftest-wait">
<meta charset="utf8">
<title>Display Locking: acquire, immediate displayLock.updateAndCommit</title>
<link rel="author" title="Vladimir Levin" href="mailto:vmpstr@chromium.org">
<link rel="help" href="https://github.com/WICG/display-locking">
<link rel="match" href="pass-container-with-child-ref.html">
<script src="/common/reftest-wait.js"></script>
<script src="resources/utils.js"></script>
<style>
#container {
width: 150px;
height: 150px;
background: lightblue;
}
#child {
width: 50px;
height: 50px;
background: lightgreen;
}
</style>
<div id="log"></div>
<div id="container"></div>
<script>
function finishTest(status_string) {
if (document.getElementById("log").innerHTML === "")
document.getElementById("log").innerHTML = status_string;
takeScreenshot();
}
function runTest() {
const container = document.getElementById("container");
setInvisible(container);
const child = document.createElement("div");
child.id = "child";
container.appendChild(child);
container.displayLock.updateAndCommit().then(
() => { finishTest("PASS"); },
(e) => { finishTest("FAIL " + e.message); });
}
window.onload = runTest;
</script>
</html>
...@@ -11,34 +11,14 @@ ...@@ -11,34 +11,14 @@
<body></body> <body></body>
<script> <script>
async_test(async (t) => { // TODO(vmpstr): Add tests for display:contents, slot, which cannot be locked.
let div = document.createElement("div");
div.style = "display: contents;";
document.body.appendChild(div);
await setInvisible(div).then(() => {
// TODO(rakina): Change this once we support non-contained locking.
t.step(() => assert_false(div.displayLock.locked));
t.done();
});
}, "Elements with display:contents can't be locked");
async_test(async (t) => {
let slot = document.createElement("slot");
document.body.appendChild(slot);
await setInvisible(slot).then(() => {
// TODO(rakina): Change this once we support non-contained locking.
t.step(() => assert_false(slot.displayLock.locked));
t.done();
});
}, "<slot> can't be locked");
async_test(async (t) => { async_test(async (t) => {
let slot = document.createElement("slot"); let slot = document.createElement("slot");
slot.style = "display: block;"; slot.style = "display: block;";
document.body.appendChild(slot); document.body.appendChild(slot);
await setInvisible(slot).then(() => { await setInvisible(slot).then(() => {
// TODO(rakina): Change this once we support non-contained locking. t.step(() => assert_equals(slot.renderSubtree, "invisible"));
t.step(() => assert_true(slot.displayLock.locked));
t.done(); t.done();
}); });
}, "<slot> with changed display type can be locked"); }, "<slot> with changed display type can be locked");
......
<!doctype HTML>
<html class="reftest-wait">
<meta charset="utf8">
<title>Display Locking: acquire, displayLock.updateAndCommit</title>
<link rel="author" title="Vladimir Levin" href="mailto:vmpstr@chromium.org">
<link rel="help" href="https://github.com/WICG/display-locking">
<link rel="match" href="pass-container-with-child-ref.html">
<script src="/common/reftest-wait.js"></script>
<script src="resources/utils.js"></script>
<style>
#container {
width: 150px;
height: 150px;
background: lightblue;
}
#child {
width: 50px;
height: 50px;
background: lightgreen;
}
</style>
<div id="log"></div>
<script>
function finishTest(status_string) {
if (document.getElementById("log").innerHTML === "")
document.getElementById("log").innerHTML = status_string;
takeScreenshot();
}
function runTest() {
const container = document.createElement("div");
setInvisible(container).then(() => {
const child = document.createElement("div");
child.id = "child";
container.appendChild(child);
container.id = "container";
document.body.appendChild(container);
container.displayLock.updateAndCommit().then(
() => { finishTest("PASS"); },
(e) => { finishTest("FAIL " + e.message); });
});
}
window.onload = runTest;
</script>
</html>
...@@ -20,12 +20,12 @@ function axElementById(id) { ...@@ -20,12 +20,12 @@ function axElementById(id) {
async_test(async(t) => { async_test(async(t) => {
const lockedEl = document.getElementById("locked"); const lockedEl = document.getElementById("locked");
t.step(() => { assert_true(lockedEl.displayLock.locked) }); t.step(() => { assert_equals(lockedEl.renderSubtree, "invisible activatable") });
let axLocked = axElementById("locked"); let axLocked = axElementById("locked");
t.step(() => { assert_equals(axLocked.childrenCount, 3, "Child count after acquire"); }); t.step(() => { assert_equals(axLocked.childrenCount, 3, "Child count after acquire"); });
axElementById("child").takeFocus(); axElementById("child").takeFocus();
t.step(() => { assert_false(lockedEl.displayLock.locked) }); t.step(() => { assert_equals(lockedEl.renderSubtree, "") });
// Wait for the next frame for the ax object to be recreated. // Wait for the next frame for the ax object to be recreated.
requestAnimationFrame(() => { requestAnimationFrame(() => {
requestAnimationFrame(() => { requestAnimationFrame(() => {
......
...@@ -20,13 +20,13 @@ function axElementById(id) { ...@@ -20,13 +20,13 @@ function axElementById(id) {
async_test(async(t) => { async_test(async(t) => {
const lockedEl = document.getElementById("locked"); const lockedEl = document.getElementById("locked");
t.step(() => { assert_true(lockedEl.displayLock.locked) }); t.step(() => { assert_equals(lockedEl.renderSubtree, "invisible activatable") });
let axLocked = axElementById("locked"); let axLocked = axElementById("locked");
t.step(() => { assert_equals(axLocked.childrenCount, 3, "Child count after acquire"); }); t.step(() => { assert_equals(axLocked.childrenCount, 3, "Child count after acquire"); });
axElementById("child").press(); axElementById("child").press();
t.step(() => { assert_false(lockedEl.displayLock.locked) }); t.step(() => { assert_equals(lockedEl.renderSubtree, ""); });
// Wait for the next frame for the ax object to be recreated. // Wait for the next frame for the ax object to be recreated.
requestAnimationFrame(() => { requestAnimationFrame(() => {
requestAnimationFrame(() => { requestAnimationFrame(() => {
......
...@@ -20,13 +20,13 @@ function axElementById(id) { ...@@ -20,13 +20,13 @@ function axElementById(id) {
async_test(async(t) => { async_test(async(t) => {
const lockedEl = document.getElementById("locked"); const lockedEl = document.getElementById("locked");
t.step(() => { assert_true(lockedEl.displayLock.locked) }); t.step(() => { assert_equals(lockedEl.renderSubtree, "invisible activatable") });
let axLocked = axElementById("locked"); let axLocked = axElementById("locked");
t.step(() => { assert_equals(axLocked.childrenCount, 3, "Child count after acquire"); }); t.step(() => { assert_equals(axLocked.childrenCount, 3, "Child count after acquire"); });
axElementById("child").scrollToMakeVisible(); axElementById("child").scrollToMakeVisible();
t.step(() => { assert_false(lockedEl.displayLock.locked) }); t.step(() => { assert_equals(lockedEl.renderSubtree, "") });
// Wait for the next frame for the ax object to be recreated. // Wait for the next frame for the ax object to be recreated.
requestAnimationFrame(() => { requestAnimationFrame(() => {
requestAnimationFrame(() => { requestAnimationFrame(() => {
......
...@@ -42,7 +42,7 @@ async_test((t) => { ...@@ -42,7 +42,7 @@ async_test((t) => {
let commit_promise = setVisible(container); let commit_promise = setVisible(container);
await commit_promise; await commit_promise;
t.step(() => assert_false(container.displayLock.locked, "context after commit & activation is unlocked")); t.step(() => assert_equals(container.renderSubtree, "", "context after commit & activation is unlocked"));
t.done(); t.done();
} }
......
<!doctype HTML>
<html>
<meta charset="utf8">
<title>Display Locking: activate update+commit same frame</title>
<link rel="author" title="Rakina Zata Amni" href="mailto:rakina@chromium.org">
<link rel="help" href="https://github.com/WICG/display-locking">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../resources/utils.js"></script>
<style>
.spacer {
width: 150px;
height: 3000px;
background: lightblue;
}
#container {
width: 150px;
height: 150px;
background: lightgreen;
}
#target {
width: 100px;
height: 100px;
background: green;
}
</style>
<div class="spacer"></div>
<div id="container"><div id="target"></div></div>
<script>
async_test((t) => {
async function runTest() {
let container = document.getElementById("container");
let acquire_promise = setInvisibleActivatable(container);
await acquire_promise;
target.scrollIntoView();
let update_and_commit_promise = container.displayLock.updateAndCommit();
await update_and_commit_promise;
t.step(() => assert_false(container.displayLock.locked, "context after update & activation is unlocked"));
t.done();
}
window.onload = function() {
requestAnimationFrame(() => requestAnimationFrame(runTest));
};
}, "scrollIntoView and calling updateAndCommit on the same frame should work");
</script>
</html>
...@@ -41,7 +41,7 @@ async_test((t) => { ...@@ -41,7 +41,7 @@ async_test((t) => {
target.scrollIntoView(); target.scrollIntoView();
let update_promise = container.updateRendering(); let update_promise = container.updateRendering();
await update_promise; await update_promise;
t.step(() => assert_false(container.displayLock.locked, "context after update & activation is unlocked")); t.step(() => assert_equals(container.renderSubtree, "", "context after update & activation is unlocked"));
t.done(); t.done();
} }
......
...@@ -33,10 +33,10 @@ function prepareTest() { ...@@ -33,10 +33,10 @@ function prepareTest() {
promise_test(() => { promise_test(() => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
prepareTest().then(() => { prepareTest().then(() => {
assert_false(outermost.displayLock.locked); assert_equals(outermost.renderSubtree, "");
assert_true(outer.displayLock.locked); assert_equals(outer.renderSubtree, "invisible activatable");
assert_true(inner.displayLock.locked); assert_equals(inner.renderSubtree, "invisible activatable");
assert_false(innermost.displayLock.locked); assert_equals(innermost.renderSubtree, "");
let innerPromise = new Promise((resolve, reject) => { let innerPromise = new Promise((resolve, reject) => {
inner.onbeforeactivate = (e) => { inner.onbeforeactivate = (e) => {
......
...@@ -31,7 +31,7 @@ function prepareTest() { ...@@ -31,7 +31,7 @@ function prepareTest() {
promise_test(() => { promise_test(() => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
prepareTest().then(() => { prepareTest().then(() => {
assert_true(inner.displayLock.locked); assert_equals(inner.renderSubtree, "invisible activatable");
inner.onbeforeactivate = (e) => { inner.onbeforeactivate = (e) => {
assert_equals(e.activatedElement, inner); assert_equals(e.activatedElement, inner);
resolve(); resolve();
......
...@@ -23,7 +23,7 @@ async_test((t) => { ...@@ -23,7 +23,7 @@ async_test((t) => {
async function runTest() { async function runTest() {
const target = document.getElementById("target"); const target = document.getElementById("target");
await setInvisibleActivatable(target); await setInvisibleActivatable(target);
t.step(() => assert_true(target.displayLock.locked)); t.step(() => assert_equals(target.renderSubtree, "invisible activatable"));
target.addEventListener("beforeactivate", () => commit(target)); target.addEventListener("beforeactivate", () => commit(target));
target.scrollIntoView(); target.scrollIntoView();
......
...@@ -32,10 +32,10 @@ function prepareTest() { ...@@ -32,10 +32,10 @@ function prepareTest() {
promise_test(() => { promise_test(() => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
prepareTest().then(() => { prepareTest().then(() => {
assert_false(outermost.displayLock.locked); assert_equals(outermost.renderSubtree, "");
assert_true(outer.displayLock.locked); assert_equals(outer.renderSubtree, "invisible activatable");
assert_true(inner.displayLock.locked); assert_equals(inner.renderSubtree, "invisible activatable");
assert_false(innermost.displayLock.locked); assert_equals(innermost.renderSubtree, "");
let innerPromise = new Promise((resolve, reject) => { let innerPromise = new Promise((resolve, reject) => {
inner.onbeforeactivate = (e) => { inner.onbeforeactivate = (e) => {
......
...@@ -29,9 +29,9 @@ promise_test(() => { ...@@ -29,9 +29,9 @@ promise_test(() => {
acquirePromise.then(() => { acquirePromise.then(() => {
window.getSelection().selectAllChildren(container); window.getSelection().selectAllChildren(container);
assert_equals(window.getSelection().toString(), "foo\nbar"); assert_equals(window.getSelection().toString(), "foo\nbar");
assert_equals(container.displayLock.locked, false); assert_equals(container.renderSubtree, "");
assert_equals(nonActivatable.displayLock.locked, true); assert_equals(nonActivatable.renderSubtree, "invisible");
assert_equals(nested.displayLock.locked, false); assert_equals(nested.renderSubtree, "");
resolve(); resolve();
}); });
}); });
......
<!doctype HTML>
<html class="reftest-wait">
<meta charset="utf8">
<title>Display Locking: commit, displayLock.updateAndCommit</title>
<link rel="author" title="Vladimir Levin" href="mailto:vmpstr@chromium.org">
<link rel="help" href="https://github.com/WICG/display-locking">
<link rel="match" href="pass-container-with-child-ref.html">
<script src="/common/reftest-wait.js"></script>
<script src="resources/utils.js"></script>
<style>
#container {
width: 150px;
height: 150px;
background: lightblue;
}
#child {
width: 50px;
height: 50px;
background: lightgreen;
}
</style>
<div id="log"></div>
<script>
function finishTest(status_string) {
if (document.getElementById("log").innerHTML === "")
document.getElementById("log").innerHTML = status_string;
takeScreenshot();
}
function runTest() {
const container = document.createElement("div");
setInvisible(container).then(() => {
const child = document.createElement("div");
child.id = "child";
container.appendChild(child);
container.id = "container";
document.body.appendChild(container);
const first_promise = setVisible(container);
const second_promise = container.displayLock.updateAndCommit();
Promise.all([first_promise, second_promise]).then(() => finishTest("PASS"));
});
}
window.onload = runTest;
</script>
</html>
...@@ -18,27 +18,26 @@ async_test((t) => { ...@@ -18,27 +18,26 @@ async_test((t) => {
async function templateTest() { async function templateTest() {
const templateChild = template.content.firstChild; const templateChild = template.content.firstChild;
t.step(() => assert_not_equals(templateChild.displayLock, null, "Can access displayLock on element in template"));
const acquirePromise = setInvisible(templateChild); const acquirePromise = setInvisible(templateChild);
await acquirePromise; await acquirePromise;
t.step(() => assert_true(templateChild.displayLock.locked, "Can lock element in template")); t.step(() => assert_equals(templateChild.renderSubtree, "invisible", "Can lock element in template"));
const adoptedNode = document.adoptNode(templateChild); const adoptedNode = document.adoptNode(templateChild);
t.step(() => assert_true(adoptedNode.displayLock.locked, "Adopted element is still locked")); t.step(() => assert_equals(adoptedNode.renderSubtree, "invisible", "Adopted element is still locked"));
container.appendChild(adoptedNode); container.appendChild(adoptedNode);
t.step(() => assert_true(adoptedNode.displayLock.locked, "Still locked after appended")); t.step(() => assert_equals(adoptedNode.renderSubtree, "invisible", "Still locked after appended"));
await setVisible(adoptedNode); await setVisible(adoptedNode);
t.step(() => assert_false(adoptedNode.displayLock.locked, "Can commit")); t.step(() => assert_equals(adoptedNode.renderSubtree, "", "Can commit"));
await setInvisible(adoptedNode); await setInvisible(adoptedNode);
t.step(() => assert_true(adoptedNode.displayLock.locked, "Can re-lock element")); t.step(() => assert_equals(adoptedNode.renderSubtree, "invisible", "Can re-lock element"));
await setVisible(adoptedNode); await setVisible(adoptedNode);
t.step(() => assert_false(adoptedNode.displayLock.locked, "Can re-commit element")); t.step(() => assert_equals(adoptedNode.renderSubtree, "", "Can re-commit element"));
t.done(); t.done();
} }
......
...@@ -154,7 +154,7 @@ async_test((t) => { ...@@ -154,7 +154,7 @@ async_test((t) => {
// Unlock target3. // Unlock target3.
async function enqueueStep5() { async function enqueueStep5() {
await target3.displayLock.commit(); await setVisible(target3);
requestAnimationFrame(() => { requestAnimationFrame(() => {
requestAnimationFrame(() => { requestAnimationFrame(() => {
runStep5(); runStep5();
......
...@@ -15,25 +15,23 @@ ...@@ -15,25 +15,23 @@
async_test((t) => { async_test((t) => {
async function runTest() { async function runTest() {
const container = document.getElementById("container"); const container = document.getElementById("container");
t.step(() => assert_false(container.displayLock.locked, "initial context is unlocked"));
const acquire_promise = setInvisible(container); const acquire_promise = setInvisible(container);
t.step(() => assert_true(container.displayLock.locked, "context before acquire finishes is locked")); t.step(() => assert_equals(container.renderSubtree, "invisible", "context before acquire finishes is locked"));
await acquire_promise; await acquire_promise;
t.step(() => assert_true(container.displayLock.locked, "context after acquire finishes is locked")); t.step(() => assert_equals(container.renderSubtree, "invisible", "context after acquire finishes is locked"));
const update_promise = container.updateRendering(); const update_promise = container.updateRendering();
t.step(() => assert_true(container.displayLock.locked, "context during update is locked")); t.step(() => assert_equals(container.renderSubtree, "invisible", "context during update is locked"));
await update_promise; await update_promise;
t.step(() => assert_true(container.displayLock.locked, "context after update is locked")); t.step(() => assert_equals(container.renderSubtree, "invisible", "context after update is locked"));
const commit_promise = setVisible(container); const commit_promise = setVisible(container);
t.step(() => assert_false(container.displayLock.locked, "context during commit is unlocked")); t.step(() => assert_equals(container.renderSubtree, "", "context during commit is unlocked"));
await commit_promise; await commit_promise;
t.step(() => assert_false(container.displayLock.locked, "context after commit is unlocked")); t.step(() => assert_equals(container.renderSubtree, "", "context after commit is unlocked"));
t.done(); t.done();
} }
......
<!doctype HTML>
<html class="reftest-wait">
<meta charset="utf8">
<title>Display Locking: multiple displayLock.updateAndCommit</title>
<link rel="author" title="Vladimir Levin" href="mailto:vmpstr@chromium.org">
<link rel="help" href="https://github.com/WICG/display-locking">
<link rel="match" href="pass-container-with-child-ref.html">
<script src="/common/reftest-wait.js"></script>
<script src="resources/utils.js"></script>
<style>
#container {
width: 150px;
height: 150px;
background: lightblue;
}
#child {
width: 50px;
height: 50px;
background: lightgreen;
}
</style>
<div id="log"></div>
<script>
function finishTest(status_string) {
if (document.getElementById("log").innerHTML === "")
document.getElementById("log").innerHTML = status_string;
takeScreenshot();
}
function runTest() {
const container = document.createElement("div");
setInvisible(container).then(() => {
const child = document.createElement("div");
child.id = "child";
container.appendChild(child);
container.id = "container";
document.body.appendChild(container);
const promises = []
for (let i = 0; i < 10; ++i) {
promises.push(container.displayLock.updateAndCommit());
}
Promise.all(promises).then(() => finishTest("PASS"));
});
}
window.onload = runTest;
</script>
</html>
<!doctype HTML>
<html class="reftest-wait">
<meta charset="utf8">
<title>Display Locking: nested displayLock.updateAndCommit</title>
<link rel="author" title="Vladimir Levin" href="mailto:vmpstr@chromium.org">
<link rel="help" href="https://github.com/WICG/display-locking">
<link rel="match" href="pass-ref.html">
<script src="/common/reftest-wait.js"></script>
<script src="resources/utils.js"></script>
<style>
#outer {
width: 100px;
height: 100px;
}
#inner {
width: 50px;
height: 50px;
background: lightgreen;
}
div > div > div {
width: 10px;
height: 10px;
background: red;
}
</style>
<div id="log"></div>
<div id="outer" class="container">
<div id="inner" class="container"></div>
</div>
<script>
function finishTest(status_string) {
if (document.getElementById("log").innerHTML === "")
document.getElementById("log").innerHTML = status_string;
takeScreenshot();
}
function runTest() {
const outer = document.getElementById("outer");
const inner = document.getElementById("inner");
Promise.all([
setInvisible(outer),
setInvisible(inner)])
.then(() => {
// Dirty the inner layout
inner.appendChild(document.createElement("div"));
inner.displayLock.updateAndCommit().then(
() => { finishTest("PASS"); },
(e) => { finishTest("FAIL " + e.message); });
});
}
window.onload = runTest;
</script>
</html>
...@@ -8,7 +8,7 @@ function setInvisibleActivatable(element) { ...@@ -8,7 +8,7 @@ function setInvisibleActivatable(element) {
} }
function setVisible(element) { function setVisible(element) {
return setRenderSubtree(element, "visible"); return setRenderSubtree(element, "");
} }
function setRenderSubtree(element, value) { function setRenderSubtree(element, value) {
......
<!doctype HTML>
<html class="reftest-wait">
<meta charset="utf8">
<title>Display Locking: displayLock.updateAndCommit, commit</title>
<link rel="author" title="Vladimir Levin" href="mailto:vmpstr@chromium.org">
<link rel="help" href="https://github.com/WICG/display-locking">
<link rel="match" href="pass-container-with-child-ref.html">
<script src="/common/reftest-wait.js"></script>
<script src="resources/utils.js"></script>
<style>
#container {
width: 150px;
height: 150px;
background: lightblue;
}
#child {
width: 50px;
height: 50px;
background: lightgreen;
}
</style>
<div id="log"></div>
<script>
function finishTest(status_string) {
if (document.getElementById("log").innerHTML === "")
document.getElementById("log").innerHTML = status_string;
takeScreenshot();
}
function runTest() {
const container = document.createElement("div");
setInvisible(container).then(() => {
const child = document.createElement("div");
child.id = "child";
container.appendChild(child);
container.id = "container";
document.body.appendChild(container);
const first_promise = container.displayLock.updateAndCommit();
const second_promise = setVisible(container);
Promise.all([first_promise, second_promise]).then(() => finishTest("PASS"));
});
}
window.onload = runTest;
</script>
</html>
<!doctype HTML>
<html class="reftest-wait">
<meta charset="utf8">
<title>Display Locking: displayLock.updateAndCommit, update</title>
<link rel="author" title="Vladimir Levin" href="mailto:vmpstr@chromium.org">
<link rel="help" href="https://github.com/WICG/display-locking">
<link rel="match" href="pass-container-with-child-ref.html">
<script src="/common/reftest-wait.js"></script>
<script src="resources/utils.js"></script>
<style>
#container {
width: 150px;
height: 150px;
background: lightblue;
}
#child {
width: 50px;
height: 50px;
background: lightgreen;
}
</style>
<div id="log"></div>
<script>
function finishTest(status_string) {
if (document.getElementById("log").innerHTML === "")
document.getElementById("log").innerHTML = status_string;
takeScreenshot();
}
function runTest() {
const container = document.createElement("div");
setInvisible(container).then(() => {
const child = document.createElement("div");
child.id = "child";
container.appendChild(child);
container.id = "container";
document.body.appendChild(container);
const first_promise = container.displayLock.updateAndCommit();
const second_promise = container.updateRendering();
Promise.all([first_promise, second_promise]).then(() => finishTest("PASS"));
});
}
window.onload = runTest;
</script>
</html>
<!doctype HTML>
<html class="reftest-wait">
<meta charset="utf8">
<title>Display Locking: displayLock.updateAndCommit without acquire</title>
<link rel="author" title="Vladimir Levin" href="mailto:vmpstr@chromium.org">
<link rel="help" href="https://github.com/WICG/display-locking">
<link rel="match" href="pass-ref.html">
<script src="/common/reftest-wait.js"></script>
<script src="resources/utils.js"></script>
<style>
#container {
width: 150px;
height: 150px;
background: lightblue;
}
</style>
<div id="log"></div>
<script>
function finishTest(status_string) {
if (document.getElementById("log").innerHTML === "")
document.getElementById("log").innerHTML = status_string;
takeScreenshot();
}
function runTest() {
const container = document.createElement("div");
container.id = "container";
container.displayLock.updateAndCommit().then(
() => { finishTest("PASS"); },
(e) => { finishTest("FAIL " + e.message); });
}
window.onload = runTest;
</script>
</html>
<!doctype HTML>
<html class="reftest-wait">
<meta charset="utf8">
<title>Display Locking: update, displayLock.updateAndCommit</title>
<link rel="author" title="Vladimir Levin" href="mailto:vmpstr@chromium.org">
<link rel="help" href="https://github.com/WICG/display-locking">
<link rel="match" href="pass-container-with-child-ref.html">
<script src="/common/reftest-wait.js"></script>
<script src="resources/utils.js"></script>
<style>
#container {
width: 150px;
height: 150px;
background: lightblue;
}
#child {
width: 50px;
height: 50px;
background: lightgreen;
}
</style>
<div id="log"></div>
<script>
function finishTest(status_string) {
if (document.getElementById("log").innerHTML === "")
document.getElementById("log").innerHTML = status_string;
takeScreenshot();
}
function runTest() {
const container = document.createElement("div");
setInvisible(container).then(() => {
const child = document.createElement("div");
child.id = "child";
container.appendChild(child);
container.id = "container";
document.body.appendChild(container);
const first_promise = container.updateRendering();
const second_promise = container.displayLock.updateAndCommit();
Promise.all([first_promise, second_promise]).then(() => finishTest("PASS"));
});
}
window.onload = runTest;
</script>
</html>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment