Bug 1237905 - Ensure the page is painted before synthesizing native events. r=kats
MozReview-Commit-ID: LRt7l3S9Jz6
--- a/gfx/layers/apz/test/mochitest/test_wheel_transactions.html
+++ b/gfx/layers/apz/test/mochitest/test_wheel_transactions.html
@@ -2,17 +2,19 @@
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1175585
-->
<head>
<title>Test for Bug 1175585</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
+ <script type="application/javascript" src="/tests/SimpleTest/paint_listener.js"></script>
<script type="application/javascript" src="apz_test_native_event_utils.js"></script>
+ <script type="application/javascript" src="apz_test_utils.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<style>
#outer-frame {
height: 500px;
overflow: scroll;
background: repeating-linear-gradient(#CCC, #CCC 100px, #BBB 100px, #BBB 200px);
}
#inner-frame {
@@ -141,23 +143,29 @@ function driveTest() {
}
var ret = gTestContinuation.next();
if (ret.done) {
SimpleTest.finish();
}
}
function startTest() {
- // Disable smooth scrolling because it makes the test flaky (we don't have a good
- // way of detecting when the scrolling is finished).
- SpecialPowers.pushPrefEnv({"set": [["general.smoothScroll", false],
- ["layers.dump", true],
- ["apz.printtree", true]]}, driveTest);
+ waitForAllPaints(function() {
+ flushApzRepaints(driveTest);
+ });
}
+// Disable smooth scrolling because it makes the test flaky (we don't have a good
+// way of detecting when the scrolling is finished).
+SpecialPowers.pushPrefEnv({"set": [["general.smoothScroll", false],
+ ["layers.dump", true],
+ ["apz.printtree", true]]},
+ function() {
+ SimpleTest.waitForFocus(startTest, window);
+ });
+
SimpleTest.waitForExplicitFinish();
-SimpleTest.waitForFocus(startTest, window);
</script>
</pre>
</body>
</html>