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
--- 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);