Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / events / touch / gesture / long-press-drag-drop-touch-editing-combined.html
blob17b21558210a8a07f959e1f7033742395280ef28
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 long press behavior when both touch drag/drop and touch editing are enabled.<br>
8 1. Check that long press on a draggable element starts drag.<br>
9 2. Check that long press on non-draggable text selects the text.<br>
10 3. Check that long press on selected text starts drag.</p>
11 <div id="text">Testing</div>
12 <div id="draggableDivResult">FAIL</div>
13 <div id="selectTextResult">FAIL</div>
14 <div id="draggableTextResult">FAIL</div>
15 <div id="draggableDiv" draggable='true'>Drag me</div>
16 <div id="textDiv">Some text</div>
17 <script>
18 function test()
20 if (window.testRunner)
21 testRunner.dumpAsText();
23 if (window.internals) {
24 internals.settings.setTouchDragDropEnabled(true);
25 internals.settings.setTouchEditingEnabled(true);
28 var draggableDiv = document.getElementById("draggableDiv");
29 draggableDiv.ondragstart = function() { document.getElementById("draggableDivResult").innerHTML = "PASS"; }
31 var textDiv = document.getElementById("textDiv");
32 textDiv.ondragstart = function() { document.getElementById("draggableTextResult").innerHTML = "PASS"; }
34 if (!window.eventSender)
35 return;
36 if (eventSender.gestureLongPress) {
37 var x = draggableDiv.offsetParent.offsetLeft + draggableDiv.offsetLeft + 4;
38 var y = draggableDiv.offsetParent.offsetTop + draggableDiv.offsetTop + draggableDiv.offsetHeight / 2;
39 eventSender.gestureLongPress(x, y);
41 x = textDiv.offsetParent.offsetLeft + textDiv.offsetLeft + 4;
42 y = textDiv.offsetParent.offsetTop + textDiv.offsetTop + textDiv.offsetHeight / 2;
44 eventSender.gestureLongPress(x, y);
45 if (document.getSelection().toString().length > 0)
46 document.getElementById("selectTextResult").innerHTML = "PASS";
48 eventSender.gestureLongPress(x, y);
49 } else {
50 debug("gestureLongPress not implemented by this platform");
51 return;
54 </script>
55 </body>
56 </html>