Bug 1332166 - Wait for the clipboard to be updated before checking it, r=enndeakin
authorMichael Layzell <michael@thelayzells.com>
Tue, 14 Mar 2017 13:48:51 -0400
changeset 347538 c7d1e31935ce5185b13f0e26dd1afc3d8aaaa875
parent 347537 0104334a6654e0c9601b6b4f7b58f085577fdc6a
child 347539 a37f9e1cbc8fb184e2edd52d55e719bbecd7e419
push id88043
push usermichael@thelayzells.com
push dateTue, 14 Mar 2017 17:49:10 +0000
treeherdermozilla-inbound@c7d1e31935ce [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersenndeakin
bugs1332166
milestone55.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 1332166 - Wait for the clipboard to be updated before checking it, r=enndeakin MozReview-Commit-ID: Ea6jZCYjuaY
dom/plugins/test/mochitest/test_copyText.html
--- a/dom/plugins/test/mochitest/test_copyText.html
+++ b/dom/plugins/test/mochitest/test_copyText.html
@@ -6,24 +6,29 @@
   <script type="text/javascript" src="plugin-utils.js"></script>
 
   <script class="testbody" type="text/javascript">
 function runTests() {
   var text = " some text \n to copy 'n paste "
   var textElt = document.getElementById("input");
   var plugin = document.getElementById("plugin1");
 
-  textElt.focus();
-  textElt.value = text;
-  textElt.select();
-  SpecialPowers.wrap(textElt).editor.copy();
-
-  is(plugin.getClipboardText(), text);
-
-  SimpleTest.finish();
+  // Make sure we wait for the clipboard
+  SimpleTest.waitForClipboard(text, () => {
+    textElt.focus();
+    textElt.value = text;
+    textElt.select();
+    SpecialPowers.wrap(textElt).editor.copy();
+  }, () => {
+    is(plugin.getClipboardText(), text);
+    SimpleTest.finish();
+  }, () => {
+    ok(false, "Failed to set the clipboard text!");
+    SimpleTest.finish();
+  });
 }
 
 SimpleTest.waitForExplicitFinish();
 setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED);
 
   </script>
 </head>