Bug 1169287 - Try to make browser_visibleFindSelection.js more reliable. r=mikedeboer, a=test-only
authorOlli Pettay <Olli.Pettay@helsinki.fi>
Wed, 12 Oct 2016 19:01:19 +0300
changeset 350680 bb1a6a0a53479c19d1920dd6155a84a3e9cd84c1
parent 350679 2e702e2a5251c8f316df664fa6bae347fad001ab
child 350681 c62114e522a36a446300e8b555357934232388b4
push id1230
push userjlund@mozilla.com
push dateMon, 31 Oct 2016 18:13:35 +0000
treeherdermozilla-release@5e06e3766db2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmikedeboer, test-only
bugs1169287
milestone50.0
Bug 1169287 - Try to make browser_visibleFindSelection.js more reliable. r=mikedeboer, a=test-only
browser/base/content/test/general/browser_visibleFindSelection.js
--- a/browser/base/content/test/general/browser_visibleFindSelection.js
+++ b/browser/base/content/test/general/browser_visibleFindSelection.js
@@ -16,16 +16,27 @@ add_task(function*() {
 
   // Finds the div in the green box.
   let scrollPromise = promiseWaitForEvent(gBrowser, "scroll");
   EventUtils.synthesizeKey("d", {});
   EventUtils.synthesizeKey("i", {});
   EventUtils.synthesizeKey("v", {});
   yield scrollPromise;
 
+  // Wait for one paint to ensure we've processed the previous key events and scrolling.
+  yield ContentTask.spawn(gBrowser.selectedBrowser, null, function* () {
+    return new Promise(
+      resolve => {
+        content.requestAnimationFrame(() => {
+          setTimeout(resolve, 0);
+        });
+      }
+    );
+  });
+
   // Finds the div in the red box.
   scrollPromise = promiseWaitForEvent(gBrowser, "scroll");
   EventUtils.synthesizeKey("g", { accelKey: true });
   yield scrollPromise;
 
   yield ContentTask.spawn(gBrowser.selectedBrowser, null, function* () {
     Assert.ok(content.document.getElementById("s").getBoundingClientRect().left >= 0,
       "scroll should include find result");