<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<style>
#target {
width: 200px;
height: 200px;
}
</style>
<p>This is the top level window.</p>
<p>Click somewhere. Move the mouse into the iframe.</p>
<p>Mouse move should be received by the iframe.</p>
<iframe id="target" srcdoc="
<p>This is the iframe.</p>
<script>
document.addEventListener('mousemove', function() {
parent.mouseMoveReceived();
});
</script>
"></iframe>
<script>
var test_mousemove = async_test("Inner frame should receive mousemove even when mouseup preventDefault was called in the parent frame.");
var mouseUpPrevented = 0;
function mouseMoveReceived() {
if (mouseUpPrevented == 1)
test_mousemove.done();
}
document.addEventListener("mouseup", function(e) {
e.preventDefault();
mouseUpPrevented = 1;
});
function runTest() {
if (window.eventSender) {
var targetRect = document.getElementById("target").getBoundingClientRect();
eventSender.mouseMoveTo(targetRect.right+10, targetRect.bottom+10);
eventSender.mouseDown(0);
eventSender.mouseUp(0);
eventSender.mouseMoveTo(targetRect.right-10, targetRect.bottom-10);
}
}
window.onload = function() {
runTest();
}
</script>