Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / editing / pasteboard / text-selection.html
blob61cb2c891adeff0426d741771b7ab0c5c6163763
1 <!DOCTYPE html>
2 <html>
3 <body oncopy="copy(event)" onpaste="paste(event)">
4 <div id="text">This file tests if text selection is causing oncopy event to get fired. This test requires DRT.</div>
5 <div id="console"></div>
7 <script src="../editing.js"></script>
8 <script>
10 var oncopyCounter = 0;
12 function log(text)
14 var console = document.getElementById('console');
15 console.appendChild(document.createTextNode(text));
16 console.appendChild(document.createElement('br'));
19 function copy(ev)
21 ++oncopyCounter;
24 function runTest() {
25 if (!window.testRunner)
26 return;
27 testRunner.dumpAsText();
29 log("Selecting text with mouse, no copy events should occur:");
30 log("Event count: " + oncopyCounter)
32 var text = document.getElementById("text")
33 eventSender.mouseMoveTo(text.offsetLeft, text.offsetTop);
34 eventSender.mouseDown();
35 eventSender.mouseMoveTo(text.offsetLeft + text.offsetWidth, text.offsetTop);
36 eventSender.mouseUp();
38 log("Copying text, 1 copy event should occur:");
40 copyCommand();
41 log("Event count: " + oncopyCounter);
44 runTest();
46 </script>
47 </body>
48 </html>