Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / events / touch / gesture / long-press-selects-word-when-touch-editing-enabled.html
blobb52a076b5a5bbd7dbb82f52f2d8551c4e5d39e98
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2 <html>
3 <head>
4 <script src="../../../../resources/js-test.js"></script>
5 </head>
6 <body onload="test()">
7 <p>This test checks that a long press gesture selects word when touch editing is enabled.</p>
8 <div id="text">Testing</div>
9 <div id="result">FAIL</div>
10 <div id="textDiv">Some text</div>
11 <script>
12 function test()
14 if (window.testRunner)
15 testRunner.dumpAsText();
17 if (window.internals)
18 internals.settings.setTouchEditingEnabled(true);
20 var textDiv = document.getElementById("textDiv");
22 var x = textDiv.offsetParent.offsetLeft + textDiv.offsetLeft + 4;
23 var y = textDiv.offsetParent.offsetTop + textDiv.offsetTop + textDiv.offsetHeight / 2;
25 if (!window.eventSender)
26 return;
27 if (eventSender.gestureLongPress) {
28 eventSender.gestureLongPress(x, y);
29 var selectedText = document.getSelection();
30 if (selectedText.toString().length > 0)
31 document.getElementById("result").innerHTML = "PASS";
32 } else {
33 debug("gestureLongPress not implemented by this platform");
34 return;
37 </script>
38 </body>
39 </html>