зеркало из https://github.com/mozilla/gecko-dev.git
69 строки
1.8 KiB
HTML
69 строки
1.8 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;
|
|
|
|
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");
|
|
|
|
function setMediaKeys() {
|
|
let p = new EMEPromise;
|
|
CreateMediaKeys(v1, test, case1token)
|
|
.then(mediaKeys => {
|
|
v1.setMediaKeys(mediaKeys)
|
|
.then(() => {
|
|
p.reject(`${case1token} setMediaKeys shouldn't succeed.`);
|
|
}, () => {
|
|
ok(true, TimeStamp(case1token) + " setMediaKeys failed as expected.");
|
|
p.resolve();
|
|
})
|
|
}, p.reject);
|
|
return p.promise;
|
|
}
|
|
|
|
var context = new AudioContext();
|
|
var node = context.createMediaElementSource(v1);
|
|
v1.addEventListener("loadeddata", function(ev) {
|
|
ok(false, TimeStamp(case1token) + " should never reach loadeddata, as setMediaKeys should fail");
|
|
});
|
|
|
|
manager.started(case1token);
|
|
|
|
Promise.all([
|
|
LoadTest(test, v1, case1token),
|
|
setMediaKeys()])
|
|
.catch(reason => ok(false, reason))
|
|
.then(() => {
|
|
CleanUpMedia(v1);
|
|
manager.finished(case1token);
|
|
});
|
|
}
|
|
|
|
function beginTest() {
|
|
manager.runTests(gEMETests, startTest);
|
|
}
|
|
|
|
if (!IsMacOSSnowLeopardOrEarlier()) {
|
|
SimpleTest.waitForExplicitFinish();
|
|
SetupEMEPref(beginTest);
|
|
} else {
|
|
todo(false, "Test disabled on this platform.");
|
|
}
|
|
</script>
|
|
</pre>
|
|
</body>
|
|
</html>
|