2 <body contenteditable=
"true" onload=
"test()">
4 This is an automatic pixel test. To test interactively, drag selected text onto the iframe
5 below and verify that a drag caret appears inside the frame.
7 <iframe id=
"subframe" style=
"border: 1px solid black;"
8 src=
"data:text/html,<body contenteditable><span id='target'>There</span> should be a caret here --> <br>See it?</body>"></iframe>
10 function dragAndDrop()
12 var iframe
= document
.getElementById("subframe");
13 var target
= iframe
.contentDocument
.getElementById("target");
15 var x1
= iframe
.offsetLeft
+ target
.offsetLeft
+ target
.offsetWidth
/ 2;
16 var x2
= iframe
.offsetLeft
+ iframe
.offsetWidth
- 20;
17 var y
= iframe
.offsetTop
+ target
.offsetTop
+ target
.offsetHeight
/ 2;
19 iframe
.contentWindow
.getSelection().setBaseAndExtent(target
, 0, target
, 1);
21 eventSender
.mouseMoveTo(x1
, y
);
22 eventSender
.dragMode
= false;
23 eventSender
.mouseDown();
24 eventSender
.leapForward(1000);
25 eventSender
.mouseMoveTo(x2
, y
);
27 // Dump pixel results before we drop so we can see where the drag caret is painted.
28 testRunner
.notifyDone();
30 // Pixel dumping is asynchronous. We still have chance to send mouseUp.
31 setTimeout(function() { eventSender
.mouseUp(); }, 0);
36 if (!window
.testRunner
)
39 testRunner
.waitUntilDone();
40 setTimeout(dragAndDrop
, 0);