Backed out 5 changesets (bug 1556854) for mda failures on /test_media_selection.html CLOSED TREE

Backed out changeset 61a4022333fa (bug 1556854)
Backed out changeset cfd809c63877 (bug 1556854)
Backed out changeset 057cc9878594 (bug 1556854)
Backed out changeset 0f02ff8a5c67 (bug 1556854)
Backed out changeset 8719996c65b3 (bug 1556854)
This commit is contained in:
Narcis Beleuzu 2019-10-24 13:47:37 +03:00
parent 7b85f15477
commit 6a96b612b6
127 changed files with 1891 additions and 2389 deletions

View File

@ -11,6 +11,10 @@
# Exclude expected objdirs.
obj*/
# dom/ exclusions which should be removed (aka ESLint enabled)
dom/media/test/
!dom/media/test/marionette/yttest/*.js
# build/ third-party code
build/pgo/js-input/
@ -155,8 +159,6 @@ dom/encoding/test/file_utf16_be_bom.js
dom/encoding/test/file_utf16_le_bom.js
# Not parsable
dom/media/test/marionette/yttest/duration_test.js
dom/media/test/marionette/yttest/until_end_test.js
dom/tests/mochitest/general/test_focusrings.xul
dom/html/test/test_bug677658.html

View File

@ -1,5 +1,3 @@
/* import-globals-from manifest.js */
function playAndPostResult(muted, parent_window) {
let element = document.createElement("video");
element.preload = "auto";
@ -9,13 +7,13 @@ function playAndPostResult(muted, parent_window) {
document.body.appendChild(element);
let allowedToPlay = element.allowedToPlay;
element.play().then(
() => {
parent_window.postMessage({ played: true, allowedToPlay }, "*");
},
() => {
parent_window.postMessage({ played: false, allowedToPlay }, "*");
}
);
() => {
parent_window.postMessage({played: true, allowedToPlay}, "*");
},
() => {
parent_window.postMessage({played: false, allowedToPlay}, "*");
}
);
}
function nextWindowMessage() {
@ -32,15 +30,10 @@ const autoplayPermission = "autoplay-media";
async function pushAutoplayAllowedPermission() {
return new Promise((resolve, reject) => {
SpecialPowers.pushPermissions(
[
{
type: autoplayPermission,
allow: true,
context: document,
},
],
resolve
);
SpecialPowers.pushPermissions([{
'type': autoplayPermission,
'allow': true,
'context': document
}], resolve);
});
}

View File

@ -1,35 +1,33 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// This file expects manager to be defined in the global scope.
/* global manager */
/* import-globals-from manifest.js */
/* jshint esversion: 6, -W097 */
/* globals SimpleTest, SpecialPowers, document, info, is, manager, ok */
"use strict";
function startTest(test) {
info(test.desc);
SimpleTest.waitForExplicitFinish();
SpecialPowers.pushPrefEnv({ set: test.prefs }, () => {
SpecialPowers.pushPrefEnv({ 'set': test.prefs }, () => {
manager.runTests(test.tests, test.runTest);
});
}
function nextVideoEnded(video) {
return nextEvent(video, "ended");
return nextEvent(video, 'ended');
}
function nextVideoPlaying(video) {
return nextEvent(video, "playing");
return nextEvent(video, 'playing');
}
function nextVideoResumes(video) {
return nextEvent(video, "mozexitvideosuspend");
return nextEvent(video, 'mozexitvideosuspend');
}
function nextVideoSuspends(video) {
return nextEvent(video, "mozentervideosuspend");
return nextEvent(video, 'mozentervideosuspend');
}
/**
@ -38,14 +36,10 @@ function nextVideoSuspends(video) {
*/
function appendVideoToDoc(url, token, width, height) {
// Default size of (160, 120) is used by other media tests.
if (width === undefined) {
width = 160;
}
if (height === undefined) {
height = (3 * width) / 4;
}
if (width === undefined) { width = 160; }
if (height === undefined) { height = 3 * width / 4; }
let v = document.createElement("video");
let v = document.createElement('video');
v.token = token;
v.width = width;
v.height = height;
@ -56,14 +50,10 @@ function appendVideoToDoc(url, token, width, height) {
function appendVideoToDocWithoutLoad(token, width, height) {
// Default size of (160, 120) is used by other media tests.
if (width === undefined) {
width = 160;
}
if (height === undefined) {
height = (3 * width) / 4;
}
if (width === undefined) { width = 160; }
if (height === undefined) { height = 3*width/4; }
let v = document.createElement("video");
let v = document.createElement('video');
v.token = token;
document.body.appendChild(v);
v.width = width;
@ -74,13 +64,7 @@ function appendVideoToDocWithoutLoad(token, width, height) {
function loadAndWaitUntilLoadedmetadata(video, url, preloadType = "metadata") {
return new Promise((resolve, reject) => {
video.preload = preloadType;
video.addEventListener(
"loadedmetadata",
() => {
resolve();
},
true
);
video.addEventListener("loadedmetadata", () => { resolve(); }, true);
video.src = url;
});
}
@ -111,9 +95,7 @@ function waitUntilVisible(video) {
* @returns {Promise} Promise that is resolved when video 'playing' event fires.
*/
function waitUntilPlaying(video) {
var p = once(video, "playing", () => {
ok(true, `${video.token} played.`);
});
var p = once(video, 'playing', () => { ok(true, `${video.token} played.`); });
Log(video.token, "Start playing");
video.play();
return p;
@ -130,9 +112,7 @@ function waitUntilEnded(video) {
return Promise.resolve();
}
return once(video, "ended", () => {
ok(true, `${video.token} ended`);
});
return once(video, 'ended', () => { ok(true, `${video.token} ended`); });
}
/**
@ -141,10 +121,10 @@ function waitUntilEnded(video) {
* suspend timer.
*/
function testSuspendTimerStartedWhenHidden(video) {
var p = once(video, "mozstartvideosuspendtimer").then(() => {
ok(true, `${video.token} suspend begins`);
var p = once(video, 'mozstartvideosuspendtimer').then(() => {
ok(true, `${video.token} suspend begins`)
});
Log(video.token, "Set Hidden");
Log(video.token, 'Set Hidden');
video.setVisible(false);
return p;
}
@ -154,7 +134,7 @@ function testSuspendTimerStartedWhenHidden(video) {
* @returns {Promise} Promise that is resolved when video decode suspends.
*/
function testVideoSuspendsWhenHidden(video) {
let p = once(video, "mozentervideosuspend").then(() => {
let p = once(video, 'mozentervideosuspend').then(() => {
ok(true, `${video.token} suspends`);
});
Log(video.token, "Set hidden");
@ -167,7 +147,7 @@ function testVideoSuspendsWhenHidden(video) {
* @returns {Promise} Promise that is resolved when video decode resumes.
*/
function testVideoResumesWhenShown(video) {
var p = once(video, "mozexitvideosuspend").then(() => {
var p = once(video, 'mozexitvideosuspend').then(() => {
ok(true, `${video.token} resumes`);
});
Log(video.token, "Set visible");
@ -180,7 +160,7 @@ function testVideoResumesWhenShown(video) {
* @returns {Promise} Promise that is resolved when video decode resumes.
*/
function testVideoOnlySeekCompletedWhenShown(video) {
var p = once(video, "mozvideoonlyseekcompleted").then(() => {
var p = once(video, 'mozvideoonlyseekcompleted').then(() => {
ok(true, `${video.token} resumes`);
});
Log(video.token, "Set visible");
@ -194,12 +174,8 @@ function testVideoOnlySeekCompletedWhenShown(video) {
*/
function checkVideoDoesntSuspend(video) {
let p = Promise.race([
waitUntilEnded(video).then(() => {
ok(true, `${video.token} ended before decode was suspended`);
}),
once(video, "mozentervideosuspend", () => {
Promise.reject(new Error(`${video.token} suspended`));
}),
waitUntilEnded(video).then(() => { ok(true, `${video.token} ended before decode was suspended`) }),
once(video, 'mozentervideosuspend', () => { Promise.reject(new Error(`${video.token} suspended`)) })
]);
Log(video.token, "Set hidden.");
video.setVisible(false);
@ -214,7 +190,7 @@ function checkVideoDoesntSuspend(video) {
function waitTil(video, time) {
Log(video.token, `Waiting for time to reach ${time}s`);
return new Promise(resolve => {
video.addEventListener("timeupdate", function timeUpdateEvent() {
video.addEventListener('timeupdate', function timeUpdateEvent() {
if (video.currentTime > time) {
video.removeEventListener(name, timeUpdateEvent);
resolve();

View File

@ -11,10 +11,10 @@ function check_dash(v, enabled) {
check("application/dash+xml; codecs=vorbis", "probably");
check("application/dash+xml; codecs=vorbis,vp8", "probably");
check("application/dash+xml; codecs=vorbis,vp8.0", "probably");
check('application/dash+xml; codecs="vorbis,vp8"', "probably");
check('application/dash+xml; codecs="vorbis,vp8.0"', "probably");
check('application/dash+xml; codecs="vp8, vorbis"', "probably");
check('application/dash+xml; codecs="vp8.0, vorbis"', "probably");
check("application/dash+xml; codecs=\"vorbis,vp8\"", "probably");
check("application/dash+xml; codecs=\"vorbis,vp8.0\"", "probably");
check("application/dash+xml; codecs=\"vp8, vorbis\"", "probably");
check("application/dash+xml; codecs=\"vp8.0, vorbis\"", "probably");
check("application/dash+xml; codecs=vp8", "probably");
check("application/dash+xml; codecs=vp8.0", "probably");

View File

@ -1,3 +1,4 @@
function check_ogg(v, enabled, finish) {
function check(type, expected) {
is(v.canPlayType(type), enabled ? expected : "", type);
@ -14,7 +15,7 @@ function check_ogg(v, enabled, finish) {
check("audio/ogg; codecs=vorbis", "probably");
check("video/ogg; codecs=vorbis", "probably");
check("video/ogg; codecs=vorbis,theora", "probably");
check('video/ogg; codecs="vorbis, theora"', "probably");
check("video/ogg; codecs=\"vorbis, theora\"", "probably");
check("video/ogg; codecs=theora", "probably");
resolve();
@ -24,35 +25,33 @@ function check_ogg(v, enabled, finish) {
// Verify Opus support
function verify_opus_support() {
return new Promise(function(resolve, reject) {
var OpusEnabled = SpecialPowers.getBoolPref(
"media.opus.enabled",
undefined
);
var OpusEnabled = undefined;
try {
OpusEnabled = SpecialPowers.getBoolPref("media.opus.enabled");
} catch (ex) {
// SpecialPowers failed, perhaps because Opus isn't compiled in
console.log("media.opus.enabled pref not found; skipping Opus validation");
}
if (OpusEnabled != undefined) {
resolve();
} else {
console.log(
"media.opus.enabled pref not found; skipping Opus validation"
);
reject();
}
});
}
function opus_enable() {
return SpecialPowers.pushPrefEnv({
set: [["media.opus.enabled", true]],
}).then(function() {
check("audio/ogg; codecs=opus", "probably");
});
return SpecialPowers.pushPrefEnv({"set": [['media.opus.enabled', true]]})
.then(function() {
check("audio/ogg; codecs=opus", "probably");
});
}
function opus_disable() {
return SpecialPowers.pushPrefEnv({
set: [["media.opus.enabled", false]],
}).then(function() {
check("audio/ogg; codecs=opus", "");
});
return SpecialPowers.pushPrefEnv({"set": [['media.opus.enabled', false]]})
.then(function() {
check("audio/ogg; codecs=opus", "");
});
}
function unspported_ogg() {
@ -65,8 +64,9 @@ function check_ogg(v, enabled, finish) {
}
basic_test()
.then(verify_opus_support)
.then(opus_enable)
.then(opus_disable)
.then(unspported_ogg, unspported_ogg);
.then(verify_opus_support)
.then(opus_enable)
.then(opus_disable)
.then(unspported_ogg, unspported_ogg);
}

View File

@ -15,15 +15,15 @@ function check_wave(v, enabled) {
check("audio/wave; codecs=7", "probably");
// "no codecs" should be supported, I guess
check("audio/wave; codecs=", "maybe");
check('audio/wave; codecs=""', "maybe");
check("audio/wave; codecs=\"\"", "maybe");
// Unsupported Wave codecs
check("audio/wave; codecs=0", "");
check("audio/wave; codecs=2", "");
check("audio/wave; codecs=xyz,1", "");
check("audio/wave; codecs=1,xyz", "");
check('audio/wave; codecs="xyz, 1"', "");
check("audio/wave; codecs=\"xyz, 1\"", "");
// empty codec names
check("audio/wave; codecs=,", "");
check('audio/wave; codecs="0, 1,"', "");
check("audio/wave; codecs=\"0, 1,\"", "");
}

View File

@ -1,18 +1,14 @@
async function check_webm(v, enabled) {
function check(type, expected) {
is(
v.canPlayType(type),
enabled ? expected : "",
type + "='" + expected + "'"
);
is(v.canPlayType(type), enabled ? expected : "", type + "='" + expected + "'");
}
// WebM types
check("video/webm", "maybe");
check("audio/webm", "maybe");
var video = ["vp8", "vp8.0", "vp9", "vp9.0"];
var audio = ["vorbis", "opus"];
var video = ['vp8', 'vp8.0', 'vp9', 'vp9.0'];
var audio = ['vorbis', 'opus'];
audio.forEach(function(acodec) {
check("audio/webm; codecs=" + acodec, "probably");
@ -21,8 +17,8 @@ async function check_webm(v, enabled) {
video.forEach(function(vcodec) {
check("video/webm; codecs=" + vcodec, "probably");
audio.forEach(function(acodec) {
check('video/webm; codecs="' + vcodec + ", " + acodec + '"', "probably");
check('video/webm; codecs="' + acodec + ", " + vcodec + '"', "probably");
check("video/webm; codecs=\"" + vcodec + ", " + acodec + "\"", "probably");
check("video/webm; codecs=\"" + acodec + ", " + vcodec + "\"", "probably");
});
});
@ -31,9 +27,17 @@ async function check_webm(v, enabled) {
check("video/webm; codecs=xyz,vorbis", "");
check("video/webm; codecs=vorbis,xyz", "");
await SpecialPowers.pushPrefEnv({ set: [["media.av1.enabled", true]] });
check('video/webm; codecs="av1"', "probably");
function getPref(name) {
var pref = false;
try {
pref = SpecialPowers.getBoolPref(name);
} catch(ex) { }
return pref;
}
await SpecialPowers.pushPrefEnv({ set: [["media.av1.enabled", false]] });
check('video/webm; codecs="av1"', "");
await SpecialPowers.pushPrefEnv({"set": [["media.av1.enabled", true]]});
check("video/webm; codecs=\"av1\"", "probably");
await SpecialPowers.pushPrefEnv({"set": [["media.av1.enabled", false]]});
check("video/webm; codecs=\"av1\"", "");
}

View File

@ -4,20 +4,16 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* eslint-env mozilla/frame-script */
"use strict";
// eslint-disable-next-line mozilla/use-services
const dirSvc = Cc["@mozilla.org/file/directory_service;1"].getService(
Ci.nsIProperties
);
const dirSvc = Cc["@mozilla.org/file/directory_service;1"].
getService(Ci.nsIProperties);
addMessageListener("media-test:getcwd", () => {
addMessageListener('media-test:getcwd', () => {
let cwd;
try {
cwd = dirSvc.get("CurWorkD", Ci.nsIFile).path;
} finally {
sendAsyncMessage("media-test:cwd", cwd);
sendAsyncMessage('media-test:cwd', cwd);
}
});

View File

@ -1,7 +1,5 @@
const TEST_VIDEO_1 =
"http://mochi.test:8888/tests/dom/media/test/bipbop_225w_175kbps.mp4";
const TEST_VIDEO_2 =
"http://mochi.test:8888/tests/dom/media/test/pixel_aspect_ratio.mp4";
const TEST_VIDEO_1 = "http://mochi.test:8888/tests/dom/media/test/bipbop_225w_175kbps.mp4";
const TEST_VIDEO_2 = "http://mochi.test:8888/tests/dom/media/test/pixel_aspect_ratio.mp4";
const LONG_VIDEO = "http://mochi.test:8888/tests/dom/media/test/gizmo.mp4";
/**
@ -11,11 +9,11 @@ const LONG_VIDEO = "http://mochi.test:8888/tests/dom/media/test/gizmo.mp4";
async function setup() {
await SpecialPowers.pushPrefEnv({
set: [
["media.test.video-suspend", true],
["media.suspend-bkgnd-video.enabled", true],
["media.suspend-bkgnd-video.delay-ms", 500],
["media.dormant-on-pause-timeout-ms", 0],
["media.cloneElementVisually.testing", true],
[ "media.test.video-suspend", true ],
[ "media.suspend-bkgnd-video.enabled", true ],
[ "media.suspend-bkgnd-video.delay-ms", 500 ],
[ "media.dormant-on-pause-timeout-ms", 0 ],
[ "media.cloneElementVisually.testing", true ],
],
});
@ -91,19 +89,11 @@ async function assertVideosMatch(video1, video2) {
let video2Frame = captureFrameImageData(video2);
let left = document.getElementById("left");
let leftCtx = getWrappedScaledCanvasContext(
left,
video1Frame.width,
video1Frame.height
);
let leftCtx = getWrappedScaledCanvasContext(left, video1Frame.width, video1Frame.height);
leftCtx.putImageData(video1Frame, 0, 0);
let right = document.getElementById("right");
let rightCtx = getWrappedScaledCanvasContext(
right,
video2Frame.width,
video2Frame.height
);
let rightCtx = getWrappedScaledCanvasContext(right, video2Frame.width, video2Frame.height);
rightCtx.putImageData(video2Frame, 0, 0);
if (video1Frame.data.length != video2Frame.data.length) {
@ -220,7 +210,7 @@ async function ensureVideoSuspendable(video) {
video.setVisible(false);
await suspendPromise;
ok(true, "Suspended after the video was made invisible.");
video.setVisible(true);
video.setVisible(true)
ok(!video.hasSuspendTaint(), "Should still be suspendable.");
@ -230,3 +220,5 @@ async function ensureVideoSuspendable(video) {
ok(true, "Shutdown decoder after the video was paused.");
await video.play();
}

View File

@ -1,14 +1,10 @@
/* import-globals-from manifest.js */
const CLEARKEY_KEYSYSTEM = "org.w3.clearkey";
const gCencMediaKeySystemConfig = [
{
initDataTypes: ["cenc"],
videoCapabilities: [{ contentType: "video/mp4" }],
audioCapabilities: [{ contentType: "audio/mp4" }],
},
];
const gCencMediaKeySystemConfig = [{
initDataTypes: ['cenc'],
videoCapabilities: [{ contentType: 'video/mp4' }],
audioCapabilities: [{ contentType: 'audio/mp4' }],
}];
function IsMacOSSnowLeopardOrEarlier() {
var re = /Mac OS X (\d+)\.(\d+)/;
@ -21,21 +17,23 @@ function IsMacOSSnowLeopardOrEarlier() {
return major == 10 && minor <= 6;
}
function bail(message) {
function bail(message)
{
return function(err) {
if (err) {
message += "; " + String(err);
message += "; " + String(err)
}
ok(false, message);
if (err) {
info(String(err));
}
SimpleTest.finish();
};
}
}
function ArrayBufferToString(arr) {
var str = "";
function ArrayBufferToString(arr)
{
var str = '';
var view = new Uint8Array(arr);
for (var i = 0; i < view.length; i++) {
str += String.fromCharCode(view[i]);
@ -43,7 +41,8 @@ function ArrayBufferToString(arr) {
return str;
}
function StringToArrayBuffer(str) {
function StringToArrayBuffer(str)
{
var arr = new ArrayBuffer(str.length);
var view = new Uint8Array(arr);
for (var i = 0; i < str.length; i++) {
@ -52,15 +51,16 @@ function StringToArrayBuffer(str) {
return arr;
}
function StringToHex(str) {
function StringToHex(str){
var res = "";
for (var i = 0; i < str.length; ++i) {
res += ("0" + str.charCodeAt(i).toString(16)).slice(-2);
res += ("0" + str.charCodeAt(i).toString(16)).slice(-2);
}
return res;
}
function Base64ToHex(str) {
function Base64ToHex(str)
{
var bin = window.atob(str.replace(/-/g, "+").replace(/_/g, "/"));
var res = "";
for (var i = 0; i < bin.length; i++) {
@ -69,56 +69,46 @@ function Base64ToHex(str) {
return res;
}
function HexToBase64(hex) {
function HexToBase64(hex)
{
var bin = "";
for (var i = 0; i < hex.length; i += 2) {
bin += String.fromCharCode(parseInt(hex.substr(i, 2), 16));
}
return window
.btoa(bin)
.replace(/=/g, "")
.replace(/\+/g, "-")
.replace(/\//g, "_");
return window.btoa(bin).replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_");
}
function TimeRangesToString(trs) {
function TimeRangesToString(trs)
{
var l = trs.length;
if (l === 0) {
return "-";
}
if (l === 0) { return "-"; }
var s = "";
var i = 0;
for (;;) {
s += trs.start(i) + "-" + trs.end(i);
if (++i === l) {
return s;
}
if (++i === l) { return s; }
s += ",";
}
}
function SourceBufferToString(sb) {
return (
"SourceBuffer{" +
"AppendMode=" +
(sb.AppendMode || "-") +
", updating=" +
(sb.updating ? "true" : "false") +
", buffered=" +
TimeRangesToString(sb.buffered) +
", audioTracks=" +
(sb.audioTracks ? sb.audioTracks.length : "-") +
", videoTracks=" +
(sb.videoTracks ? sb.videoTracks.length : "-") +
"}"
);
function SourceBufferToString(sb)
{
return ("SourceBuffer{"
+ "AppendMode=" + (sb.AppendMode || "-")
+ ", updating=" + (sb.updating ? "true" : "false")
+ ", buffered=" + TimeRangesToString(sb.buffered)
+ ", audioTracks=" + (sb.audioTracks ? sb.audioTracks.length : "-")
+ ", videoTracks=" + (sb.videoTracks ? sb.videoTracks.length : "-")
+ "}");
}
function SourceBufferListToString(sbl) {
function SourceBufferListToString(sbl)
{
return "SourceBufferList[" + sbl.map(SourceBufferToString).join(", ") + "]";
}
function GenerateClearKeyLicense(licenseRequest, keyStore) {
function GenerateClearKeyLicense(licenseRequest, keyStore)
{
var msgStr = ArrayBufferToString(licenseRequest);
var msg = JSON.parse(msgStr);
@ -130,51 +120,47 @@ function GenerateClearKeyLicense(licenseRequest, keyStore) {
if (key) {
keys.push({
kty: "oct",
kid: id64,
k: HexToBase64(key),
"kty": "oct",
"kid": id64,
"k": HexToBase64(key)
});
}
}
return new TextEncoder().encode(
JSON.stringify({
keys,
type: msg.type || "temporary",
})
);
return new TextEncoder().encode(JSON.stringify({
"keys" : keys,
"type" : msg.type || "temporary"
}));
}
function UpdateSessionFunc(test, token, sessionType, resolve, reject) {
return function(ev) {
var license = GenerateClearKeyLicense(ev.message, test.keys);
Log(
token,
"sending update message to CDM: " + new TextDecoder().decode(license)
);
ev.target
.update(license)
.then(function() {
Log(token, "MediaKeySession update ok!");
resolve(ev.target);
})
.catch(function(reason) {
reject(`${token} MediaKeySession update failed: ${reason}`);
});
};
Log(token, "sending update message to CDM: " + (new TextDecoder().decode(license)));
ev.target.update(license).then(function() {
Log(token, "MediaKeySession update ok!");
resolve(ev.target);
}).catch(function(reason) {
reject(`${token} MediaKeySession update failed: ${reason}`);
});
}
}
function MaybeCrossOriginURI(test, uri) {
function MaybeCrossOriginURI(test, uri)
{
if (test.crossOrigin) {
return "https://example.com:443/tests/dom/media/test/allowed.sjs?" + uri;
} else {
return uri;
}
return uri;
}
function AppendTrack(test, ms, track, token) {
function AppendTrack(test, ms, track, token)
{
return new Promise(function(resolve, reject) {
var sb;
var curFragment = 0;
var resolved = false;
var fragments = track.fragments;
var fragmentFile;
@ -182,6 +168,7 @@ function AppendTrack(test, ms, track, token) {
if (curFragment >= fragments.length) {
Log(token, track.name + ": end of track");
resolve();
resolved = true;
return;
}
@ -192,10 +179,7 @@ function AppendTrack(test, ms, track, token) {
req.responseType = "arraybuffer";
req.addEventListener("load", function() {
Log(
token,
track.name + ": fetch of " + fragmentFile + " complete, appending"
);
Log(token, track.name + ": fetch of " + fragmentFile + " complete, appending");
sb.appendBuffer(new Uint8Array(req.response));
});
@ -206,26 +190,14 @@ function AppendTrack(test, ms, track, token) {
reject(`${token} - ${track.name}: aborted fetching ${fragmentFile}`);
});
Log(
token,
track.name +
": addNextFragment() fetching next fragment " +
fragmentFile
);
Log(token, track.name + ": addNextFragment() fetching next fragment " + fragmentFile);
req.send(null);
}
Log(token, track.name + ": addSourceBuffer(" + track.type + ")");
sb = ms.addSourceBuffer(track.type);
sb.addEventListener("updateend", function() {
Log(
token,
track.name +
": updateend for " +
fragmentFile +
", " +
SourceBufferToString(sb)
);
Log(token, track.name + ": updateend for " + fragmentFile + ", " + SourceBufferToString(sb));
addNextFragment();
});
@ -235,7 +207,8 @@ function AppendTrack(test, ms, track, token) {
//Returns a promise that is resolved when the media element is ready to have
//its play() function called; when it's loaded MSE fragments.
function LoadTest(test, elem, token, endOfStream = true) {
function LoadTest(test, elem, token, endOfStream = true)
{
if (!test.tracks) {
ok(false, token + " test does not have a tracks list");
return Promise.reject();
@ -245,27 +218,19 @@ function LoadTest(test, elem, token, endOfStream = true) {
elem.src = URL.createObjectURL(ms);
elem.crossOrigin = test.crossOrigin || false;
return new Promise(function(resolve, reject) {
ms.addEventListener(
"sourceopen",
function() {
Log(token, "sourceopen");
Promise.all(
test.tracks.map(function(track) {
return AppendTrack(test, ms, track, token);
})
)
.then(function() {
Log(token, "Tracks loaded, calling MediaSource.endOfStream()");
if (endOfStream) {
ms.endOfStream();
}
resolve();
})
.catch(reject);
},
{ once: true }
);
return new Promise(function (resolve, reject) {
ms.addEventListener("sourceopen", function () {
Log(token, "sourceopen");
Promise.all(test.tracks.map(function(track) {
return AppendTrack(test, ms, track, token);
})).then(function() {
Log(token, "Tracks loaded, calling MediaSource.endOfStream()");
if (endOfStream) {
ms.endOfStream();
}
resolve();
}).catch(reject);
}, {once: true});
});
}
@ -283,7 +248,7 @@ function EMEPromise() {
* or will be rejected with a string that describes the failure.
*/
function CreateMediaKeys(v, test, token) {
let p = new EMEPromise();
let p = new EMEPromise;
function streamType(type) {
var x = test.tracks.find(o => o.name == type);
@ -293,24 +258,21 @@ function CreateMediaKeys(v, test, token) {
function onencrypted(ev) {
var options = { initDataTypes: [ev.initDataType] };
if (streamType("video")) {
options.videoCapabilities = [{ contentType: streamType("video") }];
options.videoCapabilities = [{contentType: streamType("video")}];
}
if (streamType("audio")) {
options.audioCapabilities = [{ contentType: streamType("audio") }];
options.audioCapabilities = [{contentType: streamType("audio")}];
}
navigator.requestMediaKeySystemAccess(CLEARKEY_KEYSYSTEM, [options]).then(
keySystemAccess => {
keySystemAccess
.createMediaKeys()
.then(p.resolve, () =>
p.reject(`${token} Failed to create MediaKeys object.`)
);
},
() => p.reject(`${token} Failed to request key system access.`)
);
navigator.requestMediaKeySystemAccess(CLEARKEY_KEYSYSTEM, [options])
.then(keySystemAccess => {
keySystemAccess.createMediaKeys().then(
p.resolve,
() => p.reject(`${token} Failed to create MediaKeys object.`)
);
}, () => p.reject(`${token} Failed to request key system access.`));
}
v.addEventListener("encrypted", onencrypted, { once: true });
v.addEventListener("encrypted", onencrypted, {once: true});
return p.promise;
}
@ -320,13 +282,14 @@ function CreateMediaKeys(v, test, token) {
* with a string that describes the failure.
*/
function CreateAndSetMediaKeys(v, test, token) {
let p = new EMEPromise();
let p = new EMEPromise;
CreateMediaKeys(v, test, token).then(mediaKeys => {
v.setMediaKeys(mediaKeys).then(p.resolve, () =>
p.reject(`${token} Failed to set MediaKeys on <video> element.`)
v.setMediaKeys(mediaKeys).then(
p.resolve,
() => p.reject(`${token} Failed to set MediaKeys on <video> element.`)
);
}, p.reject);
}, p.reject)
return p.promise;
}
@ -337,25 +300,18 @@ function CreateAndSetMediaKeys(v, test, token) {
* is completed (specified by test.sessionCount).
*/
function LoadInitData(v, test, token) {
let p = new EMEPromise();
let p = new EMEPromise;
let initDataQueue = [];
// Call SimpleTest._originalSetTimeout() to bypass the flaky timeout checker.
let timer = SimpleTest._originalSetTimeout.call(
window,
() => {
p.reject(`${token} Timed out in waiting for the init data.`);
},
60000
);
let timer = SimpleTest._originalSetTimeout.call(window, () => {
p.reject(`${token} Timed out in waiting for the init data.`);
}, 60000);
function onencrypted(ev) {
initDataQueue.push(ev);
Log(
token,
`got encrypted(${ev.initDataType}, ` +
`${StringToHex(ArrayBufferToString(ev.initData))}) event.`
);
Log(token, `got encrypted(${ev.initDataType}, ` +
`${StringToHex(ArrayBufferToString(ev.initData))}) event.`);
if (test.sessionCount == initDataQueue.length) {
p.resolve(initDataQueue);
clearTimeout(timer);
@ -373,18 +329,16 @@ function LoadInitData(v, test, token) {
*/
function MakeRequest(test, token, ev, session, sessionType) {
sessionType = sessionType || "temporary";
let p = new EMEPromise();
let str =
`session[${session.sessionId}].generateRequest(` +
let p = new EMEPromise;
let str = `session[${session.sessionId}].generateRequest(` +
`${ev.initDataType}, ${StringToHex(ArrayBufferToString(ev.initData))})`;
session.addEventListener(
"message",
UpdateSessionFunc(test, token, sessionType, p.resolve, p.reject)
);
session.addEventListener("message",
UpdateSessionFunc(test, token, sessionType, p.resolve, p.reject));
Log(token, str);
session.generateRequest(ev.initDataType, ev.initData).catch(reason => {
session.generateRequest(ev.initDataType, ev.initData)
.catch(reason => {
// Reject the promise if generateRequest() failed.
// Otherwise it will be resolved in UpdateSessionFunc().
p.reject(`${token}: ${str} failed; ${reason}`);
@ -421,7 +375,8 @@ function CleanUpMedia(v) {
* Close all sessions and clean up the |v| element.
*/
function CloseSessions(v, sessions) {
return Promise.all(sessions.map(s => s.close())).then(CleanUpMedia(v));
return Promise.all(sessions.map(s => s.close()))
.then(CleanUpMedia(v));
}
/*
@ -430,41 +385,38 @@ function CloseSessions(v, sessions) {
* if any failure.
*/
function SetupEME(v, test, token) {
let p = new EMEPromise();
let p = new EMEPromise;
v.onerror = function() {
p.reject(`${token} got an error event.`);
};
}
Promise.all([
LoadInitData(v, test, token),
CreateAndSetMediaKeys(v, test, token),
LoadTest(test, v, token),
])
.then(values => {
let initData = values[0];
return ProcessInitData(v, test, token, initData);
})
.then(p.resolve, p.reject);
LoadTest(test, v, token)])
.then(values => {
let initData = values[0];
return ProcessInitData(v, test, token, initData);
})
.then(p.resolve, p.reject);
return p.promise;
}
function SetupEMEPref(callback) {
var prefs = [
["media.mediasource.enabled", true],
["media.mediasource.webm.enabled", true],
[ "media.mediasource.enabled", true ],
[ "media.mediasource.webm.enabled", true ],
];
if (
SpecialPowers.Services.appinfo.name == "B2G" ||
!manifestVideo().canPlayType("video/mp4")
) {
if (SpecialPowers.Services.appinfo.name == "B2G" ||
!manifestVideo().canPlayType("video/mp4")) {
// XXX remove once we have mp4 PlatformDecoderModules on all platforms.
prefs.push(["media.use-blank-decoder", true]);
prefs.push([ "media.use-blank-decoder", true ]);
}
SpecialPowers.pushPrefEnv({ set: prefs }, callback);
SpecialPowers.pushPrefEnv({ "set" : prefs }, callback);
}
function fetchWithXHR(uri, onLoadFunction) {
@ -472,12 +424,8 @@ function fetchWithXHR(uri, onLoadFunction) {
var xhr = new XMLHttpRequest();
xhr.open("GET", uri, true);
xhr.responseType = "arraybuffer";
xhr.addEventListener("load", function() {
is(
xhr.status,
200,
"fetchWithXHR load uri='" + uri + "' status=" + xhr.status
);
xhr.addEventListener("load", function () {
is(xhr.status, 200, "fetchWithXHR load uri='" + uri + "' status=" + xhr.status);
resolve(xhr.response);
});
xhr.send();
@ -488,17 +436,13 @@ function fetchWithXHR(uri, onLoadFunction) {
}
return p;
}
};
function once(target, name, cb) {
var p = new Promise(function(resolve, reject) {
target.addEventListener(
name,
function(arg) {
resolve(arg);
},
{ once: true }
);
target.addEventListener(name, function(arg) {
resolve(arg);
}, {once: true});
});
if (cb) {
p.then(cb);

View File

@ -23,7 +23,7 @@
} else if (event.data == "play-muted") {
playAndPostResult(true, event.source);
}
});
}, false);
let w = window.opener || window.parent;
w.postMessage("ready", "*");
</script>

View File

@ -36,12 +36,12 @@
let x = eventNames.map(
(eventName) => {
return new Promise(function (resolve, reject) {
return new Promise(async function (resolve, reject) {
window.addEventListener(eventName, async function (event) {
let p = await element.play().then(() => true, () => false);
ok(p, "Expect to be activated already in " + eventName);
let played = await element.play().then(() => true, () => false);
ok(played, "Expect to be activated already in " + eventName);
resolve();
});
}, false);
});
});

View File

@ -1,19 +1,14 @@
function test_fragment_noplay(v, start, end, is, ok, finish) {
function onLoadedMetadata() {
var s = start == null ? 0 : start;
var e = end == null ? v.duration : end;
var a = s - 0.15;
var b = s + 0.15;
ok(
v.currentTime >= a && v.currentTime <= b,
"loadedmetadata currentTime is " + a + " < " + v.currentTime + " < " + b
);
ok(
v.mozFragmentEnd == e,
"mozFragmentEnd (" + v.mozFragmentEnd + ") == end Time (" + e + ")"
);
finish();
}
v.addEventListener("loadedmetadata", onLoadedMetadata);
function onLoadedMetadata() {
var s = start == null ? 0 : start;
var e = end == null ? v.duration : end;
var a = s - 0.15;
var b = s + 0.15;
ok(v.currentTime >= a && v.currentTime <= b, "loadedmetadata currentTime is " + a + " < " + v.currentTime + " < " + b);
ok(v.mozFragmentEnd == e, "mozFragmentEnd (" + v.mozFragmentEnd + ") == end Time (" + e + ")");
finish();
}
v.addEventListener("loadedmetadata", onLoadedMetadata);
}

View File

@ -1,92 +1,67 @@
function test_fragment_play(v, start, end, is, ok, finish) {
var completed = false;
var loadedMetadataRaised = false;
var seekedRaised = false;
var pausedRaised = false;
function onLoadedMetadata() {
var s = start == null ? 0 : start;
var e = end == null ? v.duration : end;
ok(
v.currentTime == s,
"loadedmetadata currentTime is " + v.currentTime + " != " + s
);
ok(
v.mozFragmentEnd == e,
"mozFragmentEnd (" + v.mozFragmentEnd + ") == end Time (" + e + ")"
);
loadedMetadataRaised = true;
v.play();
}
var completed = false;
var loadedMetadataRaised = false;
var seekedRaised = false;
var pausedRaised = false;
function onSeeked() {
if (completed) {
return;
}
var s = start == null ? 0 : start;
ok(
v.currentTime - s < 0.1,
"seeked currentTime is " +
v.currentTime +
" != " +
s +
" (fuzzy compare +-0.1)"
);
seekedRaised = true;
}
function onTimeUpdate() {
if (completed) {
return;
}
v._lastTimeUpdate = v.currentTime;
}
function onPause() {
if (completed) {
return;
}
var e = end == null ? v.duration : end;
var a = e - 0.05;
var b = e + 0.05;
ok(
v.currentTime >= a && v.currentTime <= b,
"paused currentTime is " +
a +
" < " +
v.currentTime +
" < " +
b +
" ? " +
v._lastTimeUpdate
);
pausedRaised = true;
v.play();
}
function onEnded() {
if (completed) {
return;
}
completed = true;
ok(loadedMetadataRaised, "loadedmetadata event");
if (start) {
ok(seekedRaised, "seeked event");
}
if (end) {
ok(pausedRaised, "paused event: " + end + " " + v.duration);
}
finish();
}
v.addEventListener("ended", onEnded);
v.addEventListener("loadedmetadata", onLoadedMetadata);
v.addEventListener("seeked", onSeeked);
v.addEventListener("pause", onPause);
v.addEventListener("timeupdate", onTimeUpdate);
function onLoadedMetadata() {
var s = start == null ? 0 : start;
var e = end == null ? v.duration : end;
ok(v.currentTime == s, "loadedmetadata currentTime is " + v.currentTime + " != " + s);
ok(v.mozFragmentEnd == e, "mozFragmentEnd (" + v.mozFragmentEnd + ") == end Time (" + e + ")");
loadedMetadataRaised = true;
v.play();
}
function onSeeked() {
if (completed)
return;
var s = start == null ? 0 : start;
ok(v.currentTime - s < 0.1, "seeked currentTime is " + v.currentTime + " != " + s + " (fuzzy compare +-0.1)");
seekedRaised = true;
}
function onTimeUpdate() {
if (completed)
return;
v._lastTimeUpdate = v.currentTime;
}
function onPause() {
if (completed)
return;
var e = end == null ? v.duration : end;
var a = e - 0.05;
var b = e + 0.05;
ok(v.currentTime >= a && v.currentTime <= b, "paused currentTime is " + a + " < " + v.currentTime + " < " + b + " ? " + v._lastTimeUpdate);
pausedRaised = true;
v.play();
}
function onEnded() {
if (completed)
return;
completed = true;
ok(loadedMetadataRaised, "loadedmetadata event");
if (start) {
ok(seekedRaised, "seeked event");
}
if (end) {
ok(pausedRaised, "paused event: " + end + " " + v.duration);
}
finish();
}
v.addEventListener("ended", onEnded);
v.addEventListener("loadedmetadata", onLoadedMetadata);
v.addEventListener("seeked", onSeeked);
v.addEventListener("pause", onPause);
v.addEventListener("timeupdate", onTimeUpdate);
}

View File

@ -9,26 +9,17 @@ async function pushGetUserMediaTestPrefs({
fakeAudio = false,
fakeVideo = false,
loopbackAudio = false,
loopbackVideo = false,
}) {
loopbackVideo = false}) {
// Make sure we have sensical arguments
if (!fakeAudio && !loopbackAudio) {
throw new Error(
"pushGetUserMediaTestPrefs: Should have fake or loopback audio!"
);
throw new Error("pushGetUserMediaTestPrefs: Should have fake or loopback audio!");
} else if (fakeAudio && loopbackAudio) {
throw new Error(
"pushGetUserMediaTestPrefs: Should not have both fake and loopback audio!"
);
throw new Error("pushGetUserMediaTestPrefs: Should not have both fake and loopback audio!");
}
if (!fakeVideo && !loopbackVideo) {
throw new Error(
"pushGetUserMediaTestPrefs: Should have fake or loopback video!"
);
throw new Error("pushGetUserMediaTestPrefs: Should have fake or loopback video!");
} else if (fakeVideo && loopbackVideo) {
throw new Error(
"pushGetUserMediaTestPrefs: Should not have both fake and loopback video!"
);
throw new Error("pushGetUserMediaTestPrefs: Should not have both fake and loopback video!");
}
let testPrefs = [];
@ -41,15 +32,10 @@ async function pushGetUserMediaTestPrefs({
if (loopbackAudio) {
// If audio loopback is requested we expect the test harness to have set
// the loopback device pref, make sure it's set
let audioLoopDev = SpecialPowers.getCharPref(
"media.audio_loopback_dev",
""
);
let audioLoopDev = SpecialPowers.getCharPref("media.audio_loopback_dev", "");
if (!audioLoopDev) {
throw new Error(
"pushGetUserMediaTestPrefs: Loopback audio requested but " +
"media.audio_loopback_dev does not appear to be set!"
);
throw new Error("pushGetUserMediaTestPrefs: Loopback audio requested but " +
"media.audio_loopback_dev does not appear to be set!");
}
}
if (fakeVideo) {
@ -61,23 +47,18 @@ async function pushGetUserMediaTestPrefs({
if (loopbackVideo) {
// If video loopback is requested we expect the test harness to have set
// the loopback device pref, make sure it's set
let videoLoopDev = SpecialPowers.getCharPref(
"media.video_loopback_dev",
""
);
let videoLoopDev = SpecialPowers.getCharPref("media.video_loopback_dev", "");
if (!videoLoopDev) {
throw new Error(
"pushGetUserMediaTestPrefs: Loopback video requested but " +
"media.video_loopback_dev does not appear to be set!"
);
throw new Error("pushGetUserMediaTestPrefs: Loopback video requested but " +
"media.video_loopback_dev does not appear to be set!");
}
}
if (loopbackAudio || loopbackVideo) {
// Prevent gUM permission prompt. Since loopback devices are considered
// real devices we need to set prefs so the gUM prompt isn't presented.
testPrefs.push(["media.navigator.permission.disabled", true]);
testPrefs.push(['media.navigator.permission.disabled', true]);
}
return SpecialPowers.pushPrefEnv({ set: testPrefs });
return SpecialPowers.pushPrefEnv({set: testPrefs});
}
// Setup preconditions for tests using getUserMedia. This function will
@ -85,7 +66,7 @@ async function pushGetUserMediaTestPrefs({
// names already set in the prefs. If no loopback device name can be found then
// prefs are setup such that a fake device is used.
async function setupGetUserMediaTestPrefs() {
let prefRequests = {};
prefRequests = {};
let audioLoopDev = SpecialPowers.getCharPref("media.audio_loopback_dev", "");
if (audioLoopDev) {
prefRequests.fakeAudio = false;

File diff suppressed because it is too large Load Diff

View File

@ -1,20 +1,18 @@
/* global video, result, resolve */
video.mozRequestDebugInfo().then(debugInfo => {
// The parsing won't be necessary once we have bug 1542674
try {
debugInfo = debugInfo.replace(/\t/g, "").split(/\n/g);
debugInfo = debugInfo.replace(/\t/g, '').split(/\n/g);
var JSONDebugInfo = "{";
for (let g = 0; g < debugInfo.length - 1; g++) {
var pair = debugInfo[g].split(": ");
JSONDebugInfo += '"' + pair[0] + '":"' + pair[1] + '",';
}
JSONDebugInfo = JSONDebugInfo.slice(0, JSONDebugInfo.length - 1);
JSONDebugInfo += "}";
result.mozRequestDebugInfo = JSON.parse(JSONDebugInfo);
for(let g =0; g<debugInfo.length-1; g++){
var pair = debugInfo[g].split(": ");
JSONDebugInfo += '"' + pair[0] + '":"' + pair[1] + '",';
}
JSONDebugInfo = JSONDebugInfo.slice(0,JSONDebugInfo.length-1);
JSONDebugInfo += "}";
result["mozRequestDebugInfo"] = JSON.parse(JSONDebugInfo);
} catch (err) {
console.log(`Error '${err.toString()} in JSON.parse(${debugInfo})`);
result.mozRequestDebugInfo = debugInfo;
result["mozRequestDebugInfo"] = debugInfo;
}
resolve(result);
});

View File

@ -2,29 +2,23 @@
// https://addons.mozilla.org/en-US/firefox/addon/youtube-auto-hd-lq/
// licence: MPL 2.0
var config = {
HD: true,
LQ: false,
ID: "auto-hd-lq-for-ytb",
type(t) {
config.HD = t === "hd";
config.LQ = t === "lq";
"HD": true,
"LQ": false,
"ID": "auto-hd-lq-for-ytb",
"type": function (t) {
config.HD = t === 'hd';
config.LQ = t === 'lq';
},
quality() {
"quality": function () {
if (config.HD || config.LQ) {
var youtubePlayerListener = function(LQ, HD) {
return function(e) {
var youtubePlayerListener = function (LQ, HD) {
return function youtubePlayerListener (e) {
if (e === 1) {
var player = document.getElementById("movie_player");
var player = document.getElementById('movie_player');
if (player) {
var levels = player.getAvailableQualityLevels();
if (levels.length) {
var q =
// eslint-disable-next-line no-nested-ternary
HD && levels[0]
? levels[0]
: LQ && levels[levels.length - 2]
? levels[levels.length - 2]
: null;
var q = (HD && levels[0]) ? levels[0] : ((LQ && levels[levels.length - 2]) ? levels[levels.length - 2] : null);
if (q) {
player.setPlaybackQuality(q);
player.setPlaybackQualityRange(q, q);
@ -32,17 +26,15 @@ var config = {
}
}
}
};
};
}
}
/* */
var inject = function() {
var action = function() {
var player = document.getElementById("movie_player");
var inject = function () {
var action = function () {
var player = document.getElementById('movie_player');
if (player && player.addEventListener && player.getPlayerState) {
player.addEventListener("onStateChange", "youtubePlayerListener");
} else {
window.setTimeout(action, 1000);
}
} else window.setTimeout(action, 1000);
};
/* */
action();
@ -55,37 +47,27 @@ var config = {
document.documentElement.appendChild(script);
}
/* */
script.textContent =
"var youtubePlayerListener = (" +
youtubePlayerListener +
")(" +
config.LQ +
"," +
config.HD +
");(" +
inject +
")();";
script.textContent = "var youtubePlayerListener = (" + youtubePlayerListener + ')(' + config.LQ + ',' + config.HD + ');(' + inject + ')();';
}
},
}
};
if (/^https?:\/\/www\.youtube.com\/watch\?/.test(document.location.href)) {
config.quality();
}
var content = document.getElementById("content");
if (content) {
var observer = new window.MutationObserver(function(e) {
e.forEach(function(m) {
if (m.addedNodes !== null) {
for (var i = 0; i < m.addedNodes.length; i++) {
if (m.addedNodes[i].id === "movie_player") {
config.quality();
return;
if (/^https?:\/\/www\.youtube.com\/watch\?/.test(document.location.href)) config.quality();
var content = document.getElementById('content');
if (content) {
var observer = new window.MutationObserver(function (e) {
e.forEach(function (m) {
if (m.addedNodes !== null) {
for (var i = 0; i < m.addedNodes.length; i++) {
if (m.addedNodes[i].id === 'movie_player') {
config.quality();
return;
}
}
}
}
});
});
});
/* */
observer.observe(content, { childList: true, subtree: true });
}
/* */
observer.observe(content, {"childList": true, "subtree": true});
}

View File

@ -1,2 +1 @@
/* global video */
var result = { getVideoPlaybackQuality: video.getVideoPlaybackQuality() };
var result = {"getVideoPlaybackQuality": video.getVideoPlaybackQuality()};

View File

@ -1,3 +1,3 @@
function getNotSupportedFile(name) {
return name + ".bad";
}
}

View File

@ -1,20 +1,16 @@
// This file expects manifest.js to be included in the same scope.
/* import-globals-from manifest.js */
// This file expects SEEK_TEST_NUMBER to be defined by the test.
/* global SEEK_TEST_NUMBER */
var manager = new MediaTestManager();
var manager = new MediaTestManager;
function createTestArray() {
var tests = [];
var tmpVid = document.createElement("video");
for (var testNum = 0; testNum < gSeekTests.length; testNum++) {
for (var testNum=0; testNum<gSeekTests.length; testNum++) {
var test = gSeekTests[testNum];
if (!tmpVid.canPlayType(test.type)) {
continue;
}
var t = {};
var t = new Object;
t.name = test.name;
t.type = test.type;
t.duration = test.duration;
@ -25,37 +21,25 @@ function createTestArray() {
}
function startTest(test, token) {
var video = document.createElement("video");
video.token = token += "-seek" + test.number + ".js";
manager.started(video.token);
video.src = test.name;
video.preload = "metadata";
document.body.appendChild(video);
var v = document.createElement('video');
v.token = token += "-seek" + test.number + ".js";
manager.started(v.token);
v.src = test.name;
v.preload = "metadata";
document.body.appendChild(v);
var name = test.name + " seek test " + test.number;
var localIs = (function(n) {
return function(a, b, msg) {
is(a, b, n + ": " + msg);
};
})(name);
var localOk = (function(n) {
return function(a, msg) {
ok(a, n + ": " + msg);
};
})(name);
var localFinish = (function(v, m) {
return function() {
v.onerror = null;
removeNodeAndSource(v);
dump("SEEK-TEST: Finished " + name + " token: " + v.token + "\n");
m.finished(v.token);
};
})(video, manager);
var localIs = function(name) { return function(a, b, msg) {
is(a, b, name + ": " + msg);
}}(name);
var localOk = function(name) { return function(a, msg) {
ok(a, name + ": " + msg);
}}(name);
var localFinish = function(v, manager) { return function() {
v.onerror = null;
removeNodeAndSource(v);
dump("SEEK-TEST: Finished " + name + " token: " + v.token + "\n");
manager.finished(v.token);
}}(v, manager);
dump("SEEK-TEST: Started " + name + "\n");
window["test_seek" + test.number](
video,
test.duration / 2,
localIs,
localOk,
localFinish
);
window['test_seek' + test.number](v, test.duration/2, localIs, localOk, localFinish);
}

View File

@ -41,10 +41,8 @@ function receiveMessage(event)
return;
}
if (event.data.done == "true") {
done();
return;
}
if (event.data.done == "true")
return done();
ok(event.data.result, event.data.message);
}

View File

@ -136,7 +136,7 @@
let child_url = "file_autoplay_policy_activation_window.html";
async function runTest() {
for (const test_case of test_cases) {
for (test_case of test_cases) {
// Run each test in a new window, to ensure its user gesture
// activation state isn't tainted by preceeding tests.
let child = window.open(child_url, "", "width=500,height=500");

View File

@ -31,7 +31,7 @@
let child = window.open(child_url, "", "width=500,height=500");
await once(child, "load");
child.postMessage("run keydown test", window.origin);
await nextWindowMessage();
let result = await nextWindowMessage();
child.close();
}
@ -39,7 +39,7 @@
let child = window.open(child_url, "", "width=500,height=500");
await once(child, "load");
child.postMessage("run mousedown test", window.origin);
await nextWindowMessage();
let result = await nextWindowMessage();
child.close();
}

View File

@ -33,7 +33,7 @@
let child = window.open(child_url, "", "width=500,height=500");
await once(child, "load");
child.postMessage("run test", window.origin);
await nextWindowMessage();
let result = await nextWindowMessage();
child.close();
SimpleTest.finish();
}

View File

@ -52,13 +52,13 @@
let child_url = "file_autoplay_policy_play_before_loadedmetadata.html";
async function runTest() {
for (const testCase of testCases) {
for (testCase of testCases) {
// Run each test in a new window, to ensure its user gesture
// activation state isn't tainted by preceeding tests.
let child = window.open(child_url, "", "width=500,height=500");
await once(child, "load");
child.postMessage(testCase, window.origin);
await nextWindowMessage();
let result = await nextWindowMessage();
child.close();
}
SimpleTest.finish();

View File

@ -43,13 +43,13 @@
let child_url = "file_autoplay_policy_unmute_pauses.html";
async function runTest() {
for (const testCase of testCases) {
for (testCase of testCases) {
// Run each test in a new window, to ensure its user gesture
// activation state isn't tainted by preceeding tests.
let child = window.open(child_url, "", "width=500,height=500");
await once(child, "load");
child.postMessage(testCase, window.origin);
await nextWindowMessage();
let result = await nextWindowMessage();
child.close();
}
SimpleTest.finish();

View File

@ -51,7 +51,6 @@ function setupTestPreferences() {
}
function createAudioContext() {
/* global ac */
window.ac = new AudioContext();
ac.allowedToStart = new Promise(resolve => {
@ -102,7 +101,7 @@ function createAudioParams(nodeType) {
return [ac.createStereoPanner().pan];
default:
ok(false, `non-defined node type ${nodeType}.`);
return [];
return;
}
}

View File

@ -46,7 +46,6 @@ function setupTestPreferences() {
}
function createAudioContexts() {
/* global ac1, ac2 */
window.ac1 = new AudioContext();
window.ac2 = new AudioContext();

View File

@ -49,7 +49,6 @@ function setupTestPreferences() {
}
function createAudioContext() {
/* global ac */
window.ac = new AudioContext();
ac.allowedToStart = new Promise(resolve => {

View File

@ -49,7 +49,6 @@ function setupTestPreferences() {
}
async function createAudioContext() {
/* global ac */
window.ac = new AudioContext();
await once(ac, "blocked");
is(ac.state, "suspended", `AudioContext is blocked.`);

View File

@ -17,7 +17,9 @@ var manager = new MediaTestManager;
function drawVideoToCanvas(v) {
console.log('drawVideoToCanvas');
let c = document.createElement('canvas');
let w = v.width,
h = v.height,
c = document.createElement('canvas');
c.width = 4;
c.height = 4;
c.style.width = 64;
@ -73,4 +75,4 @@ startTest({
});
}
});
</script>
</script>

View File

@ -76,6 +76,6 @@
["privacy.reduceTimerPrecision", false]
],
tests: gDecodeSuspendTests,
runTest
runTest: runTest
});
</script>

View File

@ -50,6 +50,6 @@
["media.suspend-bkgnd-video.delay-ms", 1000]
],
tests: gDecodeSuspendTests,
runTest
runTest: runTest
});
</script>

View File

@ -11,7 +11,7 @@
var manager = new MediaTestManager;
function captureVideoAsStream(v) {
v.mozCaptureStream();
let stream = v.mozCaptureStream();
}
startTest({
@ -43,4 +43,4 @@ startTest({
});
}
});
</script>
</script>

View File

@ -36,32 +36,32 @@ function testBuffered(e) {
var caught = false;
try {
b.start(-1);
} catch (ex) {
caught = ex.name == "IndexSizeError" && ex.code == DOMException.INDEX_SIZE_ERR;
} catch (e) {
caught = e.name == "IndexSizeError" && e.code == DOMException.INDEX_SIZE_ERR;
}
is(caught, true, v._name + ": Should throw INDEX_SIZE_ERR on under start bounds range");
caught = false;
try {
b.end(-1);
} catch (ex) {
caught = ex.name == "IndexSizeError" && ex.code == DOMException.INDEX_SIZE_ERR;
} catch (e) {
caught = e.name == "IndexSizeError" && e.code == DOMException.INDEX_SIZE_ERR;
}
is(caught, true, v._name + ": Should throw INDEX_SIZE_ERR on under end bounds range");
caught = false;
try {
b.start(b.length);
} catch (ex) {
caught = ex.name == "IndexSizeError" && ex.code == DOMException.INDEX_SIZE_ERR;
} catch (e) {
caught = e.name == "IndexSizeError" && e.code == DOMException.INDEX_SIZE_ERR;
}
is(caught, true, v._name + ": Should throw INDEX_SIZE_ERR on over start bounds range");
caught = false;
try {
b.end(b.length);
} catch (ex) {
caught = ex.name == "IndexSizeError" && ex.code == DOMException.INDEX_SIZE_ERR;
} catch (e) {
caught = e.name == "IndexSizeError" && e.code == DOMException.INDEX_SIZE_ERR;
}
is(caught, true, v._name + ": Should throw INDEX_SIZE_ERR on over end bounds range");

View File

@ -13,7 +13,6 @@
SimpleTest.waitForExplicitFinish();
function doTest() {
/* global v */
window.oak = v.mozCaptureStreamUntilEnded();
v.mozCaptureStreamUntilEnded();
v.play();

View File

@ -16,8 +16,6 @@
*/
SimpleTest.waitForExplicitFinish();
/* global a, b */
function areChannelsInverted(b1, b2) {
for (var i = 0; i < b1.length; i++) {
if (Math.abs(b1[i] + b2[i]) > 9e-2) {

View File

@ -27,7 +27,7 @@ for (let ev of events) {
a.addEventListener(ev, dumpEvent);
}
(async () => {
(async _ => {
try {
SimpleTest.waitForExplicitFinish();
SimpleTest.requestFlakyTimeout("Timeouts for shortcutting test-timeout");
@ -42,7 +42,7 @@ for (let ev of events) {
a.src = test.name;
a.name = test.name;
const ac = new AudioContext();
ac.createMediaElementSource(a);
const src = ac.createMediaElementSource(a);
a.play();
do {
await new Promise(r => a.ontimeupdate = r);
@ -60,7 +60,7 @@ for (let ev of events) {
a.currentTime = test.duration - 1;
await Promise.race([
new Promise(res => a.onended = res),
wait(30000).then(() => Promise.reject(new Error("Timeout"))),
wait(30000).then(_ => Promise.reject(new Error("Timeout"))),
]);
} catch(e) {
ok(false, e);

View File

@ -6,8 +6,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=463162
-->
<head>
<title>Test for Bug 463162</title>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<script src="/tests/SimpleTest/EventUtils.js"></script>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<script src="/tests/SimpleTest/EventUtils.js"/>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
<script type="text/javascript" src="manifest.js"></script>
</head>

View File

@ -21,7 +21,7 @@ function onloaded(event) {
var v = event.target;
v.removeEventListener("loadedmetadata", onloaded);
v.currentTime = v.duration;
return;
}
function checkNotPlaying(v) {

View File

@ -22,7 +22,6 @@ SimpleTest.waitForExplicitFinish();
var audio = document.createElement("audio");
// Check leaking on TextTrackList objects.
/* global ttl, ttc */
window.ttl = audio.textTracks;
ttl.addEventListener("click", function(){});

View File

@ -131,7 +131,11 @@ function IsLinux() {
}
function getPref(name) {
return SpecialPowers.getBoolPref(name, false);
var pref = false;
try {
pref = SpecialPowers.getBoolPref(name);
} catch(ex) { }
return pref;
}
function IsSupportedAndroid() {

View File

@ -21,8 +21,6 @@
<script type="application/javascript">
/* import-globals-from cloneElementVisually_helpers.js */
/**
* Test that when we start cloning a video that has already ended, the
* clone displays the last frame from the video.

View File

@ -23,8 +23,6 @@
<script type="application/javascript">
/* import-globals-from cloneElementVisually_helpers.js */
/**
* Test that we can clone a video that is playing a MediaStream.
*/

View File

@ -23,8 +23,6 @@
<script type="application/javascript">
/* import-globals-from cloneElementVisually_helpers.js */
/**
* Tests that cloning a video prevents the decoder from being suspended
* if the original video stops being visible.

View File

@ -21,8 +21,6 @@
<script type="application/javascript">
/* import-globals-from cloneElementVisually_helpers.js */
/**
* Test that when we start cloning a paused video, the clone displays
* the first paused frame.

View File

@ -21,8 +21,6 @@
<script type="application/javascript">
/* import-globals-from cloneElementVisually_helpers.js */
/**
* Test that when we start cloning a paused video, the clone displays
* the first paused frame.

View File

@ -23,8 +23,6 @@
<script type="application/javascript">
/* import-globals-from cloneElementVisually_helpers.js */
/**
* Tests that cloning survives changes to the underlying video resource.
*/

View File

@ -30,17 +30,17 @@ function startTest(test, token) {
clone.token = evt.target.token;
clone.play();
clone.onloadstart = function(event) {
info("cloned " + event.target.token + " start loading.");
event.target.onloadstart = null;
clone.onloadstart = function(evt) {
info("cloned " + evt.target.token + " start loading.");
evt.target.onloadstart = null;
removeNodeAndSource(v);
}
clone.onended = function(event) {
ok(true, "cloned " + event.target.token + " ended.");
event.target.onended = null;
removeNodeAndSource(event.target);
manager.finished(event.target.token);
clone.onended = function(evt) {
ok(true, "cloned " + evt.target.token + " ended.");
evt.target.onended = null;
removeNodeAndSource(evt.target);
manager.finished(evt.target.token);
}
}
}

View File

@ -42,7 +42,7 @@ function testWebM1(e) {
ok(v.buffered.length >= 1, "Should have a buffered range");
var halfBuffered = v.buffered.end(0) / 2;
function start() {
function startTest() {
is(v.seekable.start(0), v.buffered.start(0), "Seekable start should be buffered start");
is(v.seekable.end(0), v.buffered.end(0), "Seekable end should be buffered end");
ok(!completed, "Should not be completed yet");
@ -51,8 +51,8 @@ function testWebM1(e) {
v.seeking = true;
readonly = v.seeking === false;
}
catch(ex) {
readonly = "threw exception: " + ex;
catch(e) {
readonly = "threw exception: " + e;
}
is(readonly, true, "seeking should be readonly");
@ -90,7 +90,7 @@ function testWebM1(e) {
once(v, "seeking", seekStarted);
once(v, "seeked", seekEnded);
start();
startTest();
}
// Fetch the media resource using XHR so we can be sure the entire
@ -133,4 +133,4 @@ manager.runTests(gCuelessWebMTests, startTest);
</script>
</pre>
</body>
</html>
</html>

View File

@ -39,7 +39,7 @@ function testWebM2(e) {
ok(v.buffered.length >= 1, "Should have a buffered range");
var halfBuffered = v.buffered.end(0) / 2;
function start() {
function startTest() {
if (completed)
return;
@ -80,7 +80,7 @@ function testWebM2(e) {
v.addEventListener("seeking", seekStarted);
v.addEventListener("seeked", seekEnded);
start();
startTest();
}
// Fetch the media resource using XHR so we can be sure the entire
@ -123,4 +123,4 @@ manager.runTests(gCuelessWebMTests, startTest);
</script>
</pre>
</body>
</html>
</html>

View File

@ -32,13 +32,14 @@ function testWebM3(e) {
var v = e.target;
v.removeEventListener('loadeddata', testWebM3);
var startPassed = false;
var completed = false;
var gotTimeupdate = false;
ok(v.buffered.length >= 1, "Should have a buffered range");
var halfBuffered = v.buffered.end(0) / 2;
function start() {
function startTest() {
if (completed)
return;
@ -57,6 +58,7 @@ function testWebM3(e) {
return;
v.addEventListener("timeupdate", timeupdate);
startPassed = true;
}
function seekEnded() {
@ -74,7 +76,7 @@ function testWebM3(e) {
v.addEventListener("seeking", seekStarted);
v.addEventListener("seeked", seekEnded);
start()
startTest()
}
// Fetch the media resource using XHR so we can be sure the entire
@ -117,4 +119,4 @@ manager.runTests(gCuelessWebMTests, startTest);
</script>
</pre>
</body>
</html>
</html>

View File

@ -24,11 +24,11 @@ function e(id) {
return document.getElementById(id);
}
var gLoadError = {};
var gLoadError = new Object();
gLoadError.video1 = 0;
gLoadError.video2 = 0;
gLoadError.video3 = 0;
gLoadError['video1'] = 0;
gLoadError['video2'] = 0;
gLoadError['video3'] = 0;
var gErrorCount = 0;
@ -45,9 +45,9 @@ function finishTest() {
filename(e('video3').src),
'video3 currentSrc should match src');
is(gLoadError.video1, 2, "Expect one error per invalid source child on video1");
is(gLoadError.video2, 1, "Expect one error on video2");
is(gLoadError.video3, 1, "Expect one error on video3");
is(gLoadError['video1'], 2, "Expect one error per invalid source child on video1");
is(gLoadError['video2'], 1, "Expect one error on video2");
is(gLoadError['video3'], 1, "Expect one error on video3");
SimpleTest.finish();
}

View File

@ -10,7 +10,6 @@
<body>
<pre id="test">
<script class="testbody" type="text/javascript">
/* import-globals-from eme.js */
var manager = new MediaTestManager;
var EMEmanifest = [
@ -45,8 +44,8 @@ function startTest(test, token)
var eventCounts = { play: 0, playing: 0};
function ForbiddenEvents(e) {
var video = e.target;
ok(video.readyState >= video.HAVE_FUTURE_DATA, "Must not have received event too early");
var v = e.target;
ok(v.readyState >= v.HAVE_FUTURE_DATA, "Must not have received event too early");
is(eventCounts[e.type], 0, "event should have only be fired once");
eventCounts[e.type]++;
}

View File

@ -11,7 +11,6 @@
<pre id="test">
<video id="v" controls></video>
<script class="testbody" type="text/javascript">
/* import-globals-from eme.js */
var manager = new MediaTestManager;
var EMEmanifest = [

View File

@ -10,10 +10,9 @@
<body>
<pre id="test">
<script class="testbody" type="text/javascript">
/* import-globals-from eme.js */
var manager = new MediaTestManager;
function DoSetMediaKeys(v, test, token)
function DoSetMediaKeys(v, test)
{
var options = [{
initDataTypes: ["cenc"],
@ -70,7 +69,7 @@ function TestSetSrc(test, token)
manager.finished(token);
});
DoSetMediaKeys(v, test, token)
DoSetMediaKeys(v, test)
.then(function() {
v.src = test.name;
@ -101,3 +100,4 @@ if (!IsMacOSSnowLeopardOrEarlier()) {
</pre>
</body>
</html>

View File

@ -10,7 +10,6 @@
<body>
<pre id="test">
<script class="testbody" type="text/javascript">
/* import-globals-from eme.js */
var manager = new MediaTestManager;
function ArrayBuffersEqual(a, b) {
@ -34,12 +33,12 @@ function KeysChangeFunc(session, keys, token) {
session.keyIdsReceived[keyid] = false;
}
return function(ev) {
var s = ev.target;
s.gotKeysChanged = true;
var session = ev.target;
session.gotKeysChanged = true;
var keyList = [];
var valueList = [];
var map = s.keyStatuses;
var map = session.keyStatuses;
// Test that accessing keys not known to the CDM has expected behaviour.
var absentKey = new Uint8Array([0xeb, 0xdd, 0x62, 0xf1, 0x68, 0x14, 0xd2, 0x7b,
@ -48,7 +47,7 @@ function KeysChangeFunc(session, keys, token) {
is(map.get(absentKey), undefined, "Unknown keys should undefined status");
// Verify known keys have expected status.
for (let [key, val] of map.entries()) {
for (var [key, val] of map.entries()) {
is(key.constructor, ArrayBuffer, "keyId should be ArrayBuffer");
ok(map.has(key), "MediaKeyStatusMap.has() should work.");
is(map.get(key), val, "MediaKeyStatusMap.get() should work.");
@ -56,8 +55,8 @@ function KeysChangeFunc(session, keys, token) {
valueList.push(val);
is(val, "usable", token + ": key status should be usable");
var kid = Base64ToHex(window.btoa(ArrayBufferToString(key)));
ok(kid in s.keyIdsReceived, TimeStamp(token) + " session[" + s.sessionId + "].keyIdsReceived contained " + kid + " as expected.");
s.keyIdsReceived[kid] = true;
ok(kid in session.keyIdsReceived, TimeStamp(token) + " session[" + session.sessionId + "].keyIdsReceived contained " + kid + " as expected.");
session.keyIdsReceived[kid] = true;
}
var index = 0;
@ -66,7 +65,7 @@ function KeysChangeFunc(session, keys, token) {
index++;
}
index = 0;
for (let val of map.values()) {
for (var val of map.values()) {
is(val, valueList[index], "MediaKeyStatusMap.values() should correspond to entries");
index++;
}
@ -143,7 +142,7 @@ function startTest(test, token)
ok(session.gotKeysChanged,
TimeStamp(token) + " session[" + session.sessionId
+ "] should have received at least one keychange event");
for (let kid in session.keyIdsReceived) {
for (var kid in session.keyIdsReceived) {
Log(token, "session[" + session.sessionId + "] key " + kid + " = " + (session.keyIdsReceived[kid] ? "true" : "false"));
if (session.keyIdsReceived[kid]) { keyIdsReceived[kid] = true; }
}
@ -155,7 +154,7 @@ function startTest(test, token)
is(session.numMessageEvents, session.numOnMessageEvents,
TimeStamp(token) + " should have as many message event listener calls as event handler calls.");
}
for (let kid in keyIdsReceived) {
for (var kid in keyIdsReceived) {
ok(keyIdsReceived[kid], TimeStamp(token) + " key with id " + kid + " was usable as expected");
}

View File

@ -109,15 +109,15 @@
Log(token, "encrypted event => len=" + initData.length + " " + hexStr);
let session = event.target.mediaKeys.createSession();
initDatas.set(hexStr, session);
session.addEventListener("message", e => {
e.target.update(
session.addEventListener("message", event => {
event.target.update(
GenerateClearKeyLicense(event.message, test.keys));
});
session.generateRequest(event.initDataType, event.initData);
}
video.addEventListener("encrypted", handleEncrypted);
video.addEventListener("encrypted", handleEncrypted, false);
video.addEventListener("ended", () => {
let expectedEncryptedEvents =
@ -138,4 +138,4 @@
</script>
</body>
</html>
</html>

View File

@ -28,6 +28,7 @@ function observe() {
function Test(test) {
var p = test.prefs ? SetPrefs(test.prefs) : Promise.resolve();
observedStatus = "nothing";
var name = "'" + test.keySystem + "'";
var res = observe().then((status) => {

View File

@ -15,6 +15,7 @@ var manager = new MediaTestManager;
function startTest(test, token)
{
// Case 1. setting MediaKeys on an element captured by MediaElementSource should fail.
var p1 = new EMEPromise;
var case1token = token + "_case1";
let v1 = document.createElement("video");
@ -34,7 +35,7 @@ function startTest(test, token)
}
var context = new AudioContext();
context.createMediaElementSource(v1);
var node = context.createMediaElementSource(v1);
v1.addEventListener("loadeddata", function(ev) {
ok(false, TimeStamp(case1token) + " should never reach loadeddata, as setMediaKeys should fail");
});

View File

@ -25,7 +25,7 @@ function startTest(test, token)
var threw = false;
try {
var context = new AudioContext();
context.createMediaElementSource(v2);
var node = context.createMediaElementSource(v2);
} catch (e) {
threw = true;
}

View File

@ -23,7 +23,7 @@ function startTest(test, token)
ok(true, TimeStamp(case3token) + " should reach loadeddata");
var threw = false;
try {
v3.mozCaptureStreamUntilEnded();
var stream = v3.mozCaptureStreamUntilEnded();
} catch (e) {
threw = true;
}

View File

@ -10,7 +10,6 @@
<body>
<pre id="test">
<script class="testbody" type="text/javascript">
/* import-globals-from eme.js */
var manager = new MediaTestManager;
// Test that if we can capture a video frame while playing clear content after
@ -42,15 +41,15 @@ function startTest(test, token)
function playClearVideo() {
var p1 = once(v, 'loadeddata', (e) => {
ok(true, TimeStamp(token) + " Receiving event 'loadeddata' for (CLEAR) content.");
let canvasElem = document.createElement('canvas');
canvasElem = document.createElement('canvas');
document.body.appendChild(canvasElem);
let ctx2d = canvasElem.getContext('2d');
ctx2d = canvasElem.getContext('2d');
var gotTypeError = false;
try {
ctx2d.drawImage(v, 0, 0);
} catch (ex) {
if (ex instanceof TypeError) {
} catch (e) {
if (e instanceof TypeError) {
gotTypeError = true;
}
}

View File

@ -10,7 +10,6 @@
<body>
<pre id="test">
<script class="testbody" type="text/javascript">
/* import-globals-from eme.js */
var manager = new MediaTestManager;
function startTest(test, token)

View File

@ -57,7 +57,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1022913
function startTest(test, token) {
manager.started(token);
let v = document.createElement("video");
v = document.createElement("video");
v.src = test.name;
v.name = test.name;
v.preload = "metadata";

View File

@ -67,7 +67,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=778077
function startTest(test, token) {
manager.started(token);
let v = document.createElement("video");
v = document.createElement("video");
v.src = test.name;
v.name = test.name;
v.preload = "metadata";

View File

@ -85,7 +85,7 @@ function createTestArray() {
for (var fragNum=0; fragNum<gFragmentParams.length; fragNum++) {
var p = gFragmentParams[fragNum];
var t = {};
var t = new Object;
t.name = test.name + p.fragment;
t.type = test.type;
t.duration = test.duration;
@ -98,25 +98,25 @@ function createTestArray() {
}
function startTest(test, token) {
var video = document.createElement('video');
var v = document.createElement('video');
manager.started(token);
video.preload = "metadata";
video.src = test.name;
video.token = token;
video.controls = true;
document.body.appendChild(video);
v.preload = "metadata";
v.src = test.name;
v.token = token;
v.controls = true;
document.body.appendChild(v);
var name = test.name + " fragment test";
var localIs = function(n) { return function(a, b, msg) {
is(a, b, n + ": " + msg);
var localIs = function(name) { return function(a, b, msg) {
is(a, b, name + ": " + msg);
}}(name);
var localOk = function(n) { return function(a, msg) {
ok(a, n + ": " + msg);
var localOk = function(name) { return function(a, msg) {
ok(a, name + ": " + msg);
}}(name);
var localFinish = function(v, m) { return function() {
var localFinish = function(v, manager) { return function() {
removeNodeAndSource(v);
m.finished(v.token);
}}(video, manager);
window.test_fragment_noplay(video, test.start, test.end, localIs, localOk, localFinish);
manager.finished(v.token);
}}(v, manager);
window['test_fragment_noplay'](v, test.start, test.end, localIs, localOk, localFinish);
}
manager.runTests(createTestArray(), startTest);

View File

@ -44,7 +44,7 @@ function createTestArray() {
for (var fragNum=0; fragNum<gFragmentParams.length; fragNum++) {
var p = gFragmentParams[fragNum];
var t = {};
var t = new Object;
t.name = test.name + p.fragment;
t.type = test.type;
t.duration = test.duration;
@ -62,25 +62,25 @@ function startTest(test, token) {
todo(false, test.todo);
return;
}
var video = document.createElement('video');
var v = document.createElement('video');
manager.started(token);
video.preload = "metadata";
video.src = test.name;
video.token = token;
video.controls = true;
document.body.appendChild(video);
v.preload = "metadata";
v.src = test.name;
v.token = token;
v.controls = true;
document.body.appendChild(v);
var name = test.name + " fragment test";
var localIs = function(n) { return function(a, b, msg) {
is(a, b, n + ": " + msg);
var localIs = function(name) { return function(a, b, msg) {
is(a, b, name + ": " + msg);
}}(name);
var localOk = function(n) { return function(a, msg) {
ok(a, n + ": " + msg);
var localOk = function(name) { return function(a, msg) {
ok(a, name + ": " + msg);
}}(name);
var localFinish = function(v, m) { return function() {
var localFinish = function(v, manager) { return function() {
removeNodeAndSource(v);
m.finished(v.token);
}}(video, manager);
window.test_fragment_play(video, test.start, test.end, localIs, localOk, localFinish);
manager.finished(v.token);
}}(v, manager);
window['test_fragment_play'](v, test.start, test.end, localIs, localOk, localFinish);
}
manager.runTests(createTestArray(), startTest);

View File

@ -13,7 +13,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=478957
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=478957">Mozilla Bug 478957</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<div id="log" style="font-size: small;"></div>
@ -42,7 +42,7 @@ function createTestArray() {
continue;
}
var t = {};
var t = new Object;
t.name = test.src;
t.type = test.type;
@ -55,7 +55,6 @@ function createTestArray() {
function log(msg) {
info(msg);
var l = document.getElementById('log');
// eslint-disable-next-line no-unsanitized/property
l.innerHTML += msg + "<br>";
}
@ -92,7 +91,7 @@ function listener(evt) {
// other events to come in. Note: we don't expect any events to come
// in, unless we've leaked some info, and 1 second should be enough time
// for the leak to show up.
setTimeout(function() {finish(v);}, 1000);
setTimeout(function() {finish(v);}, 1000);
}
}
@ -135,7 +134,7 @@ function filename(uri) {
}
function checkState(v) {
test_ok(v.networkState <= HTMLMediaElement.NETWORK_LOADING ||
test_ok(v.networkState <= HTMLMediaElement.NETWORK_LOADING ||
v.networkState == HTMLMediaElement.NETWORK_NO_SOURCE,
"NetworkState of " + v.networkState + " was leaked.");
test_ok(v.readyState == HTMLMediaElement.HAVE_NOTHING,
@ -160,7 +159,7 @@ function checkState(v) {
function startTest(test, token) {
manager.started(token);
log("Testing: " + test.type + " @ " + test.name);
createMedia(test.type, test.name, token);
createMedia(test.type, test.name, token);
}
SimpleTest.waitForExplicitFinish();

View File

@ -89,14 +89,16 @@ function prependSource(src, type) {
var gTests = [
{
// Test 0: adding video to doc, then setting src should load implicitly.
create(src, type) {
create:
function(src, type) {
document.body.appendChild(gMedia);
gMedia.src = src;
},
expectedEvents: ['loadstart', 'durationchange', 'loadedmetadata', 'loadeddata']
}, {
// Test 1: adding video to doc, then adding source.
create(src, type) {
create:
function(src, type) {
document.body.appendChild(gMedia);
addSource(src, type);
},
@ -104,7 +106,8 @@ var gTests = [
},{
// Test 2: video with multiple source, the first of which are bad, we should load the last,
// and receive error events for failed loads on the source children.
create(src, type) {
create:
function(src, type) {
document.body.appendChild(gMedia);
addSource("404a", type);
addSource("404b", type);
@ -113,7 +116,8 @@ var gTests = [
expectedEvents: ['loadstart', 'source_error', 'source_error', 'durationchange', 'loadedmetadata', 'loadeddata']
}, {
// Test 3: video with bad src, good <source>, ensure that <source> aren't used.
create(src, type) {
create:
function(src, type) {
gMedia.src = "404a";
addSource(src, type);
document.body.appendChild(gMedia);
@ -122,7 +126,8 @@ var gTests = [
}, {
// Test 4: video with only bad source, loading, then adding a good source
// - should resume load.
create(src, type) {
create:
function(src, type) {
addSource("404a", type);
var s2 = addSource("404b", type);
s2.addEventListener("error",
@ -138,7 +143,8 @@ var gTests = [
// a good <source> to the video, it shouldn't be selected, because the
// "pointer" should be after the last child - the bad source.
prepended: false,
create(src, type) {
create:
function(src, type) {
var prepended = false;
addSource("404a", type);
var s2 = addSource("404b", type);
@ -156,7 +162,8 @@ var gTests = [
}, {
// Test 6: (Bug 1165203) preload="none" then followed by an explicit
// call to load() should load metadata
create(src, type) {
create:
function(src, type) {
gMedia.preload = "none";
gMedia.src = src;
document.body.appendChild(gMedia);

View File

@ -38,11 +38,11 @@ function tryClone(e) {
"loadeddata", "playing", "ended", "error", "stalled", "emptied", "abort",
"waiting", "pause"];
function logEvent(evt) {
var event = evt.target;
info(`${event.token} got ${evt.type}`);
var e = evt.target;
info(`${e.token} got ${evt.type}`);
}
events.forEach(function(event) {
clone.addEventListener(event, logEvent);
events.forEach(function(e) {
clone.addEventListener(e, logEvent);
});

View File

@ -107,8 +107,8 @@ for (var i = 0; i < gSmallTests.length; ++i) {
// The following nested function hack is to ensure that 'test' is correctly
// captured in the closure and we don't end up getting the value 'test'
// had in the last iteration of the loop. I blame Brendan.
var check = function(t) { return function (e) {
checkMetadata(t.name, e, test);
var check = function(test) { return function (e) {
checkMetadata(test.name, e, test);
}}(test);
var otherType = type.match(/^video\//) ? "audio/x-wav" : "video/ogg";
@ -130,8 +130,8 @@ for (var i = 0; i < gSmallTests.length; ++i) {
maketest(late_add_sources_first, src, type, check));
}
function startTest(t, token) {
t(token);
function startTest(test, token) {
test(token);
}
manager.runTests(subtests, startTest);

View File

@ -24,6 +24,7 @@ function startTest(test, token) {
function runTest(test, token, bitrate) {
var element = document.createElement('video');
var expectedMimeType = test.type.substring(0, test.type.indexOf(';'));
element.token = token;

View File

@ -13,7 +13,6 @@
<video id="recorded-video"></video>
</div>
<script class="testbody" type="text/javascript">
/* import-globals-from ../../canvas/test/captureStream_common.js */
function startTest() {
// Setup canvas and take a stream from it
@ -35,7 +34,7 @@ function startTest() {
// Recorded data that will be playback.
let blob;
let mediaRecorder = new MediaRecorder(canvasStream);
mediaRecorder = new MediaRecorder(canvasStream);
is(mediaRecorder.stream, canvasStream,
"Media recorder stream = canvas stream at the start of recording");

View File

@ -13,7 +13,6 @@
<video id="recorded-video" loop></video>
</div>
<script class="testbody" type="text/javascript">
/* import-globals-from ../../canvas/test/captureStream_common.js */
function startTest() {
let canvas = document.getElementById("video-src-canvas");

View File

@ -27,13 +27,15 @@ function startTest() {
var onstopTriggered = false;
dest.channelCount = 4;
var expectedMimeType = 'audio/ogg; codecs=opus';
var totalBlobSize = 0;
source.channelCountMode = 'explicit';
source.connect(dest);
var elem = document.createElement('audio');
elem.srcObject = dest.stream;
mMediaStream = dest.stream;
source.start(0);
elem.play();
let mMediaRecorder = new MediaRecorder(dest.stream);
mMediaRecorder = new MediaRecorder(dest.stream);
mMediaRecorder.onwarning = function() {
ok(false, 'onwarning unexpectedly fired');
};
@ -50,6 +52,7 @@ function startTest() {
};
mMediaRecorder.ondataavailable = function (e) {
ok(e.data.size > 0, 'check blob has data');
totalBlobSize += e.data.size;
is(e.data.type, expectedMimeType, 'blob should have expected mimetype');
if (!stopTriggered) {
is(mMediaRecorder.mimeType, expectedMimeType, 'recorder should have expected mimetype');

View File

@ -12,8 +12,6 @@
<div id="content">
</div>
<script>
/* import-globals-from ../../canvas/test/captureStream_common.js */
/* import-globals-from ../tests/mochitest/head.js */
SimpleTest.waitForExplicitFinish();
runTestWhenReady(async () => {
const canvas = document.createElement("canvas");
@ -35,7 +33,7 @@ runTestWhenReady(async () => {
const blobs = [];
let mediaRecorder = new MediaRecorder(stream);
mediaRecorder = new MediaRecorder(stream);
is(mediaRecorder.stream, stream,
"Media recorder stream = constructed stream at the start of recording");

View File

@ -12,6 +12,7 @@
function startTest() {
var context = new AudioContext();
var hasonstop = false;
var buffer = context.createBuffer(1, 80920, context.sampleRate);
for (var i = 0; i < 80920; ++i) {
buffer.getChannelData(0)[i] = Math.sin(1000 * 2 * Math.PI * i / context.sampleRate);
@ -25,9 +26,10 @@ function startTest() {
source.connect(dest);
var elem = document.createElement('audio');
elem.srcObject = dest.stream;
mMediaStream = dest.stream;
source.start(0);
elem.play();
let mMediaRecorder = new MediaRecorder(dest.stream);
mMediaRecorder = new MediaRecorder(dest.stream);
mMediaRecorder.onwarning = function() {
ok(false, 'onwarning unexpectedly fired');
};

View File

@ -11,7 +11,6 @@
<div id="content">
</div>
<script class="testbody" type="text/javascript">
/* import-globals-from ../../canvas/test/captureStream_common.js */
function startTest() {
var canvas = document.createElement("canvas");
@ -25,7 +24,7 @@ function startTest() {
var blob;
let mediaRecorder = new MediaRecorder(stream);
mediaRecorder = new MediaRecorder(stream);
is(mediaRecorder.stream, stream,
"Media recorder stream = canvas stream at the start of recording");

View File

@ -11,7 +11,6 @@
<div id="content">
</div>
<script class="testbody" type="text/javascript">
/* import-globals-from ../../canvas/test/captureStream_common.js */
function startTest() {
var canvas = document.createElement("canvas");

View File

@ -20,7 +20,7 @@ async function startTest() {
let onDataAvailableFirst = false;
const expectedMimeType = 'video/webm; codecs="vp8, opus"';
let mediaRecorder = new MediaRecorder(stream);
mediaRecorder = new MediaRecorder(stream);
is(mediaRecorder.stream, stream,
'Media recorder stream = element stream at the start of recording');
mediaRecorder.onwarning = function() {
@ -49,7 +49,7 @@ async function startTest() {
// We'll stop recording upon the 1st blob being received
if (dataAvailableCount === 1) {
mediaRecorder.onstop = function (event) {
mediaRecorder.onstop = function (evt) {
info('onstop fired');
if (!onDataAvailableFirst) {

View File

@ -13,7 +13,7 @@ function unexpected({type}) {
ok(false, `${type} unexpectedly fired`);
}
(async () => {
(async _ => {
SimpleTest.waitForExplicitFinish();
let blobUrl = null;
let stream = null;
@ -32,7 +32,7 @@ function unexpected({type}) {
{audio: true, video: true});
const blobs = [];
let mediaRecorder = new MediaRecorder(stream);
mediaRecorder = new MediaRecorder(stream);
is(mediaRecorder.stream, stream,
"Media recorder stream = element stream at the start of recording");
mediaRecorder.start();
@ -78,7 +78,7 @@ function unexpected({type}) {
await Promise.race([
new Promise(res => video.onended = res),
new Promise((res, rej) => video.onerror = () => rej(video.error.message)),
new Promise((_, rej) => video.onerror = _ => rej(video.error.message)),
]);
} catch (e) {
ok(false, e);

View File

@ -68,7 +68,7 @@ function startTest(test, token) {
// We'll stop recording upon the 1st blob being received
if (dataAvailableCount === 1) {
mediaRecorder.onstop = function (event) {
mediaRecorder.onstop = function (evt) {
info('onstop fired');
if (!onDataAvailableFirst) {

View File

@ -11,7 +11,6 @@
<div id="content">
</div>
<script class="testbody" type="text/javascript">
/* import-globals-from ../../canvas/test/captureStream_common.js */
function startTest() {
var canvas = document.createElement("canvas");

View File

@ -11,15 +11,13 @@
a Bug 894348</a>
<pre id="test">
<script class="testbody" type="text/javascript">
for (let i = 0; i< 5; i++) {
/* eslint-disable no-undef */
for (i = 0; i< 5; i++) {
try { o0 = document.createElement('audio') } catch(e) { }
try { o0.src = "sound.ogg" } catch(e) { }
try { (document.body || document.documentElement).appendChild(o0) } catch(e) { }
try { o1 = o0.mozCaptureStreamUntilEnded(); } catch(e) { }
try { o2 = new MediaRecorder(o1) } catch(e) { }
try { o2.start(0) } catch(e) { }
/* eslint-enable no-undef */
SpecialPowers.gc();
}
ok(true, "pass the crash test");

View File

@ -223,12 +223,12 @@ var operationTests = [
* operation tests
*/
function runStateTransitionTests(testStream) {
for (const operationTest of operationTests) {
for (operationTest of operationTests) {
var mediaRecorder = new MediaRecorder(testStream);
var operationsString = operationTest.operations.toString();
try {
for (const operation of operationTest.operations) {
for (operation of operationTest.operations) {
if (operationTest.timeSlice && operation === 'start') {
operationsString += ' with timeslice ' + operationTest.timeSlice;
mediaRecorder[operation](operationTest.timeSlice);
@ -256,6 +256,7 @@ function runStateTransitionTests(testStream) {
*/
function startTest(test, token) {
var element = document.createElement('audio');
var expectedMimeType = test.type.substring(0, test.type.indexOf(';'));
element.token = token;
manager.started(token);

View File

@ -14,8 +14,10 @@ async function startTest() {
let steps = 0;
let audioOnchange = 0;
let audioOnaddtrack = 0;
let audioOnremovetrack = 0;
let videoOnchange = 0;
let videoOnaddtrack = 0;
let videoOnremovetrack = 0;
let isPlaying = false;
let element = document.createElement("video");
let stream;
@ -32,6 +34,10 @@ async function startTest() {
audioOnaddtrack++;
};
element.audioTracks.onremovetrack = function(e) {
audioOnremovetrack++;
};
element.audioTracks.onchange = function(e) {
audioOnchange++;
};
@ -40,6 +46,10 @@ async function startTest() {
videoOnaddtrack++;
};
element.videoTracks.onremovetrack = function(e) {
videoOnremovetrack++;
};
element.videoTracks.onchange = function(e) {
videoOnchange++;
};

View File

@ -26,8 +26,10 @@ function startTest(test, token) {
var elemType = getMajorMimeType(test.type);
var element = document.createElement(elemType);
var audioOnchange = 0;
var audioOnaddtrack = 0;
var audioOnremovetrack = 0;
var videoOnchange = 0;
var videoOnaddtrack = 0;
var videoOnremovetrack = 0;
var isPlaying = false;

View File

@ -26,7 +26,7 @@ function startTest(test, token) {
// Tags should not be available immediately.
var exception_fired = false;
try {
a.mozGetMetadata();
var m = a.mozGetMetadata();
} catch (e) {
is(e.name, 'InvalidStateError',
"early mozGetMetadata() should throw InvalidStateError");
@ -38,7 +38,7 @@ function startTest(test, token) {
// Wait until metadata has loaded.
a.addEventListener('loadedmetadata', function() {
// read decoded tags
let tags = a.mozGetMetadata();
tags = a.mozGetMetadata();
ok(tags, "mozGetMetadata() should return a truthy value");
// Dump them out.
var d = document.getElementById('output');
@ -47,7 +47,7 @@ function startTest(test, token) {
html += ' on '+test.name+'</p></caption>\n';
html += '<tr><th>tag</th>';
html += '<th>decoded value</th><th>expected value</th></tr>\n';
for (let tag in tags) {
for (tag in tags) {
html += '<tr><td>'+tag+'</td>';
html += '<td>'+tags[tag]+'</td>';
html += '<td>'+test.tags[tag]+'</td>';
@ -58,15 +58,14 @@ function startTest(test, token) {
}
html += '</table>\n';
var div = document.createElement('div');
// eslint-disable-next-line no-unsanitized/property
div.innerHTML = html;
d.appendChild(div);
// Verify decoded tag values.
for (let tag in tags) {
for (tag in tags) {
is(tags[tag], test.tags[tag], "Tag '"+tag+"' should match");
}
// Verify expected tag values
for (let tag in test.tags) {
for (tag in test.tags) {
is(tags[tag], test.tags[tag], "Tag '"+tag+"' should match");
}
removeNodeAndSource(a);

View File

@ -34,13 +34,14 @@
element.addEventListener("loadedmetadata", ()=>{
resolve(true);
removeNodeAndSource(element);
});
}, false);
element.addEventListener("error", ()=>{
resolve(false);
removeNodeAndSource(element);
});
}, false);
var noise = Math.floor(Math.random() * 100000000);
// Note: request redirect before the end of metadata, otherwise we won't
// error before metadata has loaded if mixed origins are allowed.
element.src = "midflight-redirect.sjs?resource=" + test.name
@ -56,11 +57,14 @@
let v = document.createElement("video");
const testCases = gSmallTests.filter(t => v.canPlayType(t.type));
async function testMediaLoad(expectedToLoad, message, useCors) {
for (let test of testCases) {
let loaded = await testIfLoadsToMetadata(test, useCors);
is(loaded, expectedToLoad, test.name + " " + message);
}
function testMediaLoad(expectedToLoad, message, useCors) {
return new Promise(async function(resolve, reject) {
for (let test of testCases) {
let loaded = await testIfLoadsToMetadata(test, useCors);
is(loaded, expectedToLoad, test.name + " " + message);
}
resolve();
});
}
async function runTest() {

View File

@ -13,21 +13,21 @@
var manager = new MediaTestManager;
function startTest(test, token) {
var video = document.createElement('video');
video.token = token;
var v = document.createElement('video');
v.token = token;
manager.started(token);
video.src = test.name;
video.name = test.name;
video.playingCount = 0;
video._playedOnce = false;
v.src = test.name;
v.name = test.name;
v.playingCount = 0;
v._playedOnce = false;
var check = function(t, v) { return function() {
checkMetadata(t.name, v, test);
}}(test, video);
var check = function(test, v) { return function() {
checkMetadata(test.name, v, test);
}}(test, v);
var noLoad = function(t, v) { return function() {
ok(false, t.name + " should not fire 'load' event");
}}(test, video);
var noLoad = function(test, v) { return function() {
ok(false, test.name + " should not fire 'load' event");
}}(test, v);
function finish(v) {
removeNodeAndSource(v);
@ -40,14 +40,14 @@ function startTest(test, token) {
}
}
var checkEnded = function(t, v) { return function() {
if (t.duration) {
ok(Math.abs(v.currentTime - t.duration) < 0.1,
t.name + " current time at end: " + v.currentTime);
var checkEnded = function(test, v) { return function() {
if (test.duration) {
ok(Math.abs(v.currentTime - test.duration) < 0.1,
test.name + " current time at end: " + v.currentTime);
}
is(v.readyState, v.HAVE_CURRENT_DATA, t.name + " checking readyState");
ok(v.ended, t.name + " checking playback has ended");
is(v.readyState, v.HAVE_CURRENT_DATA, test.name + " checking readyState");
ok(v.ended, test.name + " checking playback has ended");
ok(v.playingCount > 0, "Expect at least one playing event");
v.playingCount = 0;
@ -58,33 +58,33 @@ function startTest(test, token) {
v._playedOnce = true;
v.play();
}
}}(test, video);
}}(test, v);
var checkSuspended = function(t, v) { return function() {
var checkSuspended = function(test, v) { return function() {
if (v.seenSuspend) {
return;
}
v.seenSuspend = true;
ok(true, t.name + " got suspend");
ok(true, test.name + " got suspend");
mayFinish(v);
}}(test, video);
}}(test, v);
var checkPlaying = function(t, v) { return function() {
is(t.name, v.name, "Should be testing file we think we're testing...");
var checkPlaying = function(test, v) { return function() {
is(test.name, v.name, "Should be testing file we think we're testing...");
v.playingCount++;
}}(test, video);
}}(test, v);
video.addEventListener("load", noLoad);
video.addEventListener("loadedmetadata", check);
video.addEventListener("playing", checkPlaying);
v.addEventListener("load", noLoad);
v.addEventListener("loadedmetadata", check);
v.addEventListener("playing", checkPlaying);
// We should get "ended" and "suspend" events for every resource
video.addEventListener("ended", checkEnded);
video.addEventListener("suspend", checkSuspended);
v.addEventListener("ended", checkEnded);
v.addEventListener("suspend", checkSuspended);
document.body.appendChild(video);
video.play();
document.body.appendChild(v);
v.play();
}
manager.runTests(gReplayTests, startTest);

View File

@ -13,91 +13,91 @@
var manager = new MediaTestManager;
function startTest(test, token) {
var video = document.createElement('video');
video.preload = "metadata";
video.token = token;
video.prevTime = 0;
video.seenEnded = false;
video.seenSuspend = false;
var v = document.createElement('video');
v.preload = "metadata";
v.token = token;
v.prevTime = 0;
v.seenEnded = false;
v.seenSuspend = false;
var handler = {
"ontimeout": function() {
Log(token, "timed out: ended=" + video.seenEnded + ", suspend=" + video.seenSuspend);
Log(token, "timed out: ended=" + v.seenEnded + ", suspend=" + v.seenSuspend);
}
};
manager.started(token, handler);
video.src = test.name;
video.name = test.name;
v.src = test.name;
v.name = test.name;
var check = function(t, v) { return function() {
is(t.name, v.name, t.name + ": Name should match #1");
checkMetadata(t.name, v, t);
}}(test, video);
var check = function(test, v) { return function() {
is(test.name, v.name, test.name + ": Name should match #1");
checkMetadata(test.name, v, test);
}}(test, v);
var noLoad = function(t, v) { return function() {
ok(false, t.name + " should not fire 'load' event");
}}(test, video);
var noLoad = function(test, v) { return function() {
ok(false, test.name + " should not fire 'load' event");
}}(test, v);
var noError = function(t, v) { return function() {
ok(false, t.name + " should not fire 'error' event " + v.error.message);
}}(test, video);
var noError = function(test, v) { return function() {
ok(false, test.name + " should not fire 'error' event " + v.error.message);
}}(test, v);
var finish = function() {
video.finished = true;
video.removeEventListener("timeupdate", timeUpdate);
removeNodeAndSource(video);
manager.finished(video.token);
v.finished = true;
v.removeEventListener("timeupdate", timeUpdate);
removeNodeAndSource(v);
manager.finished(v.token);
}
// We should get "ended" and "suspend" events to finish the test.
var mayFinish = function() {
if (video.seenEnded && video.seenSuspend) {
if (v.seenEnded && v.seenSuspend) {
finish();
}
}
var checkEnded = function(t, v) { return function() {
is(t.name, v.name, t.name + ": Name should match #2");
checkMetadata(t.name, v, test);
is(v.readyState, v.HAVE_CURRENT_DATA, t.name + " checking readyState");
ok(v.ended, t.name + " checking playback has ended");
ok(!v.finished, t.name + " shouldn't be finished");
ok(!v.seenEnded, t.name + " shouldn't be ended");
var checkEnded = function(test, v) { return function() {
is(test.name, v.name, test.name + ": Name should match #2");
checkMetadata(test.name, v, test);
is(v.readyState, v.HAVE_CURRENT_DATA, test.name + " checking readyState");
ok(v.ended, test.name + " checking playback has ended");
ok(!v.finished, test.name + " shouldn't be finished");
ok(!v.seenEnded, test.name + " shouldn't be ended");
v.seenEnded = true;
mayFinish();
}}(test, video);
}}(test, v);
var checkSuspended = function(t, v) { return function() {
var checkSuspended = function(test, v) { return function() {
if (v.seenSuspend) {
return;
}
is(t.name, v.name, t.name + ": Name should match #3");
is(test.name, v.name, test.name + ": Name should match #3");
v.seenSuspend = true;
mayFinish();
}}(test, video);
}}(test, v);
var timeUpdate = function(t, v) { return function() {
var timeUpdate = function(test, v) { return function() {
if (v.prevTime > v.currentTime) {
ok(false, t.name + " time should run forwards: p=" +
ok(false, test.name + " time should run forwards: p=" +
v.prevTime + " c=" + v.currentTime);
}
v.prevTime = v.currentTime;
}}(test, video);
}}(test, v);
video.addEventListener("load", noLoad);
video.addEventListener("error", noError);
video.addEventListener("loadedmetadata", check);
video.addEventListener("timeupdate", timeUpdate);
v.addEventListener("load", noLoad);
v.addEventListener("error", noError);
v.addEventListener("loadedmetadata", check);
v.addEventListener("timeupdate", timeUpdate);
// We should get "ended" and "suspend" events for every resource
video.addEventListener("ended", checkEnded);
video.addEventListener("suspend", checkSuspended);
v.addEventListener("ended", checkEnded);
v.addEventListener("suspend", checkSuspended);
document.body.appendChild(video);
video.play();
document.body.appendChild(v);
v.play();
}
manager.runTests(gPlayTests, startTest);

View File

@ -13,10 +13,10 @@
var manager = new MediaTestManager;
function startTest(test, token) {
var video = document.createElement('video');
var v = document.createElement('video');
manager.started(token);
video._errorCount = 0;
video._ignore = false;
v._errorCount = 0;
v._ignore = false;
function endedTest(v) {
if (v._ignore)
return;
@ -24,20 +24,20 @@ function startTest(test, token) {
v.remove();
manager.finished(token);
}
var checkError = function(t, v) { return function(evt) {
var checkError = function(test, v) { return function(evt) {
v._errorCount++;
is(v._errorCount, 1, t.name + " only one error fired");
is(v._errorCount, 1, test.name + " only one error fired");
endedTest(v);
}}(test, video);
var checkEnded = function(t, v) { return function() {
ok(false, t.name + " successfully played");
}}(test, v);
var checkEnded = function(test, v) { return function() {
ok(false, test.name + " successfully played");
endedTest(v);
}}(test, video);
video.addEventListener("error", checkError);
video.addEventListener("ended", checkEnded);
video.src = test.name;
document.body.appendChild(video);
video.play();
}}(test, v);
v.addEventListener("error", checkError);
v.addEventListener("ended", checkEnded);
v.src = test.name;
document.body.appendChild(v);
v.play();
}
manager.runTests(gErrorTests, startTest);

View File

@ -13,74 +13,74 @@
var manager = new MediaTestManager;
function startTest(test, token) {
var video = document.createElement('video');
video.preload = "metadata";
video.token = token;
video.prevTime = 0;
video.seenEnded = false;
var v = document.createElement('video');
v.preload = "metadata";
v.token = token;
v.prevTime = 0;
v.seenEnded = false;
var handler = {
"ontimeout": function() {
Log(token, "timed out: ended=" + video.seenEnded);
Log(token, "timed out: ended=" + v.seenEnded);
}
};
manager.started(token, handler);
video.src = test.name;
video.name = test.name;
v.src = test.name;
v.name = test.name;
var check = function(t, v) { return function() {
is(t.name, v.name, t.name + ": Name should match #1");
checkMetadata(t.name, v, t);
}}(test, video);
var check = function(test, v) { return function() {
is(test.name, v.name, test.name + ": Name should match #1");
checkMetadata(test.name, v, test);
}}(test, v);
var noLoad = function(t, v) { return function() {
ok(false, t.name + " should not fire 'load' event");
}}(test, video);
var noLoad = function(test, v) { return function() {
ok(false, test.name + " should not fire 'load' event");
}}(test, v);
var finish = function() {
video.finished = true;
video.removeEventListener("timeupdate", timeUpdate);
removeNodeAndSource(video);
manager.finished(video.token);
v.finished = true;
v.removeEventListener("timeupdate", timeUpdate);
removeNodeAndSource(v);
manager.finished(v.token);
}
// We should get "ended" events to finish the test.
var mayFinish = function() {
if (video.seenEnded) {
if (v.seenEnded) {
finish();
}
}
var checkEnded = function(t, v) { return function() {
is(t.name, v.name, t.name + ": Name should match #2");
checkMetadata(t.name, v, test);
is(v.readyState, v.HAVE_CURRENT_DATA, t.name + " checking readyState");
ok(v.ended, t.name + " checking playback has ended");
ok(!v.finished, t.name + " shouldn't be finished");
ok(!v.seenEnded, t.name + " shouldn't be ended");
var checkEnded = function(test, v) { return function() {
is(test.name, v.name, test.name + ": Name should match #2");
checkMetadata(test.name, v, test);
is(v.readyState, v.HAVE_CURRENT_DATA, test.name + " checking readyState");
ok(v.ended, test.name + " checking playback has ended");
ok(!v.finished, test.name + " shouldn't be finished");
ok(!v.seenEnded, test.name + " shouldn't be ended");
v.seenEnded = true;
mayFinish();
}}(test, video);
}}(test, v);
var timeUpdate = function(t, v) { return function() {
var timeUpdate = function(test, v) { return function() {
if (v.prevTime > v.currentTime) {
ok(false, t.name + " time should run forwards: p=" +
ok(false, test.name + " time should run forwards: p=" +
v.prevTime + " c=" + v.currentTime);
}
v.prevTime = v.currentTime;
}}(test, video);
}}(test, v);
video.addEventListener("load", noLoad);
video.addEventListener("loadedmetadata", check);
video.addEventListener("timeupdate", timeUpdate);
v.addEventListener("load", noLoad);
v.addEventListener("loadedmetadata", check);
v.addEventListener("timeupdate", timeUpdate);
// We should get "ended" events for the hls resource
video.addEventListener("ended", checkEnded);
v.addEventListener("ended", checkEnded);
document.body.appendChild(video);
video.play();
document.body.appendChild(v);
v.play();
}
manager.runTests(gHLSTests, startTest);

View File

@ -20,22 +20,22 @@
var manager = new MediaTestManager;
function startTest(test, token) {
var video = document.createElement('video');
video.preload = "metadata";
video.token = token;
var v = document.createElement('video');
v.preload = "metadata";
v.token = token;
var handler = {
"ontimeout": function() {
Log(token, "timed out: ended=" + video.seenEnded + ", suspend=" + video.seenSuspend);
Log(token, "timed out: ended=" + v.seenEnded + ", suspend=" + v.seenSuspend);
}
};
manager.started(token, handler);
video.src = test.name;
video.name = test.name;
v.src = test.name;
v.name = test.name;
var check = function(t, v) { return function() {
is(t.name, v.name, t.name + ": Name should match #1");
var check = function(test, v) { return function() {
is(test.name, v.name, test.name + ": Name should match #1");
Log(v.token, "removeChild: " + v.name);
document.body.removeChild(v);
var appendAndPlayElement = function() {
@ -45,28 +45,28 @@ function startTest(test, token) {
v.play();
}
setTimeout(appendAndPlayElement, 2000);
}}(test, video);
}}(test, v);
var finish = function() {
video.finished = true;
removeNodeAndSource(video);
manager.finished(video.token);
v.finished = true;
removeNodeAndSource(v);
manager.finished(v.token);
}
var checkEnded = function(t, v) { return function() {
is(t.name, v.name, t.name + ": Name should match #2");
checkMetadata(t.name, v, t);
is(v.readyState, v.HAVE_CURRENT_DATA, t.name + " checking readyState");
ok(v.ended, t.name + " checking playback has ended");
var checkEnded = function(test, v) { return function() {
is(test.name, v.name, test.name + ": Name should match #2");
checkMetadata(test.name, v, test);
is(v.readyState, v.HAVE_CURRENT_DATA, test.name + " checking readyState");
ok(v.ended, test.name + " checking playback has ended");
finish();
}}(test, video);
}}(test, v);
video.addEventListener("loadedmetadata", check);
video.addEventListener("ended", checkEnded);
v.addEventListener("loadedmetadata", check);
v.addEventListener("ended", checkEnded);
document.body.appendChild(video);
document.body.appendChild(v);
}
manager.runTests(gSmallTests, startTest);

View File

@ -32,7 +32,7 @@ function check_full_file_played(element) {
var tests = [
// Without playing, check that player.played.length == 0.
{
setup(element) {
setup : function(element) {
element.addEventListener("loadedmetadata", function() {
is(element.played.length, 0, element.token + ": initial played.length equals zero");
finish_test(element);
@ -42,7 +42,7 @@ var tests = [
},
// Play the file, test the range we have.
{
setup(element) {
setup : function(element) {
check_full_file_played(element);
element.play();
},
@ -52,7 +52,7 @@ var tests = [
// Play the second half of the file, pause, play
// an check we have only one range.
{
setup (element) {
setup : function (element) {
element.onended = function (e) {
var t = e.target;
t.onended = null;
@ -72,7 +72,7 @@ var tests = [
// Play the first half of the file, seek back, while
// continuing to play. We shall have only one range.
{
setup (element) {
setup : function (element) {
let onTimeUpdate = function() {
if (element.currentTime > element.duration / 2) {
info(element.token + ": currentTime=" + element.currentTime + ", duration=" + element.duration);
@ -95,7 +95,7 @@ var tests = [
// Play and seek to have two ranges, and check that, as well a
// boundaries.
{
setup (element) {
setup : function (element) {
let seekTarget = 0;
let onTimeUpdate = function() {
if (element.currentTime > element.duration / 2) {
@ -132,7 +132,7 @@ var tests = [
// Play to create two ranges, in the reverse order. check that they are sorted.
{
setup (element) {
setup : function (element) {
function end() {
element.pause();
let p = element.played;
@ -178,7 +178,7 @@ var tests = [
},
// Seek repeatedly without playing. No range should appear.
{
setup(element) {
setup : function(element) {
let index = 1;
element.addEventListener('seeked', function() {
@ -202,7 +202,7 @@ function createTestArray() {
var A = [];
for (var i=0; i<tests.length; i++) {
for (var k=0; k<gPlayedTests.length; k++) {
var t = {};
var t = new Object();
t.setup = tests[i].setup;
t.name = tests[i].name + "-" + gPlayedTests[k].name;
t.type = gPlayedTests[k].type;

View File

@ -13,7 +13,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=548523
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=548523">Mozilla Bug 548523</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<!-- <button onClick="SimpleTest.finish();">Finish</button> -->
<div>Tests complete: <span id="log" style="font-size: small;"></span></div>
@ -41,7 +41,6 @@ addLoadEvent(function() {gotLoadEvent=true;});
function log(m) {
var l = document.getElementById("log");
// eslint-disable-next-line no-unsanitized/property
l.innerHTML += m;
}
@ -66,7 +65,8 @@ var tests = [
// after receiving a suspend event. Should not receive loaded events until after we call load().
// Note the suspend event is explictly sent by our "stop the load" code, but other tests can't rely
// on it for the preload:metadata case, as there can be multiple suspend events when loading metadata.
suspend(e) {
suspend:
function(e) {
var v = e.target;
is(v._gotLoadStart, true, "(1) Must get loadstart.");
is(v._gotLoadedMetaData, false, "(1) Must not get loadedmetadata.");
@ -76,7 +76,8 @@ var tests = [
maybeFinish(v, 1);
},
setup(v) {
setup:
function(v) {
v._gotLoadStart = false;
v._gotLoadedMetaData = false;
v.preload = "none";
@ -92,7 +93,8 @@ var tests = [
{
// 2. Add preload:metadata video with src to document. Should halt with NETWORK_IDLE, HAVE_CURRENT_DATA
// after suspend event and after loadedmetadata.
loadeddata(e) {
loadeddata:
function(e) {
var v = e.target;
is(v._gotLoadStart, true, "(2) Must get loadstart.");
is(v._gotLoadedMetaData, true, "(2) Must get loadedmetadata.");
@ -102,7 +104,8 @@ var tests = [
maybeFinish(v, 2);
},
setup(v) {
setup:
function(v) {
v._gotLoadStart = false;
v._gotLoadedMetaData = false;
v.preload = "metadata";
@ -118,14 +121,16 @@ var tests = [
},
{
// 3. Add preload:auto to document. Should receive canplaythrough eventually.
canplaythrough(e) {
canplaythrough:
function(e) {
var v = e.target;
is(v._gotLoadStart, true, "(3) Must get loadstart.");
is(v._gotLoadedMetaData, true, "(3) Must get loadedmetadata.");
maybeFinish(v, 3);
},
setup(v) {
setup:
function(v) {
v._gotLoadStart = false;
v._gotLoadedMetaData = false;
v.preload = "auto";
@ -140,7 +145,8 @@ var tests = [
},
{
// 4. Add preload:none video to document. Call play(), should load then play through.
suspend(e) {
suspend:
function(e) {
var v = e.target;
if (v._gotSuspend) {
return; // We can receive multiple suspend events, like the one after download completes.
@ -154,12 +160,14 @@ var tests = [
v.play(); // Should load and play through.
},
ended(e) {
ended:
function(e) {
ok(true, "(4) Got playback ended");
maybeFinish(e.target, 4);
},
setup(v) {
setup:
function(v) {
v._gotLoadStart = false;
v._gotLoadedMetaData = false;
v._gotSuspend = false;
@ -177,7 +185,8 @@ var tests = [
{
// 5. preload:none video without resource, add to document, will implicitly start a
// preload:none load. Add a src, it shouldn't load.
suspend(e) {
suspend:
function(e) {
var v = e.target;
is(v._gotLoadStart, true, "(5) Must get loadstart.");
is(v._gotLoadedMetaData, false, "(5) Must not get loadedmetadata.");
@ -187,7 +196,8 @@ var tests = [
maybeFinish(v, 5);
},
setup(v) {
setup:
function(v) {
v._gotLoadStart = false;
v._gotLoadedMetaData = false;
v.preload = "none";
@ -203,7 +213,8 @@ var tests = [
{
// 6. preload:none video without resource, add to document, will implicitly start a
// preload:none load. Add a source, it shouldn't load.
suspend(e) {
suspend:
function(e) {
var v = e.target;
is(v._gotLoadStart, true, "(6) Must get loadstart.");
is(v._gotLoadedMetaData, false, "(6) Must not get loadedmetadata.");
@ -213,7 +224,8 @@ var tests = [
maybeFinish(v, 6);
},
setup(v) {
setup:
function(v) {
v._gotLoadStart = false;
v._gotLoadedMetaData = false;
v.preload = "none";
@ -232,9 +244,10 @@ var tests = [
{
// 7. create a preload:none document with multiple sources, the first of which is invalid.
// Add to document, then play. It should load and play through the second source.
suspend(e) {
suspend:
function(e) {
var v = e.target;
if (v._gotSuspend)
if (v._gotSuspend)
return; // We can receive multiple suspend events, like the one after download completes.
v._gotSuspend = true;
is(v._gotLoadStart, true, "(7) Must get loadstart.");
@ -245,14 +258,16 @@ var tests = [
v.play(); // Should load and play through.
},
ended(e) {
ended:
function(e) {
ok(true, "(7) Got playback ended");
var v = e.target;
is(v._gotErrorEvent, true, "(7) Should get error event from first source load failure");
is(v._gotErrorEvent, true, "(7) Should get error event from first source load failure");
maybeFinish(v, 7);
},
setup(v) {
setup:
function(v) {
v._gotLoadStart = false;
v._gotLoadedMetaData = false;
v.preload = "none";
@ -277,7 +292,8 @@ var tests = [
},
{
// 8. Change preload value from none to metadata should cause metadata to be loaded.
loadeddata(e) {
loadeddata:
function(e) {
var v = e.target;
is(v._gotLoadedMetaData, true, "(8) Must get loadedmetadata.");
ok(v.readyState >= v.HAVE_CURRENT_DATA, "(8) ReadyState must be >= HAVE_CURRENT_DATA on suspend.");
@ -286,7 +302,8 @@ var tests = [
maybeFinish(v, 8);
},
setup(v) {
setup:
function(v) {
v._gotLoadedMetaData = false;
v.preload = "none";
v.addEventListener("loadstart", function(e){v.preload = "metadata";});
@ -325,13 +342,15 @@ var tests = [
},*/
{
// 10. Change preload value from none to auto should cause entire media to be loaded.
canplaythrough(e) {
canplaythrough:
function(e) {
var v = e.target;
is(v._gotLoadedMetaData, true, "(10) Must get loadedmetadata.");
maybeFinish(v, 10);
},
setup(v) {
setup:
function(v) {
v._gotLoadedMetaData = false;
v.preload = "none";
v.addEventListener("loadstart", function(e){v.preload = "auto";});
@ -345,7 +364,8 @@ var tests = [
},
{
// 11. Change preload value from none to metadata should cause metadata to load.
loadeddata(e) {
loadeddata:
function(e) {
var v = e.target;
is(v._gotLoadedMetaData, true, "(11) Must get loadedmetadata.");
ok(v.readyState >= v.HAVE_CURRENT_DATA, "(11) ReadyState must be >= HAVE_CURRENT_DATA.");
@ -354,7 +374,8 @@ var tests = [
maybeFinish(v, 11);
},
setup(v) {
setup:
function(v) {
v._gotLoadedMetaData = false;
v.preload = "none";
v.addEventListener("loadstart", function(e){v.preload = "metadata";});
@ -369,7 +390,8 @@ var tests = [
{
// 13. Change preload value from auto to none after specifying a src
// should load according to preload none, no buffering should have taken place
suspend(e) {
suspend:
function(e) {
var v = e.target;
is(v._gotLoadStart, true, "(13) Must get loadstart.");
is(v._gotLoadedMetaData, false, "(13) Must not get loadedmetadata.");
@ -379,7 +401,8 @@ var tests = [
maybeFinish(v, 13);
},
setup(v) {
setup:
function(v) {
v._gotLoadStart = false;
v._gotLoadedMetaData = false;
v.preload = "auto";
@ -389,14 +412,15 @@ var tests = [
v.addEventListener("loadstart", function(e){v._gotLoadStart = true;});
v.addEventListener("suspend", this.suspend);
document.body.appendChild(v); // Causes implicit load, should load according to preload none
document.createElement("source");
var s = document.createElement("source");
},
name: "test13",
},
{
// 14. Add preload:metadata video with src to document. Play(), should play through.
loadeddata(e) {
loadeddata:
function(e) {
var v = e.target;
is(v._gotLoadStart, true, "(14) Must get loadstart.");
is(v._gotLoadedMetaData, true, "(14) Must get loadedmetadata.");
@ -406,13 +430,15 @@ var tests = [
v.play();
},
ended(e) {
ended:
function(e) {
ok(true, "(14) Got playback ended");
var v = e.target;
maybeFinish(v, 14);
},
setup(v) {
setup:
function(v) {
v._gotLoadStart = false;
v._gotLoadedMetaData = false;
v.preload = "metadata";
@ -429,13 +455,15 @@ var tests = [
},
{
// 15. Autoplay should override preload:none.
ended(e) {
ended:
function(e) {
ok(true, "(15) Got playback ended.");
var v = e.target;
maybeFinish(v, 15);
},
setup(v) {
setup:
function(v) {
v._gotLoadStart = false;
v._gotLoadedMetaData = false;
v.preload = "none";
@ -451,6 +479,7 @@ var tests = [
"loadeddata", "playing", "ended", "error", "stalled", "emptied", "abort",
"waiting", "pause"];
function logEvent(e) {
var v = e.target;
info(e.target.token + ": got " + e.type);
}
events.forEach(function(e) {
@ -462,13 +491,15 @@ var tests = [
},
{
// 16. Autoplay should override preload:metadata.
ended(e) {
ended:
function(e) {
ok(true, "(16) Got playback ended.");
var v = e.target;
maybeFinish(v, 16);
},
setup(v) {
setup:
function(v) {
v.preload = "metadata";
v.autoplay = true;
v.addEventListener("ended", this.ended);
@ -480,13 +511,15 @@ var tests = [
},
{
// 17. On a preload:none video, adding autoplay should disable preload none, i.e. don't break autoplay!
ended(e) {
ended:
function(e) {
ok(true, "(17) Got playback ended.");
var v = e.target;
maybeFinish(v, 17);
},
setup(v) {
setup:
function(v) {
v.addEventListener("ended", this.ended);
v.preload = "none";
document.body.appendChild(v); // Causes implicit load, which will be halted due to preload:none.
@ -499,13 +532,15 @@ var tests = [
{
// 18. On a preload='none' video, call play() before load algorithms's sync
// has run, the play() call should override preload='none'.
ended(e) {
ended:
function(e) {
ok(true, "(18) Got playback ended.");
var v = e.target;
maybeFinish(v, 18);
},
setup(v) {
setup:
function(v) {
v.addEventListener("ended", this.ended);
v.preload = "none";
v.src = test.name; // Schedules async section to continue load algorithm.
@ -518,7 +553,8 @@ var tests = [
{
// 19. Set preload='auto' on first video source then switching preload='none' and swapping the video source to another.
// The second video should not start playing as it's preload state has been changed to 'none' from 'auto'
setup(v) {
setup:
function(v) {
v.preload = "auto";
v.src = test.name;
// add a listener for when the video has loaded, so we know preload auto has worked
@ -555,18 +591,18 @@ var tests = [
];
var iterationCount = 0;
function startTest(t, token) {
if (t == tests[0]) {
function startTest(test, token) {
if (test == tests[0]) {
++iterationCount;
info("iterationCount=" + iterationCount);
}
if (iterationCount == 2) {
// Do this series of tests on logically different resources
t.name = baseName + "?" + Math.floor(Math.random()*100000);
test.name = baseName + "?" + Math.floor(Math.random()*100000);
}
var v = document.createElement("video");
v.token = token;
t.setup(v);
test.setup(v);
manager.started(token);
}

View File

@ -29,7 +29,7 @@ var tests = [
name: 'v1',
preload: 'none',
expectedSuspendCount: 2,
onsuspend(evt) {
onsuspend: function(evt) {
checkSuspendCount(evt);
if (evt.target.suspendCount == 1) {
evt.target.preload = 'auto';
@ -53,7 +53,7 @@ var tests = [
name: 'v4',
preload: 'none',
expectedSuspendCount: 2,
onsuspend(evt) {
onsuspend: function(evt) {
checkSuspendCount(evt);
if (evt.target.suspendCount == 1) {
evt.target.play();
@ -76,7 +76,7 @@ var tests = [
name: 'v6',
preload: 'none',
expectedSuspendCount: 2,
onsuspend(evt) {
onsuspend: function(evt) {
checkSuspendCount(evt);
if (evt.target.suspendCount == 1) {
evt.target.autoplay = true;

View File

@ -20,9 +20,9 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=975270
a._abort = 0;
a._emptied = 0;
a.preload = "metadata"; // On B2G we default to preload:none.
is(a.networkState, HTMLMediaElement.NETWORK_EMPTY, "Shouldn't be loading");
a.addEventListener("abort", function(e) { a._abort++; });
a.addEventListener("emptied", function(e) { a._emptied++; });
a.addEventListener("loadedmetadata",
@ -31,7 +31,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=975270
is(a._emptied, 0, "Should not have received 'emptied' before 'loadedmetadata");
a.addEventListener("loadstart",
function() {
function(e) {
is(a._abort, 1, "Should have received 'abort' before 'loadstart");
is(a._emptied, 1, "Should have received 'emptied' before 'loadstart");
SimpleTest.finish();
@ -41,9 +41,9 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=975270
is(a._abort, 0, "Should not have received 'abort' during setting a.src=''");
is(a._emptied, 0, "Should not have received 'emptied' during setting a.src=''");
});
a.src = getPlayableAudio(gSmallTests).name;
</script>
</head>
<body>

Some files were not shown because too many files have changed in this diff Show More