dom/plugins/test/mochitest/test_copyText.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/plugins/test/mochitest/test_copyText.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,35 @@
     1.4 +<!DOCTYPE HTML>
     1.5 +<html>
     1.6 +<head>
     1.7 +  <title>Test copying text from browser to plugin</title>
     1.8 +  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
     1.9 +  <script type="text/javascript" src="utils.js"></script>
    1.10 +
    1.11 +  <script class="testbody" type="text/javascript">
    1.12 +function runTests() {
    1.13 +  var text = " some text \n to copy 'n paste "
    1.14 +  var textElt = document.getElementById("input");
    1.15 +  var plugin = document.getElementById("plugin1");
    1.16 +
    1.17 +  textElt.focus();
    1.18 +  textElt.value = text;
    1.19 +  textElt.select();
    1.20 +  SpecialPowers.wrap(textElt).editor.copy();
    1.21 +
    1.22 +  is(plugin.getClipboardText(), text);
    1.23 +
    1.24 +  SimpleTest.finish();
    1.25 +}
    1.26 +
    1.27 +SimpleTest.waitForExplicitFinish();
    1.28 +setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED);
    1.29 +
    1.30 +  </script>
    1.31 +</head>
    1.32 +
    1.33 +<body onload="runTests()">
    1.34 +  <embed id="plugin1" type="application/x-test" width="400" height="400"></embed>
    1.35 +  <textarea id="input"></textarea>
    1.36 +
    1.37 +</body>
    1.38 +</html>

mercurial