Bug 1001821 - Wait for eyedropper to be destroyed before ending tests and checking for leaks. r=pbrosset, a=test-only
authorSami Jaktholm <sjakthol@outlook.com>
Fri, 16 Jan 2015 20:49:22 +0200
changeset 242994 4036f72a0b10
parent 242993 a6e5dedbd0c0
child 242995 e7d732bf6091
push id4357
push userryanvm@gmail.com
push date2015-01-22 19:21 +0000
treeherdermozilla-beta@3096b7b44265 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspbrosset, test-only
bugs1001821
milestone36.0
Bug 1001821 - Wait for eyedropper to be destroyed before ending tests and checking for leaks. r=pbrosset, a=test-only
browser/devtools/eyedropper/test/browser_eyedropper_cmd.js
--- a/browser/devtools/eyedropper/test/browser_eyedropper_cmd.js
+++ b/browser/devtools/eyedropper/test/browser_eyedropper_cmd.js
@@ -26,19 +26,20 @@ function spawnTest() {
 
   yield inspectAndWaitForCopy();
 
   yield helpers.closeToolbar(options);
   yield helpers.closeTab(options);
 }
 
 function inspectAndWaitForCopy() {
-  return waitForClipboard(() => {
-    inspectPage(); // setup: inspect the page
-  }, DIV_COLOR);
+  let copied = waitForClipboard(() => {}, DIV_COLOR);
+  let ready = inspectPage(); // resolves once eyedropper is destroyed
+  
+  return Promise.all([copied, ready]);
 }
 
 function inspectPage() {
   let target = document.documentElement;
   let win = window;
 
   // get location of the <div> in the content, offset from browser window
   let box = gBrowser.selectedTab.linkedBrowser.getBoundingClientRect();
@@ -49,11 +50,12 @@ function inspectPage() {
 
   return dropperStarted(dropper).then(() => {
     EventUtils.synthesizeMouse(target, x, y, { type: "mousemove" }, win);
 
     return dropperLoaded(dropper).then(() => {
       EventUtils.synthesizeMouse(target, x + 10, y + 10, { type: "mousemove" }, win);
 
       EventUtils.synthesizeMouse(target, x + 10, y + 10, {}, win);
+      return dropper.once("destroy");
     });
   })
 }