Make test_bug422132.html compatible with APZ. (bug 1149128, r=kats)
authorDavid Anderson <danderson@mozilla.com>
Wed, 15 Apr 2015 16:41:26 -0400
changeset 258324 e4d3753af8a2a3ae8d28469e4e191c27cf499343
parent 258323 8732f95f12f0ae501e7826d16da39a329c1e14d9
child 258325 b49fbd3ad1b1d8c6611c12cfdd052558387716dd
push id8007
push userraliiev@mozilla.com
push dateMon, 11 May 2015 19:23:16 +0000
treeherdermozilla-aurora@e2ce1aac996e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskats
bugs422132, 1149128
milestone40.0a1
Make test_bug422132.html compatible with APZ. (bug 1149128, r=kats)
dom/events/test/test_bug422132.html
--- a/dom/events/test/test_bug422132.html
+++ b/dom/events/test/test_bug422132.html
@@ -3,16 +3,17 @@
 <!--
 https://bugzilla.mozilla.org/show_bug.cgi?id=422132
 -->
 <head>
   <title>Test for Bug 422132</title>
   <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
   <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
   <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
+  <script type="text/javascript" src="/tests/SimpleTest/paint_listener.js"></script>
   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
 </head>
 <body>
 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=422132">Mozilla Bug 422132</a>
 <p id="display"></p>
 <div id="target" style="font-size: 0; width: 200px; height: 200px; overflow: auto;">
   <div style="width: 1000px; height: 1000px;"></div>
 </div>
@@ -20,110 +21,103 @@ https://bugzilla.mozilla.org/show_bug.cg
   
 </div>
 <pre id="test">
 <script class="testbody" type="text/javascript">
 
 /** Test for Bug 422132 **/
 
 SimpleTest.waitForExplicitFinish();
-SimpleTest.requestFlakyTimeout("untriaged");
 SimpleTest.waitForFocus(function() {
   SpecialPowers.pushPrefEnv({
     "set":[["general.smoothScroll", false],
            ["mousewheel.min_line_scroll_amount", 1],
+           ["mousewheel.system_scroll_override_on_root_content.enabled", false],
            ["mousewheel.transaction.timeout", 100000]]}, runTests)}, window);
 
-function hitEventLoop(aFunc, aTimes)
-{
-  if (--aTimes) {
-    setTimeout(hitEventLoop, 0, aFunc, aTimes);
-  } else {
-    setTimeout(aFunc, 20);
-  }
-}
-
 function runTests()
 {
   var target = document.getElementById("target");
 
   var scrollLeft = target.scrollLeft;
   var scrollTop = target.scrollTop;
 
   var tests = [
     {
+      prepare: function() {
+        scrollLeft = target.scrollLeft;
+        scrollTop = target.scrollTop;
+      },
       event: {
         deltaMode: WheelEvent.DOM_DELTA_PIXEL,
         deltaX: 0.5,
         deltaY: 0.5,
         lineOrPageDeltaX: 0,
         lineOrPageDeltaY: 0
       },
-      check: function() {
-        is(target.scrollLeft, scrollLeft, "scrolled to right by 0.5px delta value");
-        is(target.scrollTop, scrollTop, "scrolled to bottom by 0.5px delta value");
-      }
     }, {
       event: {
         deltaMode: WheelEvent.DOM_DELTA_PIXEL,
         deltaX: 0.5,
         deltaY: 0.5,
         lineOrPageDeltaX: 0,
         lineOrPageDeltaY: 0
       },
       check: function() {
-        ok(target.scrollLeft > scrollLeft,
+        is(target.scrollLeft - scrollLeft, 1,
            "not scrolled to right by 0.5px delta value with pending 0.5px delta");
-        ok(target.scrollTop > scrollTop,
+        is(target.scrollTop - scrollTop, 1,
            "not scrolled to bottom by 0.5px delta value with pending 0.5px delta");
       },
     }, {
+      prepare: function() {
+        scrollLeft = target.scrollLeft;
+        scrollTop = target.scrollTop;
+      },
       event: {
         deltaMode: WheelEvent.DOM_DELTA_LINE,
         deltaX: 0.5,
         deltaY: 0.5,
         lineOrPageDeltaX: 0,
         lineOrPageDeltaY: 0
       },
-      check: function() {
-        is(target.scrollLeft, scrollLeft, "scrolled to right by 0.5 line delta value");
-        is(target.scrollTop, scrollTop, "scrolled to bottom by 0.5 line delta value");
-      }
     }, {
       event: {
         deltaMode: WheelEvent.DOM_DELTA_LINE,
         deltaX: 0.5,
         deltaY: 0.5,
         lineOrPageDeltaX: 1,
         lineOrPageDeltaY: 1
       },
       check: function() {
-        ok(target.scrollLeft > scrollLeft,
+        is(target.scrollLeft - scrollLeft, 1,
            "not scrolled to right by 0.5 line delta value with pending 0.5 line delta");
-        ok(target.scrollTop > scrollTop,
+        is(target.scrollTop - scrollTop, 1,
            "not scrolled to bottom by 0.5 line delta value with pending 0.5 line delta");
       }
     }
   ];
 
   var nextTest = function() {
     var test = tests.shift();
-    synthesizeWheel(target, 10, 10, test.event);
-    hitEventLoop(function() {
-      test.check();
+    if (test.prepare) {
+      test.prepare();
+    }
+
+    sendWheelAndPaint(target, 10, 10, test.event, function() {
+      if (test.check) {
+        test.check();
+      }
       if (tests.length == 0) {
         SimpleTest.finish();
         return;
       }
 
-      scrollLeft = target.scrollLeft;
-      scrollTop = target.scrollTop;
-
       setTimeout(nextTest, 0);
-    }, 20);
+    });
   }
 
   nextTest();
 }
 
 </script>
 </pre>
 </body>