gecko-dev/dom/media/test/test_eme_obs_notification.html
Gerald Squelart 71b9547ba6 Bug 1121774 - Split audio and video tracks in EME MSE tests. r=edwin
--HG--
rename : dom/media/test/gizmo-frag-cenc.xml => dom/media/test/bipbop-frag-cenc.xml
rename : dom/media/test/test_eme_non_fragmented.html => dom/media/test/test_eme_non_mse_fails.html
2015-03-11 20:40:00 -04:00

82 lines
2.3 KiB
HTML

<!DOCTYPE HTML>
<html>
<head>
<title>Test Encrypted Media Extensions</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
<script type="text/javascript" src="manifest.js"></script>
<script type="text/javascript" src="eme.js"></script>
</head>
<body>
<pre id="test">
<script class="testbody" type="text/javascript">
var manager = new MediaTestManager;
var videos = new Set();
var observedVideos = new Set();
var observer = function(subject) {
ok(videos.has(subject), "Video should be known to us");
videos.delete(subject);
observedVideos.add(subject);
};
SpecialPowers.Services.obs.addObserver(observer, "media-eme-metadataloaded", false);
// When the test manager finishes, these sets should all be empty again:
manager.onFinished = function() {
is(videos.size, 0, "video set should be empty");
is(observedVideos.size, 0, "observed video set should be empty");
};
// ... but even if they're not, we should clear them out when we finish:
SimpleTest.registerCleanupFunction(function() {
SpecialPowers.Services.obs.removeObserver(observer, "media-eme-metadataloaded");
videos.clear();
observedVideos.clear();
});
function startTest(test, token)
{
manager.started(token);
var sessions = [];
var v = SetupEME(test, token);
videos.add(v);
v.preload = "auto"; // Required due to "canplay" not firing for MSE unless we do this.
v.addEventListener("loadeddata", function(ev) {
ok(observedVideos.has(ev.target), "Should have been told about eme video through observer as well.");
observedVideos.delete(ev.target);
manager.finished(token);
});
LoadTest(test, v, token);
}
function beginTest() {
manager.runTests(gEMETests, startTest);
}
var prefs = [
[ "media.mediasource.enabled", true ],
[ "media.mediasource.whitelist", false ],
[ "media.mediasource.mp4.enabled", true ],
];
if (/Linux/.test(navigator.userAgent) ||
!document.createElement('video').canPlayType("video/mp4")) {
// XXX remove once we have mp4 PlatformDecoderModules on all platforms.
prefs.push([ "media.fragmented-mp4.exposed", true ]);
prefs.push([ "media.fragmented-mp4.use-blank-decoder", true ]);
}
SimpleTest.waitForExplicitFinish();
SpecialPowers.pushPrefEnv({ "set" : prefs }, beginTest);
</script>
</pre>
</body>
</html>