Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove testharness from reftest #43310

Merged
merged 1 commit into from
Nov 22, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions css/cssom/CSSStyleSheet-constructable-concat.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,20 @@
<link rel="author" href="mailto:masonf@chromium.org">
<link rel="help" href="https://drafts.csswg.org/cssom/#extensions-to-the-document-or-shadow-root-interface">
<link rel="match" href="CSSStyleSheet-constructable-concat-ref.html">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>

<span>This should be green</span>
<div id=host></div>
<pre id=errors></pre>

<script>
test(function() {
function assert_equals(val1,val2) {
if (val1 === val2) {
return;
mfreed7 marked this conversation as resolved.
Show resolved Hide resolved
}
const t = document.createTextNode(`FAIL! ${val1} should be equal to ${val2}\n`);
errors.appendChild(t);
}
window.onload = () => {
const sheet = new CSSStyleSheet();
sheet.replaceSync('span {background-color:green;}');
assert_equals(document.adoptedStyleSheets.length,0);
Expand All @@ -24,5 +30,5 @@
assert_equals(shadow.adoptedStyleSheets.length,0);
shadow.adoptedStyleSheets = shadow.adoptedStyleSheets.concat([sheet]);
assert_equals(shadow.adoptedStyleSheets.length,1);
}, "adoptedStyleSheets should allow .concat on empty starting values");
};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mfreed7 You probably want to use reftest-wait in order for this to work like you expect? Otherwise it might take a screenshot before the errors are shown.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing in the test is async though - all of it should render synchronously as part of window load, so there shouldn’t be a need to do reftest-wait, right? This passes on Chromium.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the error show up in Chromium when you do assert_equals(false, true) ? I'm concerned about false passes rather false fails. It's possible that reftest-wait is enough, but looking at: https://web-platform-tests.org/writing-tests/reftests.html#controlling-when-comparison-occurs . I don't see anything that mentions explicitly that it waits before all the load event listeners have executed before screenshotting.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On Chromium, assert_equals(false,true) does in fact fail this test.

So I think it makes sense to enforce this behavior - WDYT? I've put this infra test up for review:

#43376

</script>