Bug 1251837, part 4 - Use pushPrefEnv in doTestActionOverride in window_wheel_default_action.html. r=masayuki
authorAndrew McCreight <continuation@gmail.com>
Mon, 29 Feb 2016 05:42:56 -0800
changeset 322431 ce44f62a57b9ff627a6b22256a18736d4847ce8c
parent 322430 77c018b57e8cbae71c7dddba33131d22a733bd19
child 322432 ea8a0ba359a26c9a5404b191938070be32bc2bbc
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 4 - Use pushPrefEnv in doTestActionOverride in window_wheel_default_action.html. 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
@@ -1709,22 +1709,30 @@ function doTestActionOverride(aCallback)
     },
   ];
 
   var index = 0;
 
   function doIt()
   {
     const kTest = kTests[index];
+    SpecialPowers.pushPrefEnv({"set": [
+      ["mousewheel.default.action", kTest.action],
+      ["mousewheel.default.action.override_x", kTest.override_x]]},
+      doIt2
+    );
+  }
+
+  function doIt2()
+  {
+    const kTest = kTests[index];
     description = "doTestActionOverride(action=" + kTest.action + ", " +
                   "override_x=" + kTest.override_x + ", " +
                   "deltaX=" + kTest.event.deltaX + ", " +
                   "deltaY=" + kTest.event.deltaY + "): ";
-    SpecialPowers.setIntPref("mousewheel.default.action", kTest.action);
-    SpecialPowers.setIntPref("mousewheel.default.action.override_x", kTest.override_x);
     gScrollableElement.scrollTop = 1000;
     gScrollableElement.scrollLeft = 1000;
     sendWheelAndWait(10, 10, kTest.event, function () {
       if (kTest.expected & kScrollUp) {
         ok(gScrollableElement.scrollTop < 1000, description + "not scrolled up, got " + gScrollableElement.scrollTop);
       } else if (kTest.expected & kScrollDown) {
         ok(gScrollableElement.scrollTop > 1000, description + "not scrolled down, got " + gScrollableElement.scrollTop);
       } else {
@@ -1733,18 +1741,16 @@ function doTestActionOverride(aCallback)
       if (kTest.expected & kScrollLeft) {
         ok(gScrollableElement.scrollLeft < 1000, description + "not scrolled to left, got " + gScrollableElement.scrollLeft);
       } else if (kTest.expected & kScrollRight) {
         ok(gScrollableElement.scrollLeft > 1000, description + "not scrolled to right, got " + gScrollableElement.scrollLeft);
       } else {
         is(gScrollableElement.scrollLeft, 1000, description + "scrolled horizontal");
       }
       if (++index == kTests.length) {
-        SpecialPowers.setIntPref("mousewheel.default.action", 1);
-        SpecialPowers.setIntPref("mousewheel.default.action.override_x", -1);
         SimpleTest.executeSoon(aCallback);
       } else {
         doIt();
       }
     }, 20);
   }
   doIt();
 }
@@ -1811,17 +1817,16 @@ function runTests2()
     });
   }
   doTest();
 }
 
 function finishTests()
 {
   SpecialPowers.clearUserPref("mousewheel.default.action");
-  SpecialPowers.clearUserPref("mousewheel.default.action.override_x");
 
   winUtils.restoreNormalRefresh();
 
   window.opener.finish();
 }
 
 </script>
 </pre>