<!DOCTYPE html>
<title>Test that dragging the timebar thumb causes seeks.</title>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<script src="media-controls.js"></script>
<video controls></video>
<script>
async_test(function(t) {
var currentMousePosition = { x: 0, y: 0 };
var seekCount;
var moveCount;
var video = document.querySelector("video");
video.onplaying = t.step_func(playing);
video.onseeked = t.step_func(seeked);
video.src = "content/test.ogv";
video.play();
function playing() {
video.onplaying = null;
seekCount = 0;
moveCount = 0;
assert_equals(video.paused, false);
var seekCoords = mediaControlsButtonCoordinates(video, "timeline");
currentMousePosition.x = seekCoords[0];
currentMousePosition.y = seekCoords[1];
eventSender.dragMode = false;
eventSender.mouseMoveTo(currentMousePosition.x, currentMousePosition.y);
eventSender.mouseDown();
assert_equals(video.paused, true);
// Drag mouse off of the slider thumb to make sure it continues to track
currentMousePosition.y += 100;
eventSender.mouseMoveTo(currentMousePosition.x, currentMousePosition.y);
setTimeout(t.step_func(move), 100);
}
function move() {
++moveCount;
currentMousePosition.x += (10 + moveCount * 2) * (moveCount % 2 ? 1 : -1);
eventSender.mouseMoveTo(currentMousePosition.x, currentMousePosition.y);
}
function seeked() {
++seekCount;
if (seekCount < 6) {
setTimeout(t.step_func(move), 100);
return;
}
assert_equals(video.paused, true);
eventSender.mouseUp();
assert_equals(video.paused, false);
t.done();
}
});
</script>