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
|
function runTest(config,qualifier) {
// After creation, the MediaKeySession object is not
// callable, and we should get a InvalidStateError.
promise_test(function()
{
return navigator.requestMediaKeySystemAccess(config.keysystem, 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');
});
});
}, testnamePrefix( qualifier, config.keysystem ) + ', temporary, update() immediately after createSession()');
promise_test(function()
{
return navigator.requestMediaKeySystemAccess(config.keysystem, 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');
});
});
}, testnamePrefix( qualifier, config.keysystem ) + ', temporary, close() immediately after createSession()');
promise_test(function()
{
return navigator.requestMediaKeySystemAccess(config.keysystem, 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');
});
});
}, testnamePrefix( qualifier, config.keysystem ) + ', temporary, remove() immediately after createSession()');
}
|