<!DOCTYPE html>
<title>Test seeking on the media controls timeline</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 video = document.querySelector("video");
video.src = "content/test.ogv";
video.onloadedmetadata = t.step_func_done(function() {
assert_equals(video.currentTime, 0);
assert_equals(video.seeking, false);
// click the middle of the timeline
var coords = mediaControlsButtonCoordinates(video, "timeline");
eventSender.mouseMoveTo(coords[0], coords[1]);
eventSender.mouseDown();
eventSender.mouseUp();
var normalizedTime = video.currentTime / video.duration;
assert_greater_than(normalizedTime, 0.4);
assert_less_than(normalizedTime, 0.6);
assert_equals(video.seeking, true);
});
});
</script>