Bug 1065827 - Wait for loadeddata event to start test. r=jwwang

This commit is contained in:
Jean-Yves Avenard 2014-11-06 20:54:37 +11:00
Родитель 48cf285b42
Коммит 095168ff66
1 изменённых файлов: 6 добавлений и 6 удалений

Просмотреть файл

@ -26,7 +26,7 @@ function finish(v) {
manager.finished(v.token);
}
function onLoadedMetadata_Audio(e) {
function onLoadedData_Audio(e) {
var t = e.target;
is(t.videoHeight, 0, t.name + ": videoHeight should be zero when there is no video.");
is(t.videoWidth, 0, t.name + ": videoWidth should be zero when there is no video.");
@ -62,14 +62,14 @@ function onTimeUpdate_Video(e) {
todo("No audio file available.")
finish(t);
} else {
t.removeEventListener("loadedmetadata", onLoadedMetadata_Video);
t.addEventListener("loadedmetadata", onLoadedMetadata_Audio);
t.removeEventListener("loadeddata", onLoadedData_Video);
t.addEventListener("loadeddata", onLoadedData_Audio);
t.src = source.name;
}
}
}
function onLoadedMetadata_Video(e) {
function onLoadedData_Video(e) {
var t = e.target;
isnot(t.videoHeight, 0, t.name + ": We should have a videoHeight.");
isnot(t.videoWidth, 0, t.name + ": We should have a videoWidth.");
@ -80,12 +80,12 @@ function onLoadedMetadata_Video(e) {
function startTest(test, token) {
var v = document.createElement('video');
document.body.appendChild(v);
v.preload = "metadata";
v._firstTime = true;
v.addEventListener("loadedmetadata", onLoadedMetadata_Video);
v.addEventListener("loadeddata", onLoadedData_Video);
v.src = test.name;
v.token = token;
v.name = test.name;
v.play();
manager.started(token);
}