Bug 1251837, part 6 - Make cleanup() in doTestScroll take a callback, and use pushPrefEnv. r=masayuki
authorAndrew McCreight <continuation@gmail.com>
Mon, 29 Feb 2016 05:42:56 -0800
changeset 322433 c7ffc4e71ecb8732c4c25721b1a318ac7cf247d9
parent 322432 ea8a0ba359a26c9a5404b191938070be32bc2bbc
child 322434 29e1faddbf53b86bf94f7554fe30c3f03f715cfe
push id5913
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 16:57:49 +0000
treeherdermozilla-beta@dcaf0a6fa115 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmasayuki
bugs1251837
milestone47.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 1251837, part 6 - Make cleanup() in doTestScroll take a callback, and use pushPrefEnv. r=masayuki
dom/events/test/window_wheel_default_action.html
--- a/dom/events/test/window_wheel_default_action.html
+++ b/dom/events/test/window_wheel_default_action.html
@@ -500,17 +500,17 @@ function doTestScroll(aSettings, aCallba
     { description: "Not Scroll by momentum pixel scroll if default action is none (action is zoom)",
       event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
                deltaX: 0.0, deltaY: 0.0, deltaZ: 1.0,
                lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: true,
                expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
                shiftKey: false, ctrlKey: true, altKey: false, metaKey: false, osKey: false },
       expected: kNoScroll,
       prepare: function (cb) { SpecialPowers.pushPrefEnv({"set": [["mousewheel.default.action", 0]]}, cb); },
-      cleanup: function () { SpecialPowers.setIntPref("mousewheel.default.action", 1); } },
+      cleanup: function (cb) { SpecialPowers.pushPrefEnv({"set": [["mousewheel.default.action", 1]]}, cb); } },
 
     // momentum scroll should cause scroll even if the action is history, but if the default action is none,
     // shouldn't do it.
     { description: "Scroll to bottom by momentum pixel scroll when lineOrPageDelta is 0, even if the action is history",
       event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
                deltaX: 0.0, deltaY: 8.0, deltaZ: 0.0,
                lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: true,
                expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
@@ -603,17 +603,17 @@ function doTestScroll(aSettings, aCallba
     { description: "Not Scroll by momentum pixel scroll if default action is none (action is history)",
       event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
                deltaX: 0.0, deltaY: 0.0, deltaZ: 1.0,
                lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: true,
                expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
                shiftKey: true, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
       expected: kNoScroll,
       prepare: function (cb) { SpecialPowers.pushPrefEnv({"set": [["mousewheel.default.action", 0]]}, cb); },
-      cleanup: function () { SpecialPowers.setIntPref("mousewheel.default.action", 1); } },
+      cleanup: function (cb) { SpecialPowers.pushPrefEnv({"set": [["mousewheel.default.action", 1]]}, cb); } },
 
     // Don't scroll along axis whose overflow style is hidden.
     { description: "Scroll to only bottom by oblique pixel wheel event with overflow-x: hidden",
       event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
                deltaX: 16.0, deltaY: 16.0, deltaZ: 0.0,
                lineOrPageDeltaX: 1, lineOrPageDeltaY: 1,
                expectedOverflowDeltaX: 1, expectedOverflowDeltaY: 0,
                shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
@@ -649,17 +649,17 @@ function doTestScroll(aSettings, aCallba
       expected: kScrollUp },
     { description: "Scroll to only top by oblique page wheel event with overflow-x: hidden",
       event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
                deltaX: -1.0, deltaY: -1.0, deltaZ: 0.0,
                lineOrPageDeltaX: -1, lineOrPageDeltaY: -1,
                expectedOverflowDeltaX: -1, expectedOverflowDeltaY: 0,
                shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
       expected: kScrollUp,
-      cleanup: function () { gScrollableElement.style.overflowX = "auto"; } },
+      cleanup: function (cb) { gScrollableElement.style.overflowX = "auto"; cb(); } },
     { description: "Scroll to only right by oblique pixel wheel event with overflow-y: hidden",
       event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
                deltaX: 16.0, deltaY: 16.0, deltaZ: 0.0,
                lineOrPageDeltaX: 1, lineOrPageDeltaY: 1,
                expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 1,
                shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
       expected: kScrollRight,
       prepare: function(cb) { gScrollableElement.style.overflowY = "hidden"; cb(); } },
@@ -693,17 +693,17 @@ function doTestScroll(aSettings, aCallba
       expected: kScrollLeft },
     { description: "Scroll to only top by oblique page wheel event with overflow-y: hidden",
       event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
                deltaX: -1.0, deltaY: -1.0, deltaZ: 0.0,
                lineOrPageDeltaX: -1, lineOrPageDeltaY: -1,
                expectedOverflowDeltaX: 0, expectedOverflowDeltaY: -1,
                shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
       expected: kScrollLeft,
-      cleanup: function () { gScrollableElement.style.overflowY = "auto"; } },
+      cleanup: function (cb) { gScrollableElement.style.overflowY = "auto"; cb(); } },
     { description: "Don't be scrolled by oblique pixel wheel event with overflow: hidden",
       event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
                deltaX: 16.0, deltaY: 16.0, deltaZ: 0.0,
                lineOrPageDeltaX: 1, lineOrPageDeltaY: 1,
                expectedOverflowDeltaX: 1, expectedOverflowDeltaY: 1,
                shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
       expected: kNoScroll,
       prepare: function(cb) { gScrollableElement.style.overflow = "hidden"; cb(); } },
