diff --git a/gfx/layers/apz/test/mochitest/apz_test_native_event_utils.js b/gfx/layers/apz/test/mochitest/apz_test_native_event_utils.js index e858738c62ed..7f820a93667c 100644 --- a/gfx/layers/apz/test/mochitest/apz_test_native_event_utils.js +++ b/gfx/layers/apz/test/mochitest/apz_test_native_event_utils.js @@ -250,8 +250,12 @@ function synthesizeNativeClick(aElement, aX, aY, aObserver = null) { // We also wait for the mouse move event to be processed before sending the // wheel event, otherwise there is a chance they might get reordered, and // we have the transaction problem again. -function moveMouseAndScrollWheelOver(element, dx, dy, testDriver) { +function moveMouseAndScrollWheelOver(element, dx, dy, testDriver, waitForScroll = true) { return synthesizeNativeMouseMoveAndWaitForMoveEvent(element, dx, dy, function() { - synthesizeNativeWheelAndWaitForScrollEvent(element, dx, dy, 0, -10, testDriver); + if (waitForScroll) { + synthesizeNativeWheelAndWaitForScrollEvent(element, dx, dy, 0, -10, testDriver); + } else { + synthesizeNativeWheelAndWaitForWheelEvent(element, dx, dy, 0, -10, testDriver); + } }); } diff --git a/gfx/layers/apz/test/mochitest/helper_bug1271432.html b/gfx/layers/apz/test/mochitest/helper_bug1271432.html index c2e3237ef039..8234b82327d0 100644 --- a/gfx/layers/apz/test/mochitest/helper_bug1271432.html +++ b/gfx/layers/apz/test/mochitest/helper_bug1271432.html @@ -12,8 +12,7 @@ function* test(testDriver) { is(window.scrollY, 0, "Initial page scroll position should be 0"); is(scrollerPos, 0, "Initial scroller position should be 0"); - yield synthesizeNativeMouseMoveAndWaitForMoveEvent(scroller, dx, dy, testDriver); - yield synthesizeNativeWheelAndWaitForScrollEvent(scroller, dx, dy, 0, -10, testDriver); + yield moveMouseAndScrollWheelOver(scroller, dx, dy, testDriver); is(window.scrollY, 0, "Page scroll position should still be 0"); ok(scroller.scrollTop > scrollerPos, "Scroller should have scrolled"); @@ -24,10 +23,7 @@ function* test(testDriver) { }); scrollerPos = scroller.scrollTop; - // The mouse is already at the right position. If we call scrollWheelOver it - // hangs on windows waiting for the mouse-move, so instead we just synthesize - // the wheel directly. - yield synthesizeNativeWheelAndWaitForScrollEvent(scroller, dx, dy, 0, -10, testDriver); + yield moveMouseAndScrollWheelOver(scroller, dx, dy, testDriver); is(window.scrollY, 0, "Page scroll position should still be 0 after layerization"); ok(scroller.scrollTop > scrollerPos, "Scroller should have continued scrolling"); } diff --git a/gfx/layers/apz/test/mochitest/helper_scroll_on_position_fixed.html b/gfx/layers/apz/test/mochitest/helper_scroll_on_position_fixed.html index 12f9cb001bbc..b9d187faf6fe 100644 --- a/gfx/layers/apz/test/mochitest/helper_scroll_on_position_fixed.html +++ b/gfx/layers/apz/test/mochitest/helper_scroll_on_position_fixed.html @@ -30,10 +30,7 @@ function* test(testDriver) { flushApzRepaints(testDriver); }); scrollPos = fpos.scrollTop; - // The mouse is already at the right position. If we call moveMouseAndScrollWheelOver it - // hangs on windows waiting for the mouse-move, so instead we just synthesize - // the wheel directly. - yield synthesizeNativeWheelAndWaitForScrollEvent(fpos, 50, 150, 0, -10, testDriver); + yield moveMouseAndScrollWheelOver(fpos, 50, 150, testDriver); ok(fpos.scrollTop > scrollPos, "scrollable item inside fixed-pos element scrolled after layerization"); // same, but using the top-level window's position:sticky element diff --git a/gfx/layers/apz/test/mochitest/test_layerization.html b/gfx/layers/apz/test/mochitest/test_layerization.html index 5100f7375ac8..13af614328be 100644 --- a/gfx/layers/apz/test/mochitest/test_layerization.html +++ b/gfx/layers/apz/test/mochitest/test_layerization.html @@ -55,22 +55,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1173580 // Scroll the mouse wheel over |element|. function scrollWheelOver(element, waitForScroll, testDriver) { - var x = 10; - var y = 10; - // Move the mouse to the desired wheel location. - // Not doing so can result in the wheel events from two consecutive - // scrollWheelOver() calls on different elements being incorrectly considered - // as part of the same wheel transaction. - // We also wait for the mouse move event to be processed before sending the - // wheel event, otherwise there is a chance they might get reordered, and - // we have the transaction problem again. - synthesizeNativeMouseMoveAndWaitForMoveEvent(element, x, y, function() { - if (waitForScroll) { - synthesizeNativeWheelAndWaitForScrollEvent(element, x, y, 0, -10, testDriver); - } else { - synthesizeNativeWheelAndWaitForWheelEvent(element, x, y, 0, -10, testDriver); - } - }); + moveMouseAndScrollWheelOver(element, 10, 10, testDriver, waitForScroll); } var utils;