Commit 9ec63731 authored by Manuel Rego Casasnovas's avatar Manuel Rego Casasnovas Committed by Chromium LUCI CQ

[selectors] Fix leaks on :focus-visible tests

The :focus-visible tests were modified recently, but that introduced
some leaks that were detected by "WebKit Linux Leak" bot.

The tests that were failing are using test_driver.click().
This patch modifies the tests, so they pass without issues when
passing --enable-leak-detection to tools/run_web_tests.py
in a release build.

Bug: 1163172
Change-Id: I9b8b1d0459bf7598fc3330495f3cc3ea95d36dae
Cq-Include-Trybots: luci.chromium.try:layout_test_leak_detection,leak_detection_linux
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2617818Reviewed-by: default avatarJavier Fernandez <jfernandez@igalia.com>
Commit-Queue: Manuel Rego <rego@igalia.com>
Cr-Commit-Position: refs/heads/master@{#841432}
parent 6edb77c2
...@@ -178,12 +178,6 @@ crbug.com/1103082 [ Linux ] fast/forms/select/select-change-layout-object-crash. ...@@ -178,12 +178,6 @@ crbug.com/1103082 [ Linux ] fast/forms/select/select-change-layout-object-crash.
# Sheriff 2020-10-08 # Sheriff 2020-10-08
crbug.com/1136690 [ Linux ] http/tests/inspector-protocol/service-worker/service-worker-fetch-async-stacks.js [ Pass Timeout ] crbug.com/1136690 [ Linux ] http/tests/inspector-protocol/service-worker/service-worker-fetch-async-stacks.js [ Pass Timeout ]
# Sheriff 2021-01-06
crbug.com/1163172 [ Linux ] external/wpt/css/selectors/focus-visible-003.html [ Pass Failure ]
crbug.com/1163172 [ Linux ] external/wpt/css/selectors/focus-visible-004.html [ Pass Failure ]
crbug.com/1163172 [ Linux ] external/wpt/css/selectors/focus-visible-015.html [ Pass Failure ]
crbug.com/1163172 [ Linux ] external/wpt/css/selectors/focus-visible-016.html [ Pass Failure ]
########################################################################### ###########################################################################
# WARNING: Memory leaks must be fixed asap. Sheriff is expected to revert # # WARNING: Memory leaks must be fixed asap. Sheriff is expected to revert #
# culprit CLs instead of suppressing the leaks. If you have any question, # # culprit CLs instead of suppressing the leaks. If you have any question, #
......
...@@ -78,16 +78,18 @@ ...@@ -78,16 +78,18 @@
<label><input class="check" id="el-13" type="color"></input> Focus me.</label> <label><input class="check" id="el-13" type="color"></input> Focus me.</label>
</div> </div>
<script> <script>
function mouseClickInTarget(selector) { setup({ explicit_done: true });
let target = document.querySelector(selector);
return test_driver.click(target);
}
for (const target of document.querySelectorAll(".check")) { const elements = document.querySelectorAll(".check");
for (let i = 0; i < elements.length; i++) {
const target = elements[i];
promise_test(() => { promise_test(() => {
return new Promise(resolve => { return new Promise(resolve => {
target.addEventListener("focus", resolve); target.addEventListener("focus", resolve);
test_driver.click(target); test_driver.click(target).then(() => {
if (i == (elements.length - 1))
done();
});
}).then(() => { }).then(() => {
assert_equals(getComputedStyle(target).backgroundColor, "rgb(0, 255, 0)", `backgroundColor for ${target.tagName}#${target.id} should be lime`); assert_equals(getComputedStyle(target).backgroundColor, "rgb(0, 255, 0)", `backgroundColor for ${target.tagName}#${target.id} should be lime`);
assert_not_equals(getComputedStyle(target).outlineColor, "rgb(255, 0, 0)", `outlineColor for ${target.tagName}#${target.id} should NOT be red`); assert_not_equals(getComputedStyle(target).outlineColor, "rgb(255, 0, 0)", `outlineColor for ${target.tagName}#${target.id} should NOT be red`);
......
...@@ -77,16 +77,18 @@ ...@@ -77,16 +77,18 @@
<label><input class="check" id="el-11" type="color"></input> Focus me.</label> <label><input class="check" id="el-11" type="color"></input> Focus me.</label>
</div> </div>
<script> <script>
function mouseClickInTarget(selector) { setup({ explicit_done: true });
let target = document.querySelector(selector);
return test_driver.click(target);
}
for (const target of document.querySelectorAll(".check")) { const elements = document.querySelectorAll(".check");
for (let i = 0; i < elements.length; i++) {
const target = elements[i];
promise_test(() => { promise_test(() => {
return new Promise(resolve => { return new Promise(resolve => {
target.addEventListener("focus", resolve); target.addEventListener("focus", resolve);
test_driver.click(target); test_driver.click(target).then(() => {
if (i == (elements.length - 1))
done();
});
}).then(() => { }).then(() => {
assert_equals(getComputedStyle(target).backgroundColor, "rgb(0, 255, 0)", `backgroundColor for ${target.tagName}#${target.id} should be lime`); assert_equals(getComputedStyle(target).backgroundColor, "rgb(0, 255, 0)", `backgroundColor for ${target.tagName}#${target.id} should be lime`);
assert_not_equals(getComputedStyle(target).outlineColor, "rgb(255, 0, 0)", `outlineColor for ${target.tagName}#${target.id} should NOT be red`); assert_not_equals(getComputedStyle(target).outlineColor, "rgb(255, 0, 0)", `outlineColor for ${target.tagName}#${target.id} should NOT be red`);
......
...@@ -29,6 +29,8 @@ ...@@ -29,6 +29,8 @@
<div id="target" tabindex="0">Target</div> <div id="target" tabindex="0">Target</div>
<script> <script>
setup({ explicit_done: true });
async_test(function(t) { async_test(function(t) {
initial.addEventListener("focus", t.step_func(function() { initial.addEventListener("focus", t.step_func(function() {
assert_equals(getComputedStyle(initial).backgroundColor, "rgb(0, 255, 0)", `backgroundColor for ${initial.tagName}#${initial.id} should be lime`); assert_equals(getComputedStyle(initial).backgroundColor, "rgb(0, 255, 0)", `backgroundColor for ${initial.tagName}#${initial.id} should be lime`);
...@@ -40,6 +42,6 @@ ...@@ -40,6 +42,6 @@
t.done(); t.done();
})); }));
test_driver.click(initial); test_driver.click(initial).then(() => done());
}, ":focus-visible does not match after script focus move"); }, ":focus-visible does not match after script focus move");
</script> </script>
...@@ -37,6 +37,8 @@ ...@@ -37,6 +37,8 @@
<input id="target" /> <input id="target" />
<script> <script>
setup({ explicit_done: true });
async_test(function(t) { async_test(function(t) {
initial.addEventListener("focus", t.step_func(function() { initial.addEventListener("focus", t.step_func(function() {
assert_equals(getComputedStyle(initial).backgroundColor, "rgb(0, 255, 0)", `backgroundColor for ${initial.tagName}#${initial.id} should be lime`); assert_equals(getComputedStyle(initial).backgroundColor, "rgb(0, 255, 0)", `backgroundColor for ${initial.tagName}#${initial.id} should be lime`);
...@@ -48,7 +50,7 @@ ...@@ -48,7 +50,7 @@
t.done(); t.done();
})); }));
test_driver.click(initial); test_driver.click(initial).then(() => done());
}, ":focus-visible always match on text inputs"); }, ":focus-visible always match on text inputs");
</script> </script>
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