Bug 1113596 - add logs to track media element events. r=edwin

This commit is contained in:
JW Wang 2015-03-04 18:43:00 +01:00
Родитель 39f5853100
Коммит 5974cd1b2b
1 изменённых файлов: 14 добавлений и 0 удалений

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

@ -11,6 +11,7 @@
<pre id="test">
<script class="testbody" type="text/javascript">
SimpleTest.requestCompleteLog();
var manager = new MediaTestManager;
function cloneLoaded(event) {
@ -32,6 +33,19 @@ function tryClone(event) {
var clone = e.cloneNode(false);
clone.token = e.token;
// Log events for debugging.
var events = ["suspend", "play", "canplay", "canplaythrough", "loadstart", "loadedmetadata",
"loadeddata", "playing", "ended", "error", "stalled", "emptied", "abort",
"waiting", "pause"];
function logEvent(evt) {
var e = evt.target;
info(e.token + ": got " + evt.type);
}
events.forEach(function(e) {
clone.addEventListener(e, logEvent, false);
});
if (e._expectedDuration) {
ok(Math.abs(e.duration - e._expectedDuration) < 0.1,
e.currentSrc + " duration: " + e.duration + " expected: " + e._expectedDuration);