Bug 1295556 - Use waitForClipboardPromise from shared-head.js in Inspector tests r=jsnajdr
☠☠ backed out by c4f263eaa467 ☠ ☠
authorShubheksha Jalan <jshubheksha@gmail.com>
Mon, 12 Sep 2016 15:37:34 +0530
changeset 313504 5a68cb04da5303c5c1e4b855af851ca5f608f9a3
parent 313503 7351b2e1daccc2b543e3ec417fff5bda65b53f32
child 313505 a130813c15a4dda55a37fa1ce3feb344339ce32b
push id30689
push userkwierso@gmail.com
push dateMon, 12 Sep 2016 23:52:16 +0000
treeherdermozilla-central@7b1cb8b0be7c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjsnajdr
bugs1295556
milestone51.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1295556 - Use waitForClipboardPromise from shared-head.js in Inspector tests r=jsnajdr MozReview-Commit-ID: 5fB7Wz1jLGe
devtools/client/inspector/test/browser_inspector_highlighter-eyedropper-clipboard.js
devtools/client/inspector/test/browser_inspector_keyboard-shortcuts-copy-outerhtml.js
devtools/client/inspector/test/browser_inspector_menu-02-copy-items.js
devtools/client/inspector/test/browser_inspector_search-filter_context-menu.js
devtools/client/inspector/test/head.js
--- a/devtools/client/inspector/test/browser_inspector_highlighter-eyedropper-clipboard.js
+++ b/devtools/client/inspector/test/browser_inspector_highlighter-eyedropper-clipboard.js
@@ -18,17 +18,17 @@ add_task(function* () {
        waitForElementAttributeSet, waitForElementAttributeRemoved} = helper;
 
   info("Show the eyedropper with the copyOnSelect option");
   yield show("html", {copyOnSelect: true});
 
   info("Make sure to wait until the eyedropper is done taking a screenshot of the page");
   yield waitForElementAttributeSet("root", "drawn", helper);
 
-  yield waitForClipboard(() => {
+  yield waitForClipboardPromise(() => {
     info("Activate the eyedropper so the background color is copied");
     EventUtils.synthesizeKey("VK_RETURN", {});
   }, "#FF0000");
 
   ok(true, "The clipboard contains the right value");
 
   yield waitForElementAttributeRemoved("root", "drawn", helper);
   yield waitForElementAttributeSet("root", "hidden", helper);
--- a/devtools/client/inspector/test/browser_inspector_keyboard-shortcuts-copy-outerhtml.js
+++ b/devtools/client/inspector/test/browser_inspector_keyboard-shortcuts-copy-outerhtml.js
@@ -29,17 +29,17 @@ add_task(function* () {
 function* setSelectionNodeFront(node, inspector) {
   let updated = inspector.once("inspector-updated");
   inspector.selection.setNodeFront(node);
   yield updated;
 }
 
 function* checkClipboard(expectedText, node) {
   try {
-    yield waitForClipboard(() => fireCopyEvent(node), expectedText);
+    yield waitForClipboardPromise(() => fireCopyEvent(node), expectedText);
     ok(true, "Clipboard successfully filled with : " + expectedText);
   } catch (e) {
     ok(false, "Clipboard could not be filled with the expected text : " +
               expectedText);
   }
 }
 
 function getElementByType(inspector, type) {
--- a/devtools/client/inspector/test/browser_inspector_menu-02-copy-items.js
+++ b/devtools/client/inspector/test/browser_inspector_menu-02-copy-items.js
@@ -39,11 +39,11 @@ add_task(function* () {
   for (let {desc, id, selector, text} of COPY_ITEMS_TEST_DATA) {
     info("Testing " + desc);
     yield selectNode(selector, inspector);
 
     let allMenuItems = openContextMenuAndGetAllItems(inspector);
     let item = allMenuItems.find(i => i.id === id);
     ok(item, "The popup has a " + desc + " menu item.");
 
-    yield waitForClipboard(() => item.click(), text);
+    yield waitForClipboardPromise(() => item.click(), text);
   }
 });
--- a/devtools/client/inspector/test/browser_inspector_search-filter_context-menu.js
+++ b/devtools/client/inspector/test/browser_inspector_search-filter_context-menu.js
@@ -45,17 +45,17 @@ add_task(function* () {
   yield onContextMenuHidden;
 
   info("Copy text in search field using the context menu");
   searchBox.value = TEST_INPUT;
   searchBox.select();
   EventUtils.synthesizeMouse(searchBox, 2, 2,
     {type: "contextmenu", button: 2}, win);
   yield onContextMenuPopup;
-  yield waitForClipboard(() => cmdCopy.click(), TEST_INPUT);
+  yield waitForClipboardPromise(() => cmdCopy.click(), TEST_INPUT);
   searchContextMenu.hidePopup();
   yield onContextMenuHidden;
 
   info("Reopen context menu and check command properties");
   EventUtils.synthesizeMouse(searchBox, 2, 2,
     {type: "contextmenu", button: 2}, win);
   yield onContextMenuPopup;
 
--- a/devtools/client/inspector/test/head.js
+++ b/devtools/client/inspector/test/head.js
@@ -614,33 +614,16 @@ function waitForStyleEditor(toolbox, hre
       panel.UI.on("editor-selected", gotEditor);
     }
   });
 
   return def.promise;
 }
 
 /**
- * @see SimpleTest.waitForClipboard
- *
- * @param {Function} setup
- *        Function to execute before checking for the
- *        clipboard content
- * @param {String|Function} expected
- *        An expected string or validator function
- * @return a promise that resolves when the expected string has been found or
- * the validator function has returned true, rejects otherwise.
- */
-function waitForClipboard(setup, expected) {
-  let def = defer();
-  SimpleTest.waitForClipboard(expected, setup, def.resolve, def.reject);
-  return def.promise;
-}
-
-/**
  * Checks if document's active element is within the given element.
  * @param  {HTMLDocument}  doc document with active element in question
  * @param  {DOMNode}       container element tested on focus containment
  * @return {Boolean}
  */
 function containsFocus(doc, container) {
   let elm = doc.activeElement;
   while (elm) {