Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(244)

Side by Side Diff: third_party/WebKit/LayoutTests/media/encrypted-media/encrypted-media-session-remove-temporary.html

Issue 2831963003: EME: Allow temporary sessions to be removed for ClearKey only. (Closed)
Patch Set: rebase Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <title>Test MediaKeySession remove() function on temporary sessions</tit le>
5 <script src="encrypted-media-utils.js"></script>
6 <script src="../../resources/testharness.js"></script>
7 <script src="../../resources/testharnessreport.js"></script>
8 </head>
9 <body>
10 <script>
11 promise_test(function(test)
12 {
13 var keyId = stringToUint8Array('0123456789012345');
14 var rawKey = new Uint8Array([0xeb, 0xdd, 0x62, 0xf1, 0x68, 0x14, 0xd2, 0x7b,
15 0x68, 0xef, 0x12, 0x2a, 0xfc, 0xe4, 0xae, 0x3c]);
16
17 var mediaKeySession;
18 var waitForMessagePromise;
19
20 return navigator.requestMediaKeySystemAccess('org.w3.clearkey', getSimpleConfigurationForInitDataType('keyids')).then(function(access) {
21 return access.createMediaKeys();
22 }).then(function(mediaKeys) {
23 mediaKeySession = mediaKeys.createSession();
24 waitForMessagePromise = waitForSingleEvent(mediaKeySession, 'message', function(e, resolve, reject) {
25 resolve();
26 });
27 const request = stringToUint8Array(createKeyIDs(keyId));
28 return mediaKeySession.generateRequest('keyids', request);
29 }).then(function() {
30 return waitForMessagePromise;
31 }).then(function() {
32 const jwkSet = stringToUint8Array(createJWKSet(createJWK(key Id, rawKey)));
33 return mediaKeySession.update(jwkSet);
34 }).then(function() {
35 // After update() the session should have 1 usable key.
36 verifyKeyStatuses(mediaKeySession.keyStatuses,
37 { expected: [keyId], unexpected: [] }, 'usable');
38 return mediaKeySession.remove();
39 }).then(function() {
40 // After remove() all keys should be 'released'.
41 verifyKeyStatuses(mediaKeySession.keyStatuses,
42 { expected: [keyId], unexpected: [] }, 'released');
43 // After remove() the session expiry should be NaN.
44 // ClearKey doesn't change set expiry times, but check
45 // anyway.
46 assert_true(isNaN(mediaKeySession.expiration));
47 return mediaKeySession.close();
48 }).then(function() {
49 // After close() there should be no keys.
50 verifyKeyStatuses(mediaKeySession.keyStatuses,
51 { expected: [], unexpected: [keyId] });
52 });
53
54 }, 'Test MediaKeySession remove() function on temporary sessions');
55 </script>
56 </body>
57 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698