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
60
61
62
63
64
65
66
67
|
<!DOCTYPE html>
<!-- Copyright © 2016 Chromium authors and World Wide Web Consortium, (Massachusetts Institute of Technology, ERCIM, Keio University, Beihang). -->
<html>
<head>
<title>Test MediaKeySession not callable immediately after CreateSession().</title>
<script src="encrypted-media-utils.js"></script>
<!--
Test has been migrated to the root directory and is being disabled here.
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
-->
</head>
<body>
<div id="log"></div>
<script>
// After creation, the MediaKeySession object is not
// callable, and we should get a InvalidStateError.
promise_test(function()
{
return navigator.requestMediaKeySystemAccess('org.w3.clearkey', getSimpleConfiguration()).then(function(access) {
return access.createMediaKeys();
}).then(function(mediaKeys) {
var mediaKeySession = mediaKeys.createSession();
var arbitraryResponse = new Uint8Array([0x00, 0x11]);
return mediaKeySession.update(arbitraryResponse).then(function(result) {
assert_unreached('update() succeeded unexpectedly.');
}).catch(function(error) {
assert_equals(error.name, 'InvalidStateError');
});
});
}, 'Update() immediately after CreateSession().');
promise_test(function()
{
return navigator.requestMediaKeySystemAccess('org.w3.clearkey', getSimpleConfiguration()).then(function(access) {
return access.createMediaKeys();
}).then(function(mediaKeys) {
var mediaKeySession = mediaKeys.createSession();
return mediaKeySession.close().then(function(result) {
assert_unreached('close() succeeded unexpectedly.');
}).catch(function(error) {
assert_equals(error.name, 'InvalidStateError');
});
});
}, 'Close() immediately after CreateSession().');
promise_test(function()
{
return navigator.requestMediaKeySystemAccess('org.w3.clearkey', getSimpleConfiguration()).then(function(access) {
return access.createMediaKeys();
}).then(function(mediaKeys) {
var mediaKeySession = mediaKeys.createSession();
return mediaKeySession.remove().then(function(result) {
assert_unreached('remove() succeeded unexpectedly.');
}).catch(function(error) {
assert_equals(error.name, 'InvalidStateError');
});
});
}, 'Remove() immediately after CreateSession().');
</script>
</body>
</html>
|