fix intermittency of child-document-raf-order test (#33480)

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>
This commit is contained in:
Gregory Terzian 2024-10-14 21:23:14 +08:00 committed by GitHub
parent cfd15dd14d
commit 9508b83af6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 26 additions and 4 deletions

View file

@ -703330,7 +703330,7 @@
},
"update-rendering": {
"child-document-raf-order.html": [
"222c1af444e5c3f7aab2ac466b6bd1a7e2c93e3e",
"eccc1bde7fb83449275ed61e0dacaeb13d684456",
[
null,
{}

View file

@ -47,6 +47,17 @@ callbacks for each.
<script>
// Split array into chunks of len.
function chunk (arr, len) {
var chunks = [],
i = 0,
n = arr.length;
while (i < n) {
chunks.push(arr.slice(i, i += len));
}
return chunks;
}
async_test(function (t) {
step_timeout(setup, 0);
@ -108,9 +119,20 @@ async_test(function (t) {
});
let finish = t.step_func(function() {
assert_array_equals(notification_sequence,
["parent_raf", "first_child_raf", "second_child_raf"],
"expected order of notifications");
// The test requests rafs recursively,
// but since all three rafs run as part of the same "update the rendering" task,
// they should always come in a triplet.
assert_equals(notification_sequence.length % 3, 0);
let chunks = chunk(notification_sequence, 3);
for (var i = 0; i < chunks.length; i++) {
// Assert correct ordering per triplet of rafs.
assert_array_equals(chunks[i],
["parent_raf", "first_child_raf", "second_child_raf"],
"expected order of notifications");
}
t.done();
});
});