Skip to content

Commit

Permalink
Bug 1332166 - Wait for the clipboard to be updated before checking it…
Browse files Browse the repository at this point in the history
…, r=enndeakin

MozReview-Commit-ID: Ea6jZCYjuaY
  • Loading branch information
mystor committed Mar 14, 2017
1 parent 0413a30 commit 54f4acb
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions dom/plugins/test/mochitest/test_copyText.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,19 @@
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();
Expand Down

0 comments on commit 54f4acb

Please sign in to comment.