Bug 1169287, try to make browser_visibleFindSelection.js more reliable, r=mikedeboer
authorOlli Pettay <Olli.Pettay@helsinki.fi>
Wed, 12 Oct 2016 19:01:19 +0300
changeset 317717 6dd44f67ecd78c8413526304cb65fa7aa30e0b16
parent 317669 eac6c1e00f621de91e0316858d7f7e6592dc4186
child 317718 d26b211c3a2bb56e9254f4c1a97c253054c4cefa
push id20699
push usercbook@mozilla.com
push dateThu, 13 Oct 2016 09:59:46 +0000
treeherderfx-team@f03e2740d604 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmikedeboer
bugs1169287
milestone52.0a1
Bug 1169287, try to make browser_visibleFindSelection.js more reliable, r=mikedeboer
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");