<!DOCTYPE html>
<title>Test double seek currentTime.</title>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<video></video>
<script>
// Seek to same time twice and make sure "seeking" is fired twice and that
// "seeked" is fired only once with the "currentTime" being the time set.
async_test(function(t) {
var timeToTest = 1.5;
var video = document.querySelector("video");
var watcher = new EventWatcher(t, video, ["loadedmetadata", "seeking", "seeked"]);
watcher.wait_for("loadedmetadata").then(t.step_func(function() {
video.currentTime = 1.0;
return watcher.wait_for("seeking");
})).then(t.step_func(function() {
video.currentTime = timeToTest;
return watcher.wait_for("seeking");
})).then(t.step_func(function() {
video.currentTime = timeToTest;
return watcher.wait_for("seeking");
})).then(t.step_func(function() {
return watcher.wait_for("seeked");
})).then(t.step_func_done(function() {
assert_equals(video.currentTime, timeToTest);
}));
video.src = "content/test.ogv";
});
</script>