@@ -737,17 +737,17 @@ function doTestScroll(aSettings, aCallba
       expected: kNoScroll },
     { description: "Don't be scrolled by oblique page wheel event with overflow: hidden",
       event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
                deltaX: -1.0, deltaY: -1.0, deltaZ: 0.0,
                lineOrPageDeltaX: -1, lineOrPageDeltaY: -1,
                expectedOverflowDeltaX: -1, expectedOverflowDeltaY: -1,
                shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
       expected: kNoScroll,
-      cleanup: function () { gScrollableElement.style.overflow = "auto"; } },
+      cleanup: function (cb) { gScrollableElement.style.overflow = "auto"; cb(); } },
 
     // Don't scroll along axis whose overflow style is hidden and overflow delta values should
     // be zero if there is ancestor scrollable element.
     { description: "Scroll to only bottom by oblique pixel wheel event with overflow-x: hidden (body is scrollable)",
       event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
                deltaX: 16.0, deltaY: 16.0, deltaZ: 0.0,
                lineOrPageDeltaX: 1, lineOrPageDeltaY: 1,
                expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
@@ -794,17 +794,17 @@ function doTestScroll(aSettings, aCallba
       expected: kScrollUp },
     { description: "Scroll to only top by oblique page wheel event with overflow-x: hidden (body is scrollable)",
       event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
                deltaX: -1.0, deltaY: -1.0, deltaZ: 0.0,
                lineOrPageDeltaX: -1, lineOrPageDeltaY: -1,
                expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
                shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
       expected: kScrollUp,
-      cleanup: function () { gScrollableElement.style.overflowX = "auto"; } },
+      cleanup: function (cb) { gScrollableElement.style.overflowX = "auto"; cb(); } },
     { description: "Scroll to only right by oblique pixel wheel event with overflow-y: hidden (body is scrollable)",
       event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
                deltaX: 16.0, deltaY: 16.0, deltaZ: 0.0,
                lineOrPageDeltaX: 1, lineOrPageDeltaY: 1,
                expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
                shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
       expected: kScrollRight,
       prepare: function(cb) { gScrollableElement.style.overflowY = "hidden"; cb(); } },
@@ -838,21 +838,22 @@ function doTestScroll(aSettings, aCallba
       expected: kScrollLeft },
     { description: "Scroll to only top by oblique page wheel event with overflow-y: hidden (body is scrollable)",
       event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
                deltaX: -1.0, deltaY: -1.0, deltaZ: 0.0,
                lineOrPageDeltaX: -1, lineOrPageDeltaY: -1,
                expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
                shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
       expected: kScrollLeft,
-      cleanup: function () {
+      cleanup: function (cb) {
         gScrollableElement.style.overflowY = "auto";
         gScrollableElement.style.position = "static";
         gSpacerForBodyElement.style.width = "";
         gSpacerForBodyElement.style.height = "";
+        cb();
       } },
   ];
 
   var description;
 
   var currentTestIndex = -1;
   var isXReverted = (aSettings.deltaMultiplierX < 0);
   var isYReverted = (aSettings.deltaMultiplierY < 0);
@@ -902,20 +903,25 @@ function doTestScroll(aSettings, aCallba
           ok(gScrollableElement.scrollLeft < 1000, description + "not scrolled to left, got " + gScrollableElement.scrollLeft);
         } else if (scrollRight) {
           ok(gScrollableElement.scrollLeft > 1000, description + "not scrolled to right, got " + gScrollableElement.scrollLeft);
         } else {
           is(gScrollableElement.scrollLeft, 1000, description + "scrolled horizontal");
         }
       }
       if (currentTest.cleanup) {
-        currentTest.cleanup();
+        currentTest.cleanup(nextStep);
+      } else {
+        nextStep();
       }
-      winUtils.advanceTimeAndRefresh(100);
-      doNextTest();
+
+      function nextStep() {
+        winUtils.advanceTimeAndRefresh(100);
+        doNextTest();
+      }
     }, 10);
   }
   doNextTest();
 }
 
 function doTestZoom(aSettings, aCallback)
 {
   if ((aSettings.deltaMultiplierX != 1.0  && aSettings.deltaMultiplierX != -1.0) ||