Bug 1358017 - Part 9: Updates some existing mochitests which are not meant to test default actions for wheel events but are affected by auto-dir scrolling. r?masayuki draft
authorZhang Junzhi <zjz@zjz.name>
Tue, 03 Apr 2018 20:23:19 +0800
changeset 776598 9eef645583a90801dbaedbf3e5deff4f239d8525
parent 776536 f8d2f31ea7c5b586560f7fc3799e0340c5015a0f
push id104917
push userbmo:zjz@zjz.name
push dateTue, 03 Apr 2018 12:34:43 +0000
reviewersmasayuki
bugs1358017
milestone61.0a1
Bug 1358017 - Part 9: Updates some existing mochitests which are not meant to test default actions for wheel events but are affected by auto-dir scrolling. r?masayuki Some mochitests are not meant to test default actions for wheel events, but they assume audo-dir is disabled when doing tests for their purposes, so this commit disables auto-dir for those mochitests. MozReview-Commit-ID: 5ZQIxgRVpj5
toolkit/content/tests/chrome/test_mousescroll.xul
widget/tests/window_wheeltransaction.xul
--- a/toolkit/content/tests/chrome/test_mousescroll.xul
+++ b/toolkit/content/tests/chrome/test_mousescroll.xul
@@ -74,17 +74,17 @@ https://bugzilla.mozilla.org/show_bug.cg
   </arrowscrollbox>
 
   <!-- test code goes here -->
   <script type="application/javascript"><![CDATA[
 
 /** Test for Bug 378028 **/
 /*   and for Bug 350471 **/
 SimpleTest.waitForExplicitFinish();
-SimpleTest.waitForFocus(runTests);
+SimpleTest.waitForFocus(prepareRunningTests);
 
 const IS_MAC = navigator.platform.indexOf("Mac") == 0;
 
 // Some tests need to wait until stopping scroll completely.  At this time,
 // setTimeout() will retry to check up to MAX_RETRY_COUNT times.
 const MAX_RETRY_COUNT = 5;
 
 const deltaModes = [
@@ -338,16 +338,29 @@ function runTests()
   var ret = gTestContinuation.next();
   if (ret.done) {
     var winUtils = SpecialPowers.getDOMWindowUtils(window);
     winUtils.restoreNormalRefresh();
     SimpleTest.finish();
   }
 }
 
+function prepareRunningTests()
+{
+  // Before actually running tests, we disable auto-dir scrolling, becasue the
+  // horizontal scrolling tests in this file are mostly meant to ensure that the
+  // tested controls in the default style should only have one scrollbar and it
+  // must always be in the block-flow direction so they are not really meant to
+  // test default actions for wheel events, so we simply disabled auto-dir
+  // scrolling, which are well tested in
+  // dom/events/test/window_wheel_default_action.html.
+  SpecialPowers.pushPrefEnv({"set": [["mousewheel.autodir.enabled", false]]},
+                            runTests);
+}
+
 function* testBody()
 {
   yield* testRichListbox("richlistbox");
   yield* testListbox("listbox");
   yield* testArrowScrollbox("hscrollbox");
   yield* testArrowScrollbox("vscrollbox");
 }
 
--- a/widget/tests/window_wheeltransaction.xul
+++ b/widget/tests/window_wheeltransaction.xul
@@ -169,17 +169,23 @@ gRootView.addEventListener("MozMouseScro
 
 function finish()
 {
   window.close();
 }
 
 function onload()
 {
-  runNextTestList();
+  // Before actually running tests, we disable auto-dir scrolling, becasue the
+  // tests in this file are meant to test scrolling transactions, not meant to
+  // test default actions for wheel events, so we simply disabled auto-dir
+  // scrolling, which are well tested in
+  // dom/events/test/window_wheel_default_action.html.
+  SpecialPowers.pushPrefEnv({"set": [["mousewheel.autodir.enabled", false]]},
+                            runNextTestList);
 }
 
 function onunload()
 {
   resetTimeoutPrefs();
   gPrefSvc.clearUserPref(kPrefSmoothScroll);
   gPrefSvc.clearUserPref(kPrefTestEventsAsyncEnabled);
   disableNonTestMouseEvents(false);