function test() { const kPrefName_AutoScroll = "general.autoScroll"; Services.prefs.setBoolPref(kPrefName_AutoScroll, true); const expectScrollNone = 0; const expectScrollVert = 1; const expectScrollHori = 2; const expectScrollBoth = 3; var allTests = [ {elem: 'a', expected: expectScrollNone}, {elem: 'b', expected: expectScrollBoth}, {elem: 'c', expected: expectScrollHori}, {elem: 'd', expected: expectScrollVert}, {elem: 'e', expected: expectScrollVert}, {elem: 'f', expected: expectScrollNone}, {elem: 'g', expected: expectScrollBoth} ]; var doc; function nextTest() { var test = allTests.shift(); if (!test) { endTest(); return; } var elem = doc.getElementById(test.elem); EventUtils.synthesizeMouse(elem, 50, 50, { button: 1 }, gBrowser.contentWindow); EventUtils.synthesizeMouse(elem, 100, 100, { type: "mousemove", clickCount: "0" }, gBrowser.contentWindow); // the autoscroll implementation uses a 20ms interval // wait for 40ms to make sure it did autoscroll at least once setTimeout(function () { EventUtils.synthesizeKey("VK_ESCAPE", {}, gBrowser.contentWindow); var scrollVert = test.expected & expectScrollVert; ok((scrollVert && elem.scrollTop > 0) || (!scrollVert && elem.scrollTop == 0), test.elem+' should'+(scrollVert ? '' : ' not')+' have scrolled vertically'); var scrollHori = test.expected & expectScrollHori; ok((scrollHori && elem.scrollLeft > 0) || (!scrollHori && elem.scrollLeft == 0), test.elem+' should'+(scrollHori ? '' : ' not')+' have scrolled horizontally'); nextTest(); }, 40); } waitForExplicitFinish(); var dataUri = 'data:text/html,
\