Bug 1210057. Make test_moz_mouse_pixel_scroll_event.html wait for a paint after adding a apz aware (MozMousePixelScroll) event listener. r=kats a=lizzard
authorTimothy Nikkel <tnikkel@gmail.com>
Wed, 10 Feb 2016 17:47:58 -0600
changeset 337962 9545b3dee70f889f677b16853d6681b70d57d40f
parent 337961 d96c772d116e776cc86f231999b08bea6e600e8b
child 337963 fcdc5789640fb87ef2a1a608b189ceb333bc156b
push id12404
push userjlund@mozilla.com
push dateTue, 08 Mar 2016 02:54:16 +0000
reviewerskats, lizzard
bugs1210057
milestone46.0a2
Bug 1210057. Make test_moz_mouse_pixel_scroll_event.html wait for a paint after adding a apz aware (MozMousePixelScroll) event listener. r=kats a=lizzard Adding an apz aware event listener will change the event regions on the layer tree, so we want to wait until that has happened before running the test. MozReview-Commit-ID: Eadr1pSNphW
dom/events/test/test_moz_mouse_pixel_scroll_event.html
--- a/dom/events/test/test_moz_mouse_pixel_scroll_event.html
+++ b/dom/events/test/test_moz_mouse_pixel_scroll_event.html
@@ -1,14 +1,15 @@
 <!DOCTYPE HTML>
 <html>
 <head>
   <title>Test for MozMousePixelScroll events</title>
   <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
   <script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
+  <script type="application/javascript" src="/tests/SimpleTest/paint_listener.js"></script>
   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
   <style>
     .scrollable {
       overflow: auto;
       line-height: 1;
       margin: 15px;
     }
     .scrollable > div {
@@ -58,16 +59,18 @@ function* prepareScrollUnits()
   function handler(aEvent)
   {
     result = aEvent.detail;
     aEvent.preventDefault();
     setTimeout(runTest, 0);
   }
   window.addEventListener("MozMousePixelScroll", handler, true);
 
+  yield waitForAllPaints(function () { setTimeout(runTest, 0); });
+
   yield synthesizeWheel(gScrollable128, 10, 10,
                   { deltaMode: WheelEvent.DOM_DELTA_LINE,
                     deltaY: 1.0, lineOrPageDeltaY: 1 });
   gScrollable128.wheelLineHeight = result;
   ok(result > 96 && result < 200, "prepareScrollUnits: gScrollable128.wheelLineHeight may be illegal value, got " + result);
 
   result = -1;
   yield synthesizeWheel(gScrollable96, 10, 10,