5 if (window
.testRunner
) {
6 testRunner
.dumpAsText();
7 testRunner
.waitUntilDone();
12 console
.log("FAIL: test image failed to load.");
13 if (window
.testRunner
)
14 testRunner
.notifyDone();
17 function imageLoaded()
19 console
.log("Test image loaded.");
20 if (!window
.testRunner
)
23 e
= document
.getElementById("source");
24 x
= e
.offsetLeft
+ e
.offsetWidth
/ 2;
25 y
= e
.offsetTop
+ e
.offsetHeight
/ 2;
27 eventSender
.mouseMoveTo(x
, y
);
28 eventSender
.mouseDown();
30 e
= document
.getElementById("target");
31 x
= e
.offsetLeft
+ e
.offsetWidth
/ 2;
32 y
= e
.offsetTop
+ e
.offsetHeight
/ 2;
34 eventSender
.leapForward(100);
35 eventSender
.mouseMoveTo(x
, y
);
36 eventSender
.mouseUp();
39 function dragEnterOrOver(event
)
41 event
.dataTransfer
.dropEffect
= "copy";
42 event
.preventDefault();
47 console
.log("Drop event fired.");
48 event
.preventDefault();
49 if (!window
.testRunner
)
51 eventSender
.dumpFilenameBeingDragged();
52 testRunner
.notifyDone();
56 #target { height:
100px; width:
100px; border:
2px solid green; }
61 <!-- This test requires Content Shell. The drag-dropped image filename extension should be .gif -->
62 <div id=
"target" ondragenter=
"dragEnterOrOver(event)" ondragover=
"dragEnterOrOver(event)" ondrop=
"drop(event)"></div>
63 <img id=
"source" onerror=
"imageError(this)" onload=
"imageLoaded(this)" alt=
"Will it blend?"
64 src=
"http://127.0.0.1:8000/resources/load-and-stall.php?name=drag-drop-test-image.gif&mimeType=application%2Fphp">