Bug 1298225 - Add waitForClipboardPromise to shared-head.js r=me a=test-only
authorJarda Snajdr <jsnajdr@gmail.com>
Tue, 04 Oct 2016 09:31:01 +0200
changeset 350532 ed69e6af42aab15b1bdf09d3705d2bd23fdc850d
parent 350531 d4f0cc4d2cce1abbb15595cf8902b5a202a9b020
child 350533 bebbf04b7fe13ed3e43d729558505d2917691621
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)
reviewersme, test-only
bugs1298225
milestone50.0
Bug 1298225 - Add waitForClipboardPromise to shared-head.js r=me a=test-only
devtools/client/framework/test/shared-head.js
--- a/devtools/client/framework/test/shared-head.js
+++ b/devtools/client/framework/test/shared-head.js
@@ -462,16 +462,25 @@ function waitForContextMenu(popup, butto
   button.scrollIntoView();
   let eventDetails = {type: "contextmenu", button: 2};
   EventUtils.synthesizeMouse(button, 5, 2, eventDetails,
                              button.ownerDocument.defaultView);
   return deferred.promise;
 }
 
 /**
+ * Promise wrapper around SimpleTest.waitForClipboard
+ */
+function waitForClipboardPromise(setup, expected) {
+  return new Promise((resolve, reject) => {
+    SimpleTest.waitForClipboard(expected, setup, resolve, reject);
+  });
+}
+
+/**
  * Simple helper to push a temporary preference. Wrapper on SpecialPowers
  * pushPrefEnv that returns a promise resolving when the preferences have been
  * updated.
  *
  * @param {String} preferenceName
  *        The name of the preference to updated
  * @param {} value
  *        The preference value, type can vary