Skip to content

Commit

Permalink
Remove waiting for focus change that didn't fix test flakiness.
Browse files Browse the repository at this point in the history
This reverts the two previous changes to this test, to wait longer for a
focus change, because they didn't fix the test being flaky in Chromium
CI.

Bug: 332068449
Change-Id: Ib0c21a236044af0eee2bff2f4b24e5f1f90de867
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5463426
Commit-Queue: Di Zhang <dizhangg@chromium.org>
Reviewed-by: Di Zhang <dizhangg@chromium.org>
Auto-Submit: David Baron <dbaron@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1288976}
  • Loading branch information
dbaron authored and chromium-wpt-export-bot committed Apr 17, 2024
1 parent 2464208 commit 98177f3
Showing 1 changed file with 17 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,35 +21,27 @@
const innerIFrame = outerIFrame.contentDocument.createElement("iframe");

window.onmessage = function() {
// We receive an message when the innerIFrame is ready and its input is focused.
// outerIframe is the ancestor of inner iframe, so the activeElement of
// it should be the inner iframe.
assert_equals(outerIFrame.contentDocument.activeElement, innerIFrame,
"The activeElement of the outer iframe should be the inner iframe");

// Now we focus the input in the top level
document.querySelector("input").focus();

// Wait for a bit to let whatever the code that might change the focus to run
window.requestAnimationFrame(function() {
window.requestAnimationFrame(function() {
window.requestAnimationFrame(function() {

// We receive an message when the innerIFrame is ready and its input is focused.
// outerIframe is the ancestor of inner iframe, so the activeElement of
// it should be the inner iframe.
assert_equals(outerIFrame.contentDocument.activeElement, innerIFrame,
"The activeElement of the outer iframe should be the inner iframe");

// Now we focus the input in the top level
document.querySelector("input").focus();

// Wait for a bit to let whatever the code that might change the focus to run
window.requestAnimationFrame(function() {
window.requestAnimationFrame(function() {
window.requestAnimationFrame(function() {
// Since inner iframe lost its focus, the activeElement of outer iframe
// should be cleared as well, hence <body> should be focused.
assert_equals(outerIFrame.contentDocument.activeElement, outerIFrame.contentDocument.body,
"The activeElement of the outer iframe should be reverted back to <body>");
assert_equals(document.activeElement, document.querySelector("input"),
"The activeElement of the top-level document should the input");
done();
});
});
});
});
// Since inner iframe lost its focus, the activeElement of outer iframe
// should be cleared as well, hence <body> should be focused.
assert_equals(outerIFrame.contentDocument.activeElement, outerIFrame.contentDocument.body,
"The activeElement of the outer iframe should be reverted back to <body>");
assert_equals(document.activeElement, document.querySelector("input"),
"The activeElement of the top-level document should the input");
done();
})
});
});
}
Expand Down

0 comments on commit 98177f3

Please sign in to comment.