6 border:
1px solid black;
11 var beforeUnloadReceived
= false;
14 var result
= document
.getElementById('result');
15 result
.appendChild(document
.createTextNode(str
));
16 result
.appendChild(document
.createElement('br'));
18 function dragDrop(target
)
20 log('Starting drag...');
21 eventSender
.beginDragWithFiles(['test']);
22 eventSender
.leapForward(100);
23 eventSender
.mouseMoveTo(target
.offsetLeft
+ target
.offsetWidth
/ 2,
24 target
.offsetTop
+ target
.offsetHeight
/ 2);
25 eventSender
.mouseUp();
27 window
.onload = function()
29 var drop1
= document
.getElementById('drop1');
30 var drop2
= document
.getElementById('drop2');
32 document
.body
.addEventListener('dragover', function () {
36 drop1
.addEventListener('dragover', function(e
) {
39 drop1
.addEventListener('drop', function(e
) {
42 log('Drop received in drop target 1');
45 drop2
.addEventListener('dragover', function() {
47 drop2
.addEventListener('drop', function(e
) {
50 log('Drop received in drop target 2');
53 if (!window
.testRunner
)
55 testRunner
.dumpAsText();
56 testRunner
.waitUntilDone();
58 window
.addEventListener('beforeunload', function (e
) {
60 log('Drop not received');
61 beforeUnloadReceived
= true;
63 testRunner
.notifyDone();
68 window
.setTimeout(function () {
69 // Deadman's switch to fail quickly.
70 if (!beforeUnloadReceived
)
71 log('FAIL: navigation expected');
72 testRunner
.notifyDone();
78 <p>To run this test manually, drag a file to one of the two boxes below.
79 <div id=
"drop1">Dropping in drop target
1 should result in a drop event.
</div>
80 <div id=
"drop2">Dropping in drop target
2 should NOT result in a drop event (page will navigate).
</div>