mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 22:01:30 +00:00
Bug 1278268 - Simplify some test code to use the moveMouseAndScrollWheelOver function. r=botond
MozReview-Commit-ID: KyIvCSpBQTi --HG-- extra : rebase_source : c51dd1d3fa03a674c7233a42bc12233fef2260b2
This commit is contained in:
parent
bea6d03a52
commit
d168d92285
@ -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);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -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");
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user