2015-03-03 01:02:36 +03:00
|
|
|
<!DOCTYPE HTML>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<title>Bug 1131392 - Test that EME does not work for non-MSE media</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;
|
|
|
|
|
2015-10-05 05:03:58 +03:00
|
|
|
function DoSetMediaKeys(v, test)
|
2015-03-03 01:02:36 +03:00
|
|
|
{
|
|
|
|
var options = [{
|
2015-10-27 04:10:51 +03:00
|
|
|
initDataTypes: ["cenc"],
|
|
|
|
audioCapabilities: [{contentType: test.audioType}],
|
|
|
|
videoCapabilities: [{contentType: test.videoType}],
|
2015-03-03 01:02:36 +03:00
|
|
|
}];
|
|
|
|
|
2016-07-11 07:46:21 +03:00
|
|
|
return navigator.requestMediaKeySystemAccess(CLEARKEY_KEYSYSTEM, options)
|
2015-03-03 01:02:36 +03:00
|
|
|
|
|
|
|
.then(function(keySystemAccess) {
|
|
|
|
return keySystemAccess.createMediaKeys();
|
|
|
|
})
|
|
|
|
|
|
|
|
.catch(function() {
|
|
|
|
ok(false, token + " was not expecting failure (yet)");
|
|
|
|
})
|
|
|
|
|
|
|
|
.then(function(mediaKeys) {
|
|
|
|
return v.setMediaKeys(mediaKeys);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
function TestSetMediaKeys(test, token)
|
|
|
|
{
|
|
|
|
manager.started(token);
|
|
|
|
|
|
|
|
var v = document.createElement("video");
|
|
|
|
|
|
|
|
v.addEventListener("encrypted", function() {
|
2015-03-23 05:31:15 +03:00
|
|
|
ok(false, token + " should not fire encrypted event");
|
|
|
|
});
|
|
|
|
|
|
|
|
var loadedMetadata = false;
|
|
|
|
v.addEventListener("loadedmetadata", function() {
|
|
|
|
loadedMetadata = true;
|
|
|
|
});
|
2015-03-03 01:02:36 +03:00
|
|
|
|
2015-03-23 05:31:15 +03:00
|
|
|
v.addEventListener("error", function() {
|
|
|
|
ok(true, token + " expected error event");
|
|
|
|
ok(loadedMetadata, token + " expected loadedmetadata to have fired");
|
|
|
|
manager.finished(token);
|
2015-03-03 01:02:36 +03:00
|
|
|
});
|
|
|
|
|
|
|
|
v.src = test.name;
|
|
|
|
}
|
|
|
|
|
|
|
|
function TestSetSrc(test, token)
|
|
|
|
{
|
|
|
|
manager.started(token);
|
|
|
|
|
|
|
|
var v = document.createElement("video");
|
|
|
|
v.addEventListener("error", function(err) {
|
|
|
|
ok(true, token + " got error setting src on video element, as expected");
|
|
|
|
manager.finished(token);
|
|
|
|
});
|
|
|
|
|
2015-10-05 05:03:58 +03:00
|
|
|
DoSetMediaKeys(v, test)
|
2015-03-03 01:02:36 +03:00
|
|
|
|
|
|
|
.then(function() {
|
|
|
|
v.src = test.name;
|
|
|
|
})
|
|
|
|
|
|
|
|
.catch(function() {
|
|
|
|
ok(false, token + " got error setting media keys");
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
function startTest(test, token)
|
|
|
|
{
|
|
|
|
TestSetMediaKeys(test, token + "_setMediaKeys");
|
|
|
|
TestSetSrc(test, token + "_setSrc");
|
|
|
|
}
|
|
|
|
|
|
|
|
function beginTest() {
|
2015-03-12 03:40:00 +03:00
|
|
|
manager.runTests(gEMENonMSEFailTests, startTest);
|
2015-03-03 01:02:36 +03:00
|
|
|
}
|
|
|
|
|
2015-07-21 07:44:03 +03:00
|
|
|
if (!IsMacOSSnowLeopardOrEarlier()) {
|
|
|
|
SimpleTest.waitForExplicitFinish();
|
|
|
|
SetupEMEPref(beginTest);
|
|
|
|
} else {
|
|
|
|
todo(false, "Test disabled on this platform.");
|
|
|
|
}
|
2015-03-03 01:02:36 +03:00
|
|
|
</script>
|
|
|
|
</pre>
|
|
|
|
</body>
|
|
|
|
</html>
|
|
|
|
|