<!DOCTYPE html>
<title>This tests that media element controls are reset to their default state when the src is changed to an invalid url.</title>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<script src="media-controls.js"></script>
<video></video>
<script>
async_test(function(t) {
var video = document.querySelector("video");
video.src = "content/test.ogv";
video.oncanplaythrough = t.step_func(function() {
video.oncanplaythrough = null;
assert_equals(video.currentTime, 0);
assert_equals(getMediaControlTimelineValue(), 0);
// Seeking to time value 1.0
video.currentTime = 1.0;
});
video.onseeked = t.step_func(function() {
assert_equals(video.currentTime, 1);
assert_equals(getMediaControlTimelineValue(), 1);
// Change video source to an invalid one
video.src = "/invalid.mov";
});
video.onerror = t.step_func_done(function() {
assert_equals(video.currentTime, 0);
assert_equals(getMediaControlTimelineValue(), 0);
});
function getMediaControlTimelineValue() {
var timeStr = mediaControlsButton(video, "timeline").value;
return +timeStr;
}
});
</script>