From d9ececf5892fda82388dc247ab22f060a192eae1 Mon Sep 17 00:00:00 2001 From: Robert O'Callahan Date: Thu, 24 May 2012 22:39:11 +1200 Subject: [PATCH] Bug 752781. Wait for a refresh driver run to complete before testing whether scrolling has happened. r=mats --- content/events/test/test_bug607464.html | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/content/events/test/test_bug607464.html b/content/events/test/test_bug607464.html index 1bd1a4eaf03d..59ec773a59fd 100644 --- a/content/events/test/test_bug607464.html +++ b/content/events/test/test_bug607464.html @@ -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); }