Bug 1269102 - Part 1: Move waitForClipboardPromise to shared-head.js r?ochameau draft
authorJarda Snajdr <jsnajdr@gmail.com>
Wed, 10 Aug 2016 13:34:30 +0200
changeset 400581 5e8d0655deccedc5c45b103c968f93b950135343
parent 400313 2ed7e61b988d2466a61528f66050596ef272ebda
child 400582 193f772e1fa81795dffd23de171cc8750ec27ced
push id26210
push userbmo:jsnajdr@gmail.com
push dateMon, 15 Aug 2016 08:03:56 +0000
reviewersochameau
bugs1269102
milestone51.0a1
Bug 1269102 - Part 1: Move waitForClipboardPromise to shared-head.js r?ochameau MozReview-Commit-ID: 3PmdEBNLaJq
devtools/client/debugger/test/mochitest/head.js
devtools/client/framework/test/shared-head.js
devtools/client/jsonview/test/head.js
--- a/devtools/client/debugger/test/mochitest/head.js
+++ b/devtools/client/debugger/test/mochitest/head.js
@@ -437,22 +437,16 @@ function waitForClientEvents(aPanel, aEv
       client.removeListener(aEventName, onEvent);
       deferred.resolve.apply(deferred, aArgs);
     }
   });
 
   return deferred.promise;
 }
 
-function waitForClipboardPromise(setup, expected) {
-  return new Promise((resolve, reject) => {
-    SimpleTest.waitForClipboard(expected, setup, resolve, reject);
-  });
-}
-
 function ensureThreadClientState(aPanel, aState) {
   let thread = aPanel.panelWin.gThreadClient;
   let state = thread.state;
 
   info("Thread is: '" + state + "'.");
 
   if (state == aState) {
     return promise.resolve(null);
--- a/devtools/client/framework/test/shared-head.js
+++ b/devtools/client/framework/test/shared-head.js
@@ -455,16 +455,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
--- a/devtools/client/jsonview/test/head.js
+++ b/devtools/client/jsonview/test/head.js
@@ -131,21 +131,15 @@ function sendString(str, selector) {
 }
 
 function waitForTime(delay) {
   let deferred = promise.defer();
   setTimeout(deferred.resolve, delay);
   return deferred.promise;
 }
 
-function waitForClipboardPromise(setup, expected) {
-  return new Promise((resolve, reject) => {
-    SimpleTest.waitForClipboard(expected, setup, resolve, reject);
-  });
-}
-
 function waitForFilter() {
   return executeInContent("Test:JsonView:WaitForFilter");
 }
 
 function normalizeNewLines(value) {
   return value.replace("(\r\n|\n)", "\n");
 }