зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1556854 - Enable ESLint for dom/media/test/ - Enable automatically fixable rules. r=jya.
This enables the following rules: - dot-notation - mozilla/no-useless-parameters - no-else-return - no-useless-return - object-shorthand Differential Revision: https://phabricator.services.mozilla.com/D50131 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
7c19d4e5c5
Коммит
c34c417518
|
@ -388,13 +388,10 @@ module.exports = {
|
|||
],
|
||||
"rules": {
|
||||
"consistent-return": "off",
|
||||
"dot-notation": "off",
|
||||
"mozilla/no-useless-parameters": "off",
|
||||
"mozilla/use-default-preference-values": "off",
|
||||
"mozilla/use-services": "off",
|
||||
"no-array-constructor": "off",
|
||||
"no-async-promise-executor": "off",
|
||||
"no-else-return": "off",
|
||||
"no-redeclare": "off",
|
||||
"no-nested-ternary": "off",
|
||||
"no-self-assign": "off",
|
||||
|
@ -402,8 +399,6 @@ module.exports = {
|
|||
"no-undef": "off",
|
||||
"no-unsanitized/property": "off",
|
||||
"no-unused-vars": "off",
|
||||
"no-useless-return": "off",
|
||||
"object-shorthand": "off",
|
||||
}
|
||||
}]
|
||||
};
|
||||
|
|
|
@ -137,7 +137,7 @@ function GenerateClearKeyLicense(licenseRequest, keyStore) {
|
|||
|
||||
return new TextEncoder().encode(
|
||||
JSON.stringify({
|
||||
keys: keys,
|
||||
keys,
|
||||
type: msg.type || "temporary",
|
||||
})
|
||||
);
|
||||
|
@ -165,9 +165,8 @@ function UpdateSessionFunc(test, token, sessionType, resolve, reject) {
|
|||
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) {
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
let p = await element.play().then(() => true, () => false);
|
||||
ok(p, "Expect to be activated already in " + eventName);
|
||||
resolve();
|
||||
}, false);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -1918,9 +1918,8 @@ function getPlayableAudio(candidates) {
|
|||
function getMajorMimeType(mimetype) {
|
||||
if (/^video/.test(mimetype)) {
|
||||
return "video";
|
||||
} else {
|
||||
return "audio";
|
||||
}
|
||||
return "audio";
|
||||
}
|
||||
|
||||
// Force releasing decoder to avoid timeout in waiting for decoding resource.
|
||||
|
@ -1959,10 +1958,10 @@ function once(target, name, cb) {
|
|||
function nextEvent(video, eventName) {
|
||||
return new Promise(function(resolve, reject) {
|
||||
let f = function(event) {
|
||||
video.removeEventListener(eventName, f, false);
|
||||
video.removeEventListener(eventName, f);
|
||||
resolve(event);
|
||||
};
|
||||
video.addEventListener(eventName, f, false);
|
||||
video.addEventListener(eventName, f);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -2186,7 +2185,6 @@ function MediaTestManager() {
|
|||
SimpleTest.finish();
|
||||
};
|
||||
mediaTestCleanup(onCleanup);
|
||||
return;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -9,10 +9,10 @@ video.mozRequestDebugInfo().then(debugInfo => {
|
|||
}
|
||||
JSONDebugInfo = JSONDebugInfo.slice(0, JSONDebugInfo.length - 1);
|
||||
JSONDebugInfo += "}";
|
||||
result["mozRequestDebugInfo"] = JSON.parse(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);
|
||||
});
|
||||
|
|
|
@ -5,11 +5,11 @@ var config = {
|
|||
HD: true,
|
||||
LQ: false,
|
||||
ID: "auto-hd-lq-for-ytb",
|
||||
type: function(t) {
|
||||
type(t) {
|
||||
config.HD = t === "hd";
|
||||
config.LQ = t === "lq";
|
||||
},
|
||||
quality: function() {
|
||||
quality() {
|
||||
if (config.HD || config.LQ) {
|
||||
var youtubePlayerListener = function(LQ, HD) {
|
||||
return function(e) {
|
||||
|
|
|
@ -101,7 +101,7 @@ function createAudioParams(nodeType) {
|
|||
return [ac.createStereoPanner().pan];
|
||||
default:
|
||||
ok(false, `non-defined node type ${nodeType}.`);
|
||||
return;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -76,6 +76,6 @@
|
|||
["privacy.reduceTimerPrecision", false]
|
||||
],
|
||||
tests: gDecodeSuspendTests,
|
||||
runTest: runTest
|
||||
runTest
|
||||
});
|
||||
</script>
|
|
@ -50,6 +50,6 @@
|
|||
["media.suspend-bkgnd-video.delay-ms", 1000]
|
||||
],
|
||||
tests: gDecodeSuspendTests,
|
||||
runTest: runTest
|
||||
runTest
|
||||
});
|
||||
</script>
|
|
@ -21,7 +21,7 @@ function onloaded(event) {
|
|||
var v = event.target;
|
||||
v.removeEventListener("loadedmetadata", onloaded);
|
||||
v.currentTime = v.duration;
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
function checkNotPlaying(v) {
|
||||
|
|
|
@ -26,9 +26,9 @@ function e(id) {
|
|||
|
||||
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();
|
||||
}
|
||||
|
|
|
@ -117,7 +117,7 @@
|
|||
session.generateRequest(event.initDataType, event.initData);
|
||||
}
|
||||
|
||||
video.addEventListener("encrypted", handleEncrypted, false);
|
||||
video.addEventListener("encrypted", handleEncrypted);
|
||||
|
||||
video.addEventListener("ended", () => {
|
||||
let expectedEncryptedEvents =
|
||||
|
|
|
@ -116,7 +116,7 @@ function startTest(test, token) {
|
|||
removeNodeAndSource(v);
|
||||
m.finished(v.token);
|
||||
}}(video, manager);
|
||||
window['test_fragment_noplay'](video, test.start, test.end, localIs, localOk, localFinish);
|
||||
window.test_fragment_noplay(video, test.start, test.end, localIs, localOk, localFinish);
|
||||
}
|
||||
|
||||
manager.runTests(createTestArray(), startTest);
|
||||
|
|
|
@ -80,7 +80,7 @@ function startTest(test, token) {
|
|||
removeNodeAndSource(v);
|
||||
m.finished(v.token);
|
||||
}}(video, manager);
|
||||
window['test_fragment_play'](video, test.start, test.end, localIs, localOk, localFinish);
|
||||
window.test_fragment_play(video, test.start, test.end, localIs, localOk, localFinish);
|
||||
}
|
||||
|
||||
manager.runTests(createTestArray(), startTest);
|
||||
|
|
|
@ -89,16 +89,14 @@ function prependSource(src, type) {
|
|||
var gTests = [
|
||||
{
|
||||
// Test 0: adding video to doc, then setting src should load implicitly.
|
||||
create:
|
||||
function(src, type) {
|
||||
create(src, type) {
|
||||
document.body.appendChild(gMedia);
|
||||
gMedia.src = src;
|
||||
},
|
||||
expectedEvents: ['loadstart', 'durationchange', 'loadedmetadata', 'loadeddata']
|
||||
}, {
|
||||
// Test 1: adding video to doc, then adding source.
|
||||
create:
|
||||
function(src, type) {
|
||||
create(src, type) {
|
||||
document.body.appendChild(gMedia);
|
||||
addSource(src, type);
|
||||
},
|
||||
|
@ -106,8 +104,7 @@ 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:
|
||||
function(src, type) {
|
||||
create(src, type) {
|
||||
document.body.appendChild(gMedia);
|
||||
addSource("404a", type);
|
||||
addSource("404b", type);
|
||||
|
@ -116,8 +113,7 @@ 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:
|
||||
function(src, type) {
|
||||
create(src, type) {
|
||||
gMedia.src = "404a";
|
||||
addSource(src, type);
|
||||
document.body.appendChild(gMedia);
|
||||
|
@ -126,8 +122,7 @@ var gTests = [
|
|||
}, {
|
||||
// Test 4: video with only bad source, loading, then adding a good source
|
||||
// - should resume load.
|
||||
create:
|
||||
function(src, type) {
|
||||
create(src, type) {
|
||||
addSource("404a", type);
|
||||
var s2 = addSource("404b", type);
|
||||
s2.addEventListener("error",
|
||||
|
@ -143,8 +138,7 @@ 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:
|
||||
function(src, type) {
|
||||
create(src, type) {
|
||||
var prepended = false;
|
||||
addSource("404a", type);
|
||||
var s2 = addSource("404b", type);
|
||||
|
@ -162,8 +156,7 @@ var gTests = [
|
|||
}, {
|
||||
// Test 6: (Bug 1165203) preload="none" then followed by an explicit
|
||||
// call to load() should load metadata
|
||||
create:
|
||||
function(src, type) {
|
||||
create(src, type) {
|
||||
gMedia.preload = "none";
|
||||
gMedia.src = src;
|
||||
document.body.appendChild(gMedia);
|
||||
|
|
|
@ -34,12 +34,12 @@
|
|||
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
|
||||
|
|
|
@ -32,7 +32,7 @@ function check_full_file_played(element) {
|
|||
var tests = [
|
||||
// Without playing, check that player.played.length == 0.
|
||||
{
|
||||
setup : function(element) {
|
||||
setup(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 : function(element) {
|
||||
setup(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 : function (element) {
|
||||
setup (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 : function (element) {
|
||||
setup (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 : function (element) {
|
||||
setup (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 : function (element) {
|
||||
setup (element) {
|
||||
function end() {
|
||||
element.pause();
|
||||
let p = element.played;
|
||||
|
@ -178,7 +178,7 @@ var tests = [
|
|||
},
|
||||
// Seek repeatedly without playing. No range should appear.
|
||||
{
|
||||
setup : function(element) {
|
||||
setup(element) {
|
||||
let index = 1;
|
||||
|
||||
element.addEventListener('seeked', function() {
|
||||
|
|
|
@ -65,8 +65,7 @@ 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:
|
||||
function(e) {
|
||||
suspend(e) {
|
||||
var v = e.target;
|
||||
is(v._gotLoadStart, true, "(1) Must get loadstart.");
|
||||
is(v._gotLoadedMetaData, false, "(1) Must not get loadedmetadata.");
|
||||
|
@ -76,8 +75,7 @@ var tests = [
|
|||
maybeFinish(v, 1);
|
||||
},
|
||||
|
||||
setup:
|
||||
function(v) {
|
||||
setup(v) {
|
||||
v._gotLoadStart = false;
|
||||
v._gotLoadedMetaData = false;
|
||||
v.preload = "none";
|
||||
|
@ -93,8 +91,7 @@ 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:
|
||||
function(e) {
|
||||
loadeddata(e) {
|
||||
var v = e.target;
|
||||
is(v._gotLoadStart, true, "(2) Must get loadstart.");
|
||||
is(v._gotLoadedMetaData, true, "(2) Must get loadedmetadata.");
|
||||
|
@ -104,8 +101,7 @@ var tests = [
|
|||
maybeFinish(v, 2);
|
||||
},
|
||||
|
||||
setup:
|
||||
function(v) {
|
||||
setup(v) {
|
||||
v._gotLoadStart = false;
|
||||
v._gotLoadedMetaData = false;
|
||||
v.preload = "metadata";
|
||||
|
@ -121,16 +117,14 @@ var tests = [
|
|||
},
|
||||
{
|
||||
// 3. Add preload:auto to document. Should receive canplaythrough eventually.
|
||||
canplaythrough:
|
||||
function(e) {
|
||||
canplaythrough(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:
|
||||
function(v) {
|
||||
setup(v) {
|
||||
v._gotLoadStart = false;
|
||||
v._gotLoadedMetaData = false;
|
||||
v.preload = "auto";
|
||||
|
@ -145,8 +139,7 @@ var tests = [
|
|||
},
|
||||
{
|
||||
// 4. Add preload:none video to document. Call play(), should load then play through.
|
||||
suspend:
|
||||
function(e) {
|
||||
suspend(e) {
|
||||
var v = e.target;
|
||||
if (v._gotSuspend) {
|
||||
return; // We can receive multiple suspend events, like the one after download completes.
|
||||
|
@ -160,14 +153,12 @@ var tests = [
|
|||
v.play(); // Should load and play through.
|
||||
},
|
||||
|
||||
ended:
|
||||
function(e) {
|
||||
ended(e) {
|
||||
ok(true, "(4) Got playback ended");
|
||||
maybeFinish(e.target, 4);
|
||||
},
|
||||
|
||||
setup:
|
||||
function(v) {
|
||||
setup(v) {
|
||||
v._gotLoadStart = false;
|
||||
v._gotLoadedMetaData = false;
|
||||
v._gotSuspend = false;
|
||||
|
@ -185,8 +176,7 @@ 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:
|
||||
function(e) {
|
||||
suspend(e) {
|
||||
var v = e.target;
|
||||
is(v._gotLoadStart, true, "(5) Must get loadstart.");
|
||||
is(v._gotLoadedMetaData, false, "(5) Must not get loadedmetadata.");
|
||||
|
@ -196,8 +186,7 @@ var tests = [
|
|||
maybeFinish(v, 5);
|
||||
},
|
||||
|
||||
setup:
|
||||
function(v) {
|
||||
setup(v) {
|
||||
v._gotLoadStart = false;
|
||||
v._gotLoadedMetaData = false;
|
||||
v.preload = "none";
|
||||
|
@ -213,8 +202,7 @@ 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:
|
||||
function(e) {
|
||||
suspend(e) {
|
||||
var v = e.target;
|
||||
is(v._gotLoadStart, true, "(6) Must get loadstart.");
|
||||
is(v._gotLoadedMetaData, false, "(6) Must not get loadedmetadata.");
|
||||
|
@ -224,8 +212,7 @@ var tests = [
|
|||
maybeFinish(v, 6);
|
||||
},
|
||||
|
||||
setup:
|
||||
function(v) {
|
||||
setup(v) {
|
||||
v._gotLoadStart = false;
|
||||
v._gotLoadedMetaData = false;
|
||||
v.preload = "none";
|
||||
|
@ -244,8 +231,7 @@ 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:
|
||||
function(e) {
|
||||
suspend(e) {
|
||||
var v = e.target;
|
||||
if (v._gotSuspend)
|
||||
return; // We can receive multiple suspend events, like the one after download completes.
|
||||
|
@ -258,16 +244,14 @@ var tests = [
|
|||
v.play(); // Should load and play through.
|
||||
},
|
||||
|
||||
ended:
|
||||
function(e) {
|
||||
ended(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");
|
||||
maybeFinish(v, 7);
|
||||
},
|
||||
|
||||
setup:
|
||||
function(v) {
|
||||
setup(v) {
|
||||
v._gotLoadStart = false;
|
||||
v._gotLoadedMetaData = false;
|
||||
v.preload = "none";
|
||||
|
@ -292,8 +276,7 @@ var tests = [
|
|||
},
|
||||
{
|
||||
// 8. Change preload value from none to metadata should cause metadata to be loaded.
|
||||
loadeddata:
|
||||
function(e) {
|
||||
loadeddata(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.");
|
||||
|
@ -302,8 +285,7 @@ var tests = [
|
|||
maybeFinish(v, 8);
|
||||
},
|
||||
|
||||
setup:
|
||||
function(v) {
|
||||
setup(v) {
|
||||
v._gotLoadedMetaData = false;
|
||||
v.preload = "none";
|
||||
v.addEventListener("loadstart", function(e){v.preload = "metadata";});
|
||||
|
@ -342,15 +324,13 @@ var tests = [
|
|||
},*/
|
||||
{
|
||||
// 10. Change preload value from none to auto should cause entire media to be loaded.
|
||||
canplaythrough:
|
||||
function(e) {
|
||||
canplaythrough(e) {
|
||||
var v = e.target;
|
||||
is(v._gotLoadedMetaData, true, "(10) Must get loadedmetadata.");
|
||||
maybeFinish(v, 10);
|
||||
},
|
||||
|
||||
setup:
|
||||
function(v) {
|
||||
setup(v) {
|
||||
v._gotLoadedMetaData = false;
|
||||
v.preload = "none";
|
||||
v.addEventListener("loadstart", function(e){v.preload = "auto";});
|
||||
|
@ -364,8 +344,7 @@ var tests = [
|
|||
},
|
||||
{
|
||||
// 11. Change preload value from none to metadata should cause metadata to load.
|
||||
loadeddata:
|
||||
function(e) {
|
||||
loadeddata(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.");
|
||||
|
@ -374,8 +353,7 @@ var tests = [
|
|||
maybeFinish(v, 11);
|
||||
},
|
||||
|
||||
setup:
|
||||
function(v) {
|
||||
setup(v) {
|
||||
v._gotLoadedMetaData = false;
|
||||
v.preload = "none";
|
||||
v.addEventListener("loadstart", function(e){v.preload = "metadata";});
|
||||
|
@ -390,8 +368,7 @@ 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:
|
||||
function(e) {
|
||||
suspend(e) {
|
||||
var v = e.target;
|
||||
is(v._gotLoadStart, true, "(13) Must get loadstart.");
|
||||
is(v._gotLoadedMetaData, false, "(13) Must not get loadedmetadata.");
|
||||
|
@ -401,8 +378,7 @@ var tests = [
|
|||
maybeFinish(v, 13);
|
||||
},
|
||||
|
||||
setup:
|
||||
function(v) {
|
||||
setup(v) {
|
||||
v._gotLoadStart = false;
|
||||
v._gotLoadedMetaData = false;
|
||||
v.preload = "auto";
|
||||
|
@ -419,8 +395,7 @@ var tests = [
|
|||
},
|
||||
{
|
||||
// 14. Add preload:metadata video with src to document. Play(), should play through.
|
||||
loadeddata:
|
||||
function(e) {
|
||||
loadeddata(e) {
|
||||
var v = e.target;
|
||||
is(v._gotLoadStart, true, "(14) Must get loadstart.");
|
||||
is(v._gotLoadedMetaData, true, "(14) Must get loadedmetadata.");
|
||||
|
@ -430,15 +405,13 @@ var tests = [
|
|||
v.play();
|
||||
},
|
||||
|
||||
ended:
|
||||
function(e) {
|
||||
ended(e) {
|
||||
ok(true, "(14) Got playback ended");
|
||||
var v = e.target;
|
||||
maybeFinish(v, 14);
|
||||
},
|
||||
|
||||
setup:
|
||||
function(v) {
|
||||
setup(v) {
|
||||
v._gotLoadStart = false;
|
||||
v._gotLoadedMetaData = false;
|
||||
v.preload = "metadata";
|
||||
|
@ -455,15 +428,13 @@ var tests = [
|
|||
},
|
||||
{
|
||||
// 15. Autoplay should override preload:none.
|
||||
ended:
|
||||
function(e) {
|
||||
ended(e) {
|
||||
ok(true, "(15) Got playback ended.");
|
||||
var v = e.target;
|
||||
maybeFinish(v, 15);
|
||||
},
|
||||
|
||||
setup:
|
||||
function(v) {
|
||||
setup(v) {
|
||||
v._gotLoadStart = false;
|
||||
v._gotLoadedMetaData = false;
|
||||
v.preload = "none";
|
||||
|
@ -490,15 +461,13 @@ var tests = [
|
|||
},
|
||||
{
|
||||
// 16. Autoplay should override preload:metadata.
|
||||
ended:
|
||||
function(e) {
|
||||
ended(e) {
|
||||
ok(true, "(16) Got playback ended.");
|
||||
var v = e.target;
|
||||
maybeFinish(v, 16);
|
||||
},
|
||||
|
||||
setup:
|
||||
function(v) {
|
||||
setup(v) {
|
||||
v.preload = "metadata";
|
||||
v.autoplay = true;
|
||||
v.addEventListener("ended", this.ended);
|
||||
|
@ -510,15 +479,13 @@ var tests = [
|
|||
},
|
||||
{
|
||||
// 17. On a preload:none video, adding autoplay should disable preload none, i.e. don't break autoplay!
|
||||
ended:
|
||||
function(e) {
|
||||
ended(e) {
|
||||
ok(true, "(17) Got playback ended.");
|
||||
var v = e.target;
|
||||
maybeFinish(v, 17);
|
||||
},
|
||||
|
||||
setup:
|
||||
function(v) {
|
||||
setup(v) {
|
||||
v.addEventListener("ended", this.ended);
|
||||
v.preload = "none";
|
||||
document.body.appendChild(v); // Causes implicit load, which will be halted due to preload:none.
|
||||
|
@ -531,15 +498,13 @@ 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:
|
||||
function(e) {
|
||||
ended(e) {
|
||||
ok(true, "(18) Got playback ended.");
|
||||
var v = e.target;
|
||||
maybeFinish(v, 18);
|
||||
},
|
||||
|
||||
setup:
|
||||
function(v) {
|
||||
setup(v) {
|
||||
v.addEventListener("ended", this.ended);
|
||||
v.preload = "none";
|
||||
v.src = test.name; // Schedules async section to continue load algorithm.
|
||||
|
@ -552,8 +517,7 @@ 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:
|
||||
function(v) {
|
||||
setup(v) {
|
||||
v.preload = "auto";
|
||||
v.src = test.name;
|
||||
// add a listener for when the video has loaded, so we know preload auto has worked
|
||||
|
|
|
@ -29,7 +29,7 @@ var tests = [
|
|||
name: 'v1',
|
||||
preload: 'none',
|
||||
expectedSuspendCount: 2,
|
||||
onsuspend: function(evt) {
|
||||
onsuspend(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: function(evt) {
|
||||
onsuspend(evt) {
|
||||
checkSuspendCount(evt);
|
||||
if (evt.target.suspendCount == 1) {
|
||||
evt.target.play();
|
||||
|
@ -76,7 +76,7 @@ var tests = [
|
|||
name: 'v6',
|
||||
preload: 'none',
|
||||
expectedSuspendCount: 2,
|
||||
onsuspend: function(evt) {
|
||||
onsuspend(evt) {
|
||||
checkSuspendCount(evt);
|
||||
if (evt.target.suspendCount == 1) {
|
||||
evt.target.autoplay = true;
|
||||
|
|
|
@ -23,7 +23,7 @@ function finish_test(element) {
|
|||
var tests = [
|
||||
// Test using a finite media stream, and a server supporting range requests
|
||||
{
|
||||
setup : function(element) {
|
||||
setup(element) {
|
||||
is(element.seekable.length, 0, "seekable.length should be initialy 0.");
|
||||
element.addEventListener("loadedmetadata", function() {
|
||||
is(element.seekable.length, 1, "seekable.length should be 1 for a server supporting range requests.");
|
||||
|
|
|
@ -31,9 +31,9 @@ function newSource(filter) {
|
|||
e.type = candidates[0].type;
|
||||
e.src = candidates[0].name;
|
||||
return e;
|
||||
} else {
|
||||
return null
|
||||
}
|
||||
return null
|
||||
|
||||
}
|
||||
|
||||
var audioLoaded = false;
|
||||
|
|
|
@ -19,9 +19,9 @@ var manager = new MediaTestManager;
|
|||
|
||||
function ended(e) {
|
||||
var v = e.target;
|
||||
++v.counter["ended"];
|
||||
is(v.counter["ended"], 1, v._name + " should see ended only once");
|
||||
ok(v.counter["timeupdate"] > 0, v._name + " should see at least one timeupdate: " + v.currentTime);
|
||||
++v.counter.ended;
|
||||
is(v.counter.ended, 1, v._name + " should see ended only once");
|
||||
ok(v.counter.timeupdate > 0, v._name + " should see at least one timeupdate: " + v.currentTime);
|
||||
|
||||
// Rest event counters for we don't allow events after ended.
|
||||
eventsToLog.forEach(function(event) {
|
||||
|
@ -55,7 +55,7 @@ var eventsToLog = ["play", "canplay", "canplaythrough", "loadstart", "loadedmeta
|
|||
function logEvent(event) {
|
||||
var v = event.target;
|
||||
++v.counter[event.type];
|
||||
if (v.counter["ended"] > 0) {
|
||||
if (v.counter.ended > 0) {
|
||||
is(v.counter[event.type], 0, v._name + " got unexpected " + event.type + " after ended");
|
||||
}
|
||||
}
|
||||
|
@ -75,7 +75,7 @@ function startTest(test, token) {
|
|||
v.counter[e] = 0;
|
||||
});
|
||||
v.addEventListener("ended", ended);
|
||||
v.counter["ended"] = 0;
|
||||
v.counter.ended = 0;
|
||||
document.body.appendChild(v);
|
||||
v.play();
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче