dom/plugins/test/mochitest/test_copyText.html

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 <!DOCTYPE HTML>
     2 <html>
     3 <head>
     4   <title>Test copying text from browser to plugin</title>
     5   <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
     6   <script type="text/javascript" src="utils.js"></script>
     8   <script class="testbody" type="text/javascript">
     9 function runTests() {
    10   var text = " some text \n to copy 'n paste "
    11   var textElt = document.getElementById("input");
    12   var plugin = document.getElementById("plugin1");
    14   textElt.focus();
    15   textElt.value = text;
    16   textElt.select();
    17   SpecialPowers.wrap(textElt).editor.copy();
    19   is(plugin.getClipboardText(), text);
    21   SimpleTest.finish();
    22 }
    24 SimpleTest.waitForExplicitFinish();
    25 setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED);
    27   </script>
    28 </head>
    30 <body onload="runTests()">
    31   <embed id="plugin1" type="application/x-test" width="400" height="400"></embed>
    32   <textarea id="input"></textarea>
    34 </body>
    35 </html>

mercurial