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
authorZhang Junzhi <zjz@zjz.name>
Tue, 03 Apr 2018 20:23:19 +0800
changeset 413089 6cbf314341e7d9fbc4f7ff4dcbe1c60beace0715
parent 413088 6f644cb57eb3737f3d693d290ca3f64ddb0b9687
child 413090 ba90e25685c640fdb9d531397032d6d52c72a998
push id33833
push useraiakab@mozilla.com
push dateFri, 13 Apr 2018 09:41:15 +0000
treeherdermozilla-central@260e4c83c8a9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmasayuki
bugs1358017
milestone61.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 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,31 @@ function runTests()
   var ret = gTestContinuation.next();
   if (ret.done) {
     var winUtils = SpecialPowers.getDOMWindowUtils(window);
     winUtils.restoreNormalRefresh();
     SimpleTest.finish();
   }
 }
 
+async 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.
+  await 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
@@ -167,18 +167,26 @@ gRootView.addEventListener("MozMouseScro
 gRootView.addEventListener("MozMouseScrollTransactionTimeout",
                            onTransactionTimeout, false);
 
 function finish()
 {
   window.close();
 }
 
-function onload()
+async function onload()
 {
+  // 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.
+  await SpecialPowers.pushPrefEnv({"set": [["mousewheel.autodir.enabled",
+                                            false]]});
+
   runNextTestList();
 }
 
 function onunload()
 {
   resetTimeoutPrefs();
   gPrefSvc.clearUserPref(kPrefSmoothScroll);
   gPrefSvc.clearUserPref(kPrefTestEventsAsyncEnabled);