Bug 478684 - test_play.html fails intermittently

--HG--
extra : rebase_source : d84a07bc61144b7ab88e217bf9e5b815d273fb88
This commit is contained in:
Matthew Gregan 2009-02-18 17:16:18 +13:00
Родитель 0439fa763d
Коммит 3370fb747f
2 изменённых файлов: 18 добавлений и 9 удалений

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

@ -77,6 +77,7 @@ _TEST_FILES += \
test_error_on_404.html \
test_onloadedmetadata.html \
test_load_coalescing.html \
test_play.html \
test_progress1.html \
test_progress3.html \
test_source.html \
@ -99,9 +100,6 @@ _TEST_FILES += \
seek.ogv \
$(NULL)
#XXX: disabled for now, see bug 478868
# test_play.html \
ifneq ($(OS_ARCH),WINNT)
# These tests are disabled on windows until we
# figure out the random failures. See bug 475369.

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

@ -14,16 +14,27 @@ SimpleTest.waitForExplicitFinish();
var v = document.getElementById("v");
var playEvents = ["play", "canplay", "playing", "canplaythrough"];
var tokens = {
0: ["play"],
"play": ["canplay"],
"canplay": ["playing"],
"playing": ["canplay", "canplaythrough"],
"canplaythrough": ["canplay", "canplaythrough"]
};
var state = 0;
function gotPlayEvent(event) {
is(event.type, playEvents.shift(), "Check expected event");
}
for (var i = 0; i < playEvents.length; ++i) {
v.addEventListener(playEvents[i], gotPlayEvent, false);
ok(tokens[state].indexOf(event.type) >= 0, "Check expected event got " + event.type + " at " + state);
state = event.type;
}
["play", "canplay", "playing", "canplaythrough"].forEach(function (e) {
v.addEventListener(e, gotPlayEvent, false);
});
function ended() {
is(playEvents.length, 0, "Undelivered event " + playEvents[0]);
is(state, "canplaythrough", "Last event should be canplaythrough");
SimpleTest.finish();
}
v.addEventListener("ended", ended, false);