b=756425; fix test_mousescroll by driving RefreshDriver directly; r=ehsan
authorVladimir Vukicevic <vladimir@pobox.com>
Tue, 02 Oct 2012 14:41:04 -0400
changeset 109397 4e4f65c5f43b893ea1e097760496d0e609758985
parent 109396 e28ab3e5e961333b88f978ceffd7f27c360d19ca
child 109398 2bdb3c531c3ef4062edbb330c6a3dccbd416bcbc
push id23630
push useremorley@mozilla.com
push dateSat, 06 Oct 2012 19:35:27 +0000
treeherdermozilla-central@9f677c2bb33d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan
bugs756425
milestone18.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
b=756425; fix test_mousescroll by driving RefreshDriver directly; r=ehsan
toolkit/content/tests/chrome/test_mousescroll.xul
--- a/toolkit/content/tests/chrome/test_mousescroll.xul
+++ b/toolkit/content/tests/chrome/test_mousescroll.xul
@@ -130,49 +130,58 @@ function testListbox(id)
   });
 }
 
 function testRichListbox(id, andThen)
 {
   var listbox = document.getElementById(id);
   var tests = [];
 
+  var winUtils = SpecialPowers.getDOMWindowUtils(window);
+  winUtils.advanceTimeAndRefresh(100);
+
   function helper()
   {
     var [aStart, aDelta, aIntDelta, aDeltaMode] = tests[0];
     tests.shift();
     listbox.scrollToIndex(aStart);
     synthesizeWheel(listbox, 10, 10,
                     { deltaMode: aDeltaMode, deltaY: aDelta,
                       lineOrPageDeltaY: aIntDelta });
-    setTimeout(function() {
-      var change = listbox.getIndexOfFirstVisibleRow() - aStart;
-      var direction = (change > 0) - (change < 0);
-      var expected = (aDelta > 0) - (aDelta < 0);
-      is(direction, expected,
-       "testRichListbox(" + id +  "): vertical, starting " + aStart +
+
+    winUtils.advanceTimeAndRefresh(100);
+
+    var change = listbox.getIndexOfFirstVisibleRow() - aStart;
+    var direction = (change > 0) - (change < 0);
+    var expected = (aDelta > 0) - (aDelta < 0);
+    is(direction, expected,
+     "testRichListbox(" + id +  "): vertical, starting " + aStart +
+       " delta " + aDelta + " lineOrPageDelta " + aIntDelta +
+       " aDeltaMode " + aDeltaMode);
+
+    // Check that horizontal scrolling has no effect
+    listbox.scrollToIndex(aStart);
+    synthesizeWheel(listbox, 10, 10,
+                    { deltaMode: aDeltaMode, deltaX: aDelta,
+                      lineOrPageDeltaX: aIntDelta });
+
+    winUtils.advanceTimeAndRefresh(100);
+
+    is(listbox.getIndexOfFirstVisibleRow(), aStart,
+       "testRichListbox(" + id +  "): horizontal, starting " + aStart +
          " delta " + aDelta + " lineOrPageDelta " + aIntDelta +
          " aDeltaMode " + aDeltaMode);
 
-      // Check that horizontal scrolling has no effect
-      listbox.scrollToIndex(aStart);
-      synthesizeWheel(listbox, 10, 10,
-                      { deltaMode: aDeltaMode, deltaX: aDelta,
-                        lineOrPageDeltaX: aIntDelta });
-      setTimeout(function() {
-        is(listbox.getIndexOfFirstVisibleRow(), aStart,
-           "testRichListbox(" + id +  "): horizontal, starting " + aStart +
-             " delta " + aDelta + " lineOrPageDelta " + aIntDelta +
-             " aDeltaMode " + aDeltaMode);
-        if (tests.length)
-          helper();
-        else
-          andThen();
-      }, 20);
-    }, 20);
+    if (tests.length) {
+      winUtils.advanceTimeAndRefresh(100);
+      helper();
+    } else {
+      winUtils.restoreNormalRefresh();
+      andThen();
+    }
   }
 
   // richlistbox currently uses native XUL scrolling, so the "line"
   // amounts don't necessarily correspond 1-to-1 with listbox items. So
   // we just check that scrolling up/down scrolls in the right direction.
   deltaModes.forEach(function(aDeltaMode) {
     let delta = (aDeltaMode == WheelEvent.DOM_DELTA_PIXEL) ? 32.0 : 2.0;
     tests.push([5, -delta, -1, aDeltaMode]);