Bug 592882. Use setTimeout so test starts after paint suppression ends.

This commit is contained in:
Timothy Nikkel 2010-10-14 20:03:45 -05:00
Родитель 8726edc3bb
Коммит 675e50128a
1 изменённых файлов: 27 добавлений и 1 удалений

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

@ -213,11 +213,37 @@ function runTest(event) {
testnum++;
}
var canplaythroughsavedevent = null;
var gotcanplaythroughevent = false;
var gotloadevent = false;
function canplaythroughevent(event) {
canplaythroughsavedevent = event;
gotcanplaythroughevent = true;
video.removeEventListener("canplaythrough", canplaythroughevent, false);
video.addEventListener("canplaythrough", runTest, false);
maybeStartTest();
}
function loadevent(event) {
gotloadevent = true;
maybeStartTest();
}
// setTimeout so that test starts after paint suppression ends
function maybeStartTest() {
if (!gotcanplaythroughevent || !gotloadevent)
return;
setTimeout("runTest(canplaythroughsavedevent);", 0);
}
var testnum = 1;
var video = document.getElementById("video");
// Kick off test once video has loaded.
video.addEventListener("canplaythrough", runTest, false);
video.addEventListener("canplaythrough", canplaythroughevent, false);
window.addEventListener("load", loadevent, false);
// Other events expected by the test.
video.addEventListener("play", runTest, false);