Bug 1781618 - Make `test_bug620906.html` try to click scrollbar multiple times r=smaug

Differential Revision: https://phabricator.services.mozilla.com/D199303
This commit is contained in:
Masayuki Nakano 2024-01-23 11:35:22 +00:00
Родитель 2594dc03cd
Коммит 0695aa49fe
2 изменённых файлов: 27 добавлений и 13 удалений

Просмотреть файл

@ -165,9 +165,6 @@ support-files = [
["test_bug612447.html"]
["test_bug620906.html"]
skip-if = ["os == 'android'"] #TIMED_OUT
["test_bug622371.html"]
["test_bug625452.html"]
@ -430,6 +427,9 @@ skip-if = ["os == 'android'"] #Bug 1575739
["test_defaultParagraphSeparatorBR_between_blocks.html"]
["test_doc_scrollbar_toggled_designMode_on_mousedown.html"]
skip-if = ["os == 'android'"] # Needs interaction with the scrollbar
["test_dom_input_event_on_htmleditor.html"]
["test_dom_input_event_on_texteditor.html"]

Просмотреть файл

@ -29,19 +29,33 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=620906
/** Test for Bug 620906 **/
SimpleTest.waitForExplicitFinish();
addLoadEvent(function() {
var iframe = document.querySelector("iframe");
SimpleTest.waitForFocus(async () => {
const iframe = document.querySelector("iframe");
is(iframe.contentWindow.scrollY, 0, "Sanity check");
var rect = iframe.getBoundingClientRect();
setTimeout(function() {
var onscroll = function() {
iframe.contentWindow.removeEventListener("scroll", onscroll);
const rect = iframe.getBoundingClientRect();
const waitForTick = () => {
return new Promise(resolve => requestAnimationFrame(
() => requestAnimationFrame(resolve))
);
};
await waitForTick();
let scrollEventFired = false;
iframe.contentWindow.addEventListener("scroll", () => {
scrollEventFired = true;
}, {once: true});
for (let i = 0; i < 10; i++) {
synthesizeMouse(iframe, rect.width - 4, rect.height / 2, { type: "mousemove" });
synthesizeMouse(iframe, rect.width - 5, rect.height / 2, { type: "mousemove" });
synthesizeMouse(iframe, rect.width - 5, rect.height / 2, {});
await waitForTick();
if (scrollEventFired) {
isnot(iframe.contentWindow.scrollY, 0, "The scrollbar should work");
SimpleTest.finish();
};
iframe.contentWindow.addEventListener("scroll", onscroll);
synthesizeMouse(iframe, rect.width - 5, rect.height / 2, {});
}, 0);
return;
}
}
ok(false, "The scrollbar didn't work");
SimpleTest.finish();
});
</script>