b=756425; fix test_mousescroll by driving RefreshDriver directly; r=ehsan a=test-only
authorVladimir Vukicevic <vladimir@pobox.com>
Tue, 02 Oct 2012 14:41:04 -0400
changeset 109534 99b36c93b6b63d8b14b2be68d67fab6a53dfda9e
parent 109533 f512f07621f9117876fdcab91323ae0f03865d65
child 109535 d4e1fae8b14537cd7f98259125f7311dc9b5a3f1
push id1521
push useremorley@mozilla.com
push dateMon, 15 Oct 2012 12:39:29 +0000
treeherdermozilla-beta@afc6700e5c00 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan, test-only
bugs756425
milestone17.0
b=756425; fix test_mousescroll by driving RefreshDriver directly; r=ehsan a=test-only
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]);