Bug 752781. Wait for a refresh driver run to complete before testing whether scrolling has happened. r=mats

This commit is contained in:
Robert O'Callahan 2012-05-24 22:39:11 +12:00
parent a0ecbc68c1
commit 1511ce59ff

View File

@ -57,12 +57,19 @@ function runTest() {
scrollDown15PxWithPixelScrolling(scrollbox);
setTimeout(function checkThatScrollIsFinishedAlmostInstantly() {
is(scrollbox.scrollTop, scrollTopBefore + 15, "Pixel scrolling should have finished after waiting for one 0-interval timer. We shouldn't be scrolling smoothly, even though the pref is set.")
win.close();
clearPrefs();
SimpleTest.finish();
}, 0);
// wait for the next refresh driver run
window.mozRequestAnimationFrame(function() {
// actually, wait for the next one before checking results, since
// scrolling might not be flushed until after this code has run
window.mozRequestAnimationFrame(function() {
is(scrollbox.scrollTop, scrollTopBefore + 15,
"Pixel scrolling should have finished after one refresh driver iteration. " +
"We shouldn't be scrolling smoothly, even though the pref is set.");
win.close();
clearPrefs();
SimpleTest.finish();
});
});
}, win);
}