OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <title>Test MediaKeySession remove() function on temporary sessions</tit
le> | 4 <title>Test MediaKeySession remove() function on temporary sessions</tit
le> |
5 <script src="encrypted-media-utils.js"></script> | 5 <script src="encrypted-media-utils.js"></script> |
6 <script src="../../resources/testharness.js"></script> | 6 <script src="../../resources/testharness.js"></script> |
7 <script src="../../resources/testharnessreport.js"></script> | 7 <script src="../../resources/testharnessreport.js"></script> |
8 </head> | 8 </head> |
9 <body> | 9 <body> |
10 <script> | 10 <script> |
(...skipping 16 matching lines...) Expand all Loading... |
27 const request = stringToUint8Array(createKeyIDs(keyId)); | 27 const request = stringToUint8Array(createKeyIDs(keyId)); |
28 return mediaKeySession.generateRequest('keyids', request); | 28 return mediaKeySession.generateRequest('keyids', request); |
29 }).then(function() { | 29 }).then(function() { |
30 return waitForMessagePromise; | 30 return waitForMessagePromise; |
31 }).then(function() { | 31 }).then(function() { |
32 const jwkSet = stringToUint8Array(createJWKSet(createJWK(key
Id, rawKey))); | 32 const jwkSet = stringToUint8Array(createJWKSet(createJWK(key
Id, rawKey))); |
33 return mediaKeySession.update(jwkSet); | 33 return mediaKeySession.update(jwkSet); |
34 }).then(function() { | 34 }).then(function() { |
35 // After update() the session should have 1 usable key. | 35 // After update() the session should have 1 usable key. |
36 verifyKeyStatuses(mediaKeySession.keyStatuses, | 36 verifyKeyStatuses(mediaKeySession.keyStatuses, |
37 { expected: [keyId], unexpected: [] }, 'usable'); | 37 [ { keyId: keyId, status: 'usable' } ]); |
38 return mediaKeySession.remove(); | 38 return mediaKeySession.remove(); |
39 }).then(function() { | 39 }).then(function() { |
40 // After remove() all keys should be 'released'. | 40 // After remove() all keys should be 'released'. |
41 verifyKeyStatuses(mediaKeySession.keyStatuses, | 41 verifyKeyStatuses(mediaKeySession.keyStatuses, |
42 { expected: [keyId], unexpected: [] }, 'released'); | 42 [ { keyId: keyId, status: 'released' } ]); |
43 // After remove() the session expiry should be NaN. | 43 // After remove() the session expiry should be NaN. |
44 // ClearKey doesn't change set expiry times, but check | 44 // ClearKey doesn't change set expiry times, but check |
45 // anyway. | 45 // anyway. |
46 assert_true(isNaN(mediaKeySession.expiration)); | 46 assert_true(isNaN(mediaKeySession.expiration)); |
47 return mediaKeySession.close(); | 47 return mediaKeySession.close(); |
48 }).then(function() { | 48 }).then(function() { |
49 // After close() there should be no keys. | 49 // After close() there should be no keys. |
50 verifyKeyStatuses(mediaKeySession.keyStatuses, | 50 verifyKeyStatuses(mediaKeySession.keyStatuses, []); |
51 { expected: [], unexpected: [keyId] }); | |
52 }); | 51 }); |
53 | 52 |
54 }, 'Test MediaKeySession remove() function on temporary sessions'); | 53 }, 'Test MediaKeySession remove() function on temporary sessions'); |
55 </script> | 54 </script> |
56 </body> | 55 </body> |
57 </html> | 56 </html> |
OLD | NEW |