From 3370fb747fa9b44ed6ef1ac731f343cdf2997741 Mon Sep 17 00:00:00 2001 From: Matthew Gregan Date: Wed, 18 Feb 2009 17:16:18 +1300 Subject: [PATCH] Bug 478684 - test_play.html fails intermittently --HG-- extra : rebase_source : d84a07bc61144b7ab88e217bf9e5b815d273fb88 --- content/media/video/test/Makefile.in | 4 +--- content/media/video/test/test_play.html | 23 +++++++++++++++++------ 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/content/media/video/test/Makefile.in b/content/media/video/test/Makefile.in index 572d7d2db918..d33a615389b9 100644 --- a/content/media/video/test/Makefile.in +++ b/content/media/video/test/Makefile.in @@ -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. diff --git a/content/media/video/test/test_play.html b/content/media/video/test/test_play.html index dd9eb52ca338..5ccb22f3cb92 100644 --- a/content/media/video/test/test_play.html +++ b/content/media/video/test/test_play.html @@ -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);