Bug 1523853 Part 3: Further relax the mousewheel test to not care about the ending scroll values. r=kats
authorBrad Werth <bwerth@mozilla.com>
Sat, 08 Feb 2020 20:15:16 +0000
changeset 512980 37ffe2e2412b1a3c33c41977d3e537161f150e85
parent 512979 ea0c8ca487f6e68e19495036d945b398059a6885
child 512981 dff38d5e834ad654a3109a6512ead06b95ba9ad6
push id37105
push userapavel@mozilla.com
push dateMon, 10 Feb 2020 09:39:12 +0000
treeherdermozilla-central@4c08723ed20a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskats
bugs1523853
milestone74.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1523853 Part 3: Further relax the mousewheel test to not care about the ending scroll values. r=kats This is being done to reduce the intermittent failures we see in this test. There are other non-intermittent tests that measure the specific number of pixels traveled by mousewheel events. The focus of this test seems to be "Ensure that mousewheel scrolling and zooming are mutually exclusive" and this change maintains that. Depends on D62067 Differential Revision: https://phabricator.services.mozilla.com/D62130
dom/events/test/test_bug574663.html
--- a/dom/events/test/test_bug574663.html
+++ b/dom/events/test/test_bug574663.html
@@ -43,18 +43,18 @@ function waitForPaint(win, utils, callba
   }
   win.addEventListener("MozAfterPaint", onpaint);
   if (utils.isTestControllingRefreshes) {
     utils.advanceTimeAndRefresh(0);
   }
 }
 
 // This is a magic number representing how many device pixels we are attempting to
-// scroll or zoom.  We use it for sending the wheel events, and for checking the
-// outcome of the events that are expected to trigger scrolling.
+// scroll or zoom.  We use it for sending the wheel events, but we don't actually
+// check that we have scrolled by that amount.
 var kDelta = 3;
 
 function sendTouchpadScrollMotion(scrollbox, direction, ctrl, momentum, callback) {
   var win = scrollbox.ownerDocument.defaultView;
   let winUtils = SpecialPowers.getDOMWindowUtils(win);
 
   let event = {
     deltaMode: WheelEvent.DOM_DELTA_PIXEL,
@@ -63,24 +63,25 @@ function sendTouchpadScrollMotion(scroll
     ctrlKey: ctrl,
     isMomentum: momentum
   };
 
   // Construct a promise that will resolve when either scroll or zoom has changed.
   // --- Intermittent Warning ---
   // Two wheel events are sent, but our promise resolves when any change has been
   // made to scroll or zoom. That makes it possible that the effect of the second
-  // event may not yet be applied when the promise resolves, which will lead to a
-  // failure when checking the expected value for scrolling. This was done
-  // intentionally, because attempting to wait after both events yields problems
-  // when the second event has no effect, which does happen in testing. It's
-  // not clear why this is happening. Since the testing pattern is scroll (twice),
-  // then scroll back (twice), it's possible that the first scroll back event is
-  // sufficient to return the scrollbox to its minimal scrollTop position, and
-  // therefore the second event doesn't scroll any further.
+  // event may not yet be applied when the promise resolves. This shouldn't lead
+  // to any errors, since the two wheel events are moving in the same direction,
+  // and our later checks will only ensure that the value has changed from its
+  // initial value. This was done intentionally, because attempting to wait after
+  // both events yields problems when the second event has no effect, which does
+  // happen in testing. It's not clear why this is happening. Since the testing
+  // pattern is scroll (twice), then scroll back (twice), it's possible that the
+  // first scroll back event is sufficient to return the scrollbox to its minimal
+  // scrollTop position, and so the second event doesn't scroll any further.
   const initialZoom = winUtils.fullZoom;
   const initialScroll = scrollbox.scrollTop;
 
   const effectOfWheelEvent = SimpleTest.promiseWaitForCondition(() => {
     return ((winUtils.fullZoom != initialZoom) || (scrollbox.scrollTop != initialScroll));
   }, "Mouse wheel should have caused us to either zoom or scroll.");
 
   synthesizeWheel(scrollbox, 10, 10, event, win);
@@ -138,25 +139,25 @@ function runTest() {
       let scrollTopBefore = scrollbox.scrollTop;
       let zoomFactorBefore = winUtils.fullZoom;
 
       let check = function() {
         if (!ctrlKey) {
           let postfix = isMomentum ? ", even after releasing the touchpad" : "";
           // Normal scroll: scroll
           is(winUtils.fullZoom, zoomFactorBefore, "Normal scrolling shouldn't change zoom" + postfix);
-          is(scrollbox.scrollTop, scrollTopBefore + kDelta * 2,
+          isnot(scrollbox.scrollTop, scrollTopBefore,
              "Normal scrolling should scroll" + postfix);
         } else {
           if (!isMomentum) {
             isnot(winUtils.fullZoom, zoomFactorBefore, "Ctrl-scrolling should zoom while the user is touching the touchpad");
             is(scrollbox.scrollTop, scrollTopBefore, "Ctrl-scrolling shouldn't scroll while the user is touching the touchpad");
           } else {
             is(winUtils.fullZoom, zoomFactorBefore, "Momentum scrolling shouldn't zoom, even when pressing Ctrl");
-            is(scrollbox.scrollTop, scrollTopBefore + kDelta * 2,
+            isnot(scrollbox.scrollTop, scrollTopBefore,
                "Momentum scrolling should scroll, even when pressing Ctrl");
           }
         }
 
         if (!outstandingTests.length) {
           winUtils.restoreNormalRefresh();
           win.close();
           SimpleTest.finish();