diff options
Diffstat (limited to 'dom/events/test')
-rw-r--r-- | dom/events/test/pointerevents/mochitest.toml | 1 | ||||
-rw-r--r-- | dom/events/test/pointerevents/test_getCoalescedEvents.html | 43 | ||||
-rw-r--r-- | dom/events/test/test_dom_storage_event.html | 4 |
3 files changed, 25 insertions, 23 deletions
diff --git a/dom/events/test/pointerevents/mochitest.toml b/dom/events/test/pointerevents/mochitest.toml index c22e1bdf94..8d6990d4ff 100644 --- a/dom/events/test/pointerevents/mochitest.toml +++ b/dom/events/test/pointerevents/mochitest.toml @@ -64,7 +64,6 @@ support-files = ["!/gfx/layers/apz/test/mochitest/apz_test_native_event_utils.js skip-if = [ "os == 'android'", # Bug 1312791 "display == 'wayland' && os_version == '22.04'", # Bug 1856971 - "verify && os == 'win'", # Bug 1659744 ] ["test_getCoalescedEvents_touch.html"] diff --git a/dom/events/test/pointerevents/test_getCoalescedEvents.html b/dom/events/test/pointerevents/test_getCoalescedEvents.html index 69eeac6919..9c0c0c5baa 100644 --- a/dom/events/test/pointerevents/test_getCoalescedEvents.html +++ b/dom/events/test/pointerevents/test_getCoalescedEvents.html @@ -18,14 +18,16 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1303957 /** Test for Bug 1303957 **/ SimpleTest.waitForExplicitFinish(); -function runTests() { - let target0 = window.document.getElementById("target0"); - let utils = SpecialPowers.getDOMWindowUtils(window); +SimpleTest.waitForFocus(async () => { + await SpecialPowers.pushPrefEnv({"set": [["dom.events.coalesce.mousemove", true]]}); + + const target0 = window.document.getElementById("target0"); + const utils = SpecialPowers.getDOMWindowUtils(window); utils.advanceTimeAndRefresh(0); - SimpleTest.executeSoon(async () => { - // Flush all pending mouse events before synthesizing events. + await new Promise(resolve => SimpleTest.executeSoon(resolve)); + const waitForPointerMove = new Promise(resolve => { target0.addEventListener("pointermove", (ev) => { let length = ev.getCoalescedEvents().length; ok(length >= 1, "Coalesced events should >= 1, got " + length); @@ -49,11 +51,11 @@ function runTests() { ok(coalescedEvent.offsetX >= prevOffsetX, "getCoalescedEvents()[" + i + "].offsetX = " + coalescedEvent.offsetX); ok(coalescedEvent.offsetX == 5 || coalescedEvent.offsetX == 10 || - coalescedEvent.offsetX == 15 || coalescedEvent.offsetX == 20, "expected offsetX"); + coalescedEvent.offsetX == 15 || coalescedEvent.offsetX == 20, "expected offsetX"); ok(coalescedEvent.offsetY >= prevOffsetY, "getCoalescedEvents()[" + i + "].offsetY = " + coalescedEvent.offsetY); ok(coalescedEvent.offsetY == 5 || coalescedEvent.offsetY == 10 || - coalescedEvent.offsetY == 15 || coalescedEvent.offsetY == 20, "expected offsetY"); + coalescedEvent.offsetY == 15 || coalescedEvent.offsetY == 20, "expected offsetY"); prevOffsetX = coalescedEvent.offsetX; prevOffsetY = coalescedEvent.offsetY; @@ -64,23 +66,24 @@ function runTests() { ok((coalescedEvent.clientX <= x+2) && (coalescedEvent.clientX >= x-2), "getCoalescedEvents()[" + i + "].clientX"); ok((coalescedEvent.clientY <= y+2) && (coalescedEvent.clientY >= y-2), "getCoalescedEvents()[" + i + "].clientY"); } + resolve(); }, { once: true }); + }); - target0.addEventListener("pointerup", (ev) => { - utils.restoreNormalRefresh(); - SimpleTest.finish(); - }, { once: true }); + info("Synthesizing native mouse moves...."); + await promiseNativeMouseEvent({ type: "mousemove", target: target0, offsetX: 5, offsetY: 5 }); + await promiseNativeMouseEvent({ type: "mousemove", target: target0, offsetX: 10, offsetY: 10 }); + await promiseNativeMouseEvent({ type: "mousemove", target: target0, offsetX: 15, offsetY: 15 }); + await promiseNativeMouseEvent({ type: "mousemove", target: target0, offsetX: 20, offsetY: 20 }); + utils.restoreNormalRefresh(); + await waitForPointerMove; - await promiseNativeMouseEvent({ type: "mousemove", target: target0, offsetX: 5, offsetY: 5 }); - await promiseNativeMouseEvent({ type: "mousemove", target: target0, offsetX: 10, offsetY: 10 }); - await promiseNativeMouseEvent({ type: "mousemove", target: target0, offsetX: 15, offsetY: 15 }); - await promiseNativeMouseEvent({ type: "mousemove", target: target0, offsetX: 20, offsetY: 20 }); - synthesizeNativeMouseEvent({ type: "click", target: target0, offsetX: 20, offsetY: 20 }); - }); -} + target0.addEventListener("pointerup", (ev) => { + SimpleTest.finish(); + }, { once: true }); -SimpleTest.waitForFocus(() => { - SpecialPowers.pushPrefEnv({"set": [["dom.events.coalesce.mousemove", true]]}, runTests); + info("Synthesizing a native click...."); + synthesizeNativeMouseEvent({ type: "click", target: target0, offsetX: 20, offsetY: 20 }); }); </script> diff --git a/dom/events/test/test_dom_storage_event.html b/dom/events/test/test_dom_storage_event.html index 88cc288d41..ce9db0dc7f 100644 --- a/dom/events/test/test_dom_storage_event.html +++ b/dom/events/test/test_dom_storage_event.html @@ -28,7 +28,7 @@ const kTests = [ { createEventArg: "storageEvent", type: "ddd", bubbles: false, cancelable: false, - key: 'key', oldValue: 'a', newValue: 'b', url: null, storageArea: null }, + key: 'key', oldValue: 'a', newValue: 'b', url: '', storageArea: null }, { createEventArg: "StorageEvent", type: "eee", bubbles: true, cancelable: true, @@ -36,7 +36,7 @@ const kTests = [ { createEventArg: "storageevent", type: "fff", bubbles: false, cancelable: true, - key: null, oldValue: null, newValue: null, url: null, storageArea: null }, + key: null, oldValue: null, newValue: null, url: '', storageArea: null }, ]; for (var i = 0; i < kTests.length; i++) { |