blob: b59f3de88ef06ebd15900cb4ced75019bb951f0a [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script>
if (window.testRunner) {
testRunner.waitUntilDone();
testRunner.dumpAsText();
}
function log(msg) {
var msgNode = document.createTextNode(msg);
var li = document.createElement("li");
li.appendChild(msgNode);
document.getElementById("log").appendChild(li);
}
var dragging = false;
var waitingForUp = false;
function dragStarted() {
if (dragging || waitingForUp) {
log("Unexpected drag start");
return;
}
log("Drag started");
dragging = true;
}
window.onmousedown = function() {
log("Unexpected mousedown");
}
window.onmousemove = function() {
if (!dragging || waitingForUp)
return;
log("Received mouse move");
waitingForUp = true;
}
window.onmouseup = function() {
if (!waitingForUp) {
log("Unexpected mouseup");
return;
}
log("Received mouseup event")
log("PASS!");
}
window.onload = function() {
try {
if (!frames[0] || !frames[0].document || !frames[0].document.getElementById("dragSource")) {
log("Window.onload fired before subframe completed load.");
}
if (!window.testRunner) {
log("This test needs to be run in DRT. To test manually drag from the text 'Drag Me!' out into the parent frame.");
return;
}
var dragSource = frames[0].document.getElementById("dragSource");
var sourceFrame = document.getElementById("sourceFrame");
var x = dragSource.offsetLeft + sourceFrame.offsetLeft + 10;
var y = dragSource.offsetTop + sourceFrame.offsetTop + dragSource.offsetHeight / 2;
eventSender.mouseMoveTo(x,y);
eventSender.mouseDown();
eventSender.mouseMoveTo(120, 120);
eventSender.mouseUp();
} finally {
if (window.testRunner)
testRunner.notifyDone();
}
}
</script>
</head>
<body>
<div>This tests that dragging from an element that returns <emph>false</emph> from its mousedown handler will not let the subsequent mousemove events be captured by the containing frame.</div>
<iframe id="sourceFrame" style="width: 100px; height: 50px;" src="resources/mouse-drag-from-frame-subframe.html"></iframe>
<ul id="log">
</ul>
</body>
</html>