mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-13 18:27:35 +00:00
Bug 1318982 - Enable dormant for most media mochitests. r=jya
MozReview-Commit-ID: 7AXEhCmFUeR --HG-- extra : rebase_source : fa42b09dda75c3385edc6f7decc240816195722b extra : intermediate-source : 3376be75b913bbc3bd0920828f9e756982e9cac3 extra : source : ffee549ec036bc3ec1b9b1bccb26314c5adb5096
This commit is contained in:
parent
5d2a9d651a
commit
a8b746d049
@ -1,5 +1,14 @@
|
||||
// Helpers for Media Source Extensions tests
|
||||
|
||||
var gMSETestPrefs = [
|
||||
[ "media.mediasource.enabled", true ]
|
||||
];
|
||||
|
||||
// Called before runWithMSE() to set the prefs before running MSE tests.
|
||||
function addMSEPrefs(...prefs) {
|
||||
gMSETestPrefs = gMSETestPrefs.concat(prefs);
|
||||
}
|
||||
|
||||
function runWithMSE(testFunction) {
|
||||
function bootstrapTest() {
|
||||
var ms = new MediaSource();
|
||||
@ -17,10 +26,7 @@ function runWithMSE(testFunction) {
|
||||
}
|
||||
|
||||
addLoadEvent(function () {
|
||||
SpecialPowers.pushPrefEnv({"set": [
|
||||
[ "media.mediasource.enabled", true ],
|
||||
]},
|
||||
bootstrapTest);
|
||||
SpecialPowers.pushPrefEnv({"set": gMSETestPrefs}, bootstrapTest);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -31,46 +31,46 @@ function fillUpSourceBuffer(sourceBuffer, doAppendDataFunc, onCaughtExceptionCal
|
||||
});
|
||||
}
|
||||
|
||||
addMSEPrefs(
|
||||
["media.mediasource.eviction_threshold.audio", 524288],
|
||||
["media.dormant-on-pause-timeout-ms", -1] // FIXME: bug 1319292
|
||||
);
|
||||
|
||||
runWithMSE(function(ms, el) {
|
||||
el.controls = true;
|
||||
once(ms, 'sourceopen').then(function() {
|
||||
ok(true, "Receive a sourceopen event");
|
||||
SpecialPowers.pushPrefEnv({
|
||||
"set": [
|
||||
["media.mediasource.eviction_threshold.audio", 524288],
|
||||
]
|
||||
}, function() {
|
||||
let audiosb = ms.addSourceBuffer("audio/mp4");
|
||||
audiosb.mode = "sequence";
|
||||
fetchAndLoad(audiosb, 'bipbop/bipbop_audio', ['init'], '.mp4')
|
||||
.then(function() {
|
||||
fetchWithXHR('bipbop/bipbop_audio1.m4s', function(audioBuffer) {
|
||||
fillUpSourceBuffer(audiosb,
|
||||
function() { // doAppendDataFunc
|
||||
audiosb.appendBuffer(audioBuffer);
|
||||
},
|
||||
function(ex) { // onCaughtExceptionCallback
|
||||
is(ex.name, 'QuotaExceededError', "QuotaExceededError thrown");
|
||||
is(audiosb.buffered.end(0), el.duration, "Duration is end of buffered range");
|
||||
let seekTime = audiosb.buffered.end(0) / 2;
|
||||
el.currentTime = seekTime;
|
||||
once(el, 'seeked', () => {
|
||||
is(el.currentTime, seekTime, "correctly seeked to " + seekTime);
|
||||
try {
|
||||
audiosb.appendBuffer(audioBuffer);
|
||||
} catch(ex) {
|
||||
ok(false, "Shouldn't throw another time when data can be evicted");
|
||||
el.mozDumpDebugInfo();
|
||||
SimpleTest.finish();
|
||||
return;
|
||||
}
|
||||
once(audiosb, 'update', () => {
|
||||
ok(true, "appendBuffer succeeded");
|
||||
SimpleTest.finish();
|
||||
});
|
||||
let audiosb = ms.addSourceBuffer("audio/mp4");
|
||||
audiosb.mode = "sequence";
|
||||
fetchAndLoad(audiosb, 'bipbop/bipbop_audio', ['init'], '.mp4')
|
||||
.then(function() {
|
||||
fetchWithXHR('bipbop/bipbop_audio1.m4s', function(audioBuffer) {
|
||||
fillUpSourceBuffer(audiosb,
|
||||
function() { // doAppendDataFunc
|
||||
audiosb.appendBuffer(audioBuffer);
|
||||
},
|
||||
function(ex) { // onCaughtExceptionCallback
|
||||
is(ex.name, 'QuotaExceededError', "QuotaExceededError thrown");
|
||||
is(audiosb.buffered.end(0), el.duration, "Duration is end of buffered range");
|
||||
let seekTime = audiosb.buffered.end(0) / 2;
|
||||
el.currentTime = seekTime;
|
||||
once(el, 'seeked', () => {
|
||||
dump("dump: seeked to " + seekTime);
|
||||
is(el.currentTime, seekTime, "correctly seeked to " + seekTime);
|
||||
try {
|
||||
audiosb.appendBuffer(audioBuffer);
|
||||
} catch(ex) {
|
||||
ok(false, "Shouldn't throw another time when data can be evicted");
|
||||
el.mozDumpDebugInfo();
|
||||
SimpleTest.finish();
|
||||
return;
|
||||
}
|
||||
once(audiosb, 'update', () => {
|
||||
ok(true, "appendBuffer succeeded");
|
||||
SimpleTest.finish();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -21,6 +21,9 @@ SimpleTest.waitForExplicitFinish();
|
||||
// 6. Add 1.6s of data once video element fired waiting, that canplay is fired once readyState is HAVE_FUTURE_DATA.
|
||||
// 7. Finally load data to the end and ensure that canplaythrough is fired and that readyState is now HAVE_ENOUGH_DATA
|
||||
|
||||
// FIXME: bug 1319293
|
||||
addMSEPrefs(["media.dormant-on-pause-timeout-ms", -1]);
|
||||
|
||||
runWithMSE(function(ms, el) {
|
||||
el.controls = true;
|
||||
once(ms, 'sourceopen').then(function() {
|
||||
|
@ -11,6 +11,9 @@
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
// FIXME: bug 1319295
|
||||
addMSEPrefs(["media.dormant-on-pause-timeout-ms", -1]);
|
||||
|
||||
var receivedSourceOpen = false;
|
||||
runWithMSE(function(ms, v) {
|
||||
ms.addEventListener("sourceopen", function() {
|
||||
|
@ -44,7 +44,7 @@ user_pref("media.preload.auto", 3); // auto = enough
|
||||
user_pref("media.cache_size", 1000);
|
||||
user_pref("media.volume_scale", "0.01");
|
||||
user_pref("media.test.dumpDebugInfo", true);
|
||||
user_pref("media.dormant-on-pause-timeout-ms", -1); // Disable dormant for it breaks some tests.
|
||||
user_pref("media.dormant-on-pause-timeout-ms", 0); // Enter dormant immediately without waiting for timeout.
|
||||
user_pref("security.warn_viewing_mixed", false);
|
||||
user_pref("app.update.enabled", false);
|
||||
user_pref("app.update.staging.enabled", false);
|
||||
|
Loading…
Reference in New Issue
Block a user