1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
<!DOCTYPE HTML>
<html>
<head>
<title>Test Encrypted Media Extensions</title>
<script 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 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();
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);
});
}
SimpleTest.waitForExplicitFinish();
manager.runTests(gEMETests, startTest);
</script>
</pre>
</body>
</html>
|