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

Side by Side Diff: third_party/WebKit/LayoutTests/media/encrypted-media/encrypted-media-waiting-for-a-key.html

Issue 2084053002: EME: Update tests so 'audioCapabilities' always provided (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: changes (+rebase) Created 4 years, 5 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
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <html>
3 <head> 3 <head>
4 <title>Waiting for a key.</title> 4 <title>Waiting for a key.</title>
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 <video id="testVideo"></video> 10 <video id="testVideo"></video>
11 <div id="log"></div> 11 <div id="log"></div>
12 <script> 12 <script>
13 // For debugging timeouts, keep track of the number of the 13 // For debugging timeouts, keep track of the number of the
14 // various events received. 14 // various events received.
15 var debugEncryptedEventCount = 0; 15 var debugEncryptedEventCount = 0;
16 var debugWaitingForKeyEventCount = 0; 16 var debugWaitingForKeyEventCount = 0;
17 var debugTimeUpdateEventCount = 0; 17 var debugTimeUpdateEventCount = 0;
18 var debugMessage = ''; 18 var debugMessage = '';
19 19
20 promise_test(function(test) 20 promise_test(function(test)
21 { 21 {
22 var video = document.getElementById('testVideo'); 22 var video = document.getElementById('testVideo');
23 var content = '../content/test-encrypted.webm';
23 var initData; 24 var initData;
24 var initDataType; 25 var initDataType;
25 var mediaKeySession; 26 var mediaKeySession;
26 27
27 test.timeout = function() 28 test.timeout = function()
28 { 29 {
29 var message = 'timeout. message = ' + debugMessage 30 var message = 'timeout. message = ' + debugMessage
30 + ', encrypted: ' + debugEncryptedEventCount 31 + ', encrypted: ' + debugEncryptedEventCount
31 + ', waitingforkey: ' + debugWaitingForKeyEve ntCount 32 + ', waitingforkey: ' + debugWaitingForKeyEve ntCount
32 + ', timeupdate: ' + debugTimeUpdateEventCoun t; 33 + ', timeupdate: ' + debugTimeUpdateEventCoun t;
33 test.force_timeout(); 34 test.force_timeout();
34 test.timeout_id = null; 35 test.timeout_id = null;
35 test.set_status(2, message); 36 test.set_status(2, message);
36 test.done(); 37 test.done();
37 }; 38 };
38 39
39 // As this code doesn't wait for the 'message' event to avoid 40 // As this code doesn't wait for the 'message' event to avoid
40 // race conditions with 'waitingforkey', specify the key ID and 41 // race conditions with 'waitingforkey', specify the key ID and
41 // key used by the encrypted content. 42 // key used by the encrypted content.
42 var keyId = stringToUint8Array('0123456789012345'); 43 var keyId = stringToUint8Array('0123456789012345');
43 var rawKey = new Uint8Array([0xeb, 0xdd, 0x62, 0xf1, 0x68, 0x14, 0xd2, 0x7b, 44 var rawKey = new Uint8Array([0xeb, 0xdd, 0x62, 0xf1, 0x68, 0x14, 0xd2, 0x7b,
44 0x68, 0xef, 0x12, 0x2a, 0xfc, 0xe4, 0xae, 0x3c]); 45 0x68, 0xef, 0x12, 0x2a, 0xfc, 0xe4, 0xae, 0x3c]);
45 46
46 return navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{}]).then(function(access) { 47 return navigator.requestMediaKeySystemAccess('org.w3.clearkey', getConfigurationForFile(content)).then(function(access) {
47 debugMessage = 'createMediaKeys()'; 48 debugMessage = 'createMediaKeys()';
48 return access.createMediaKeys(); 49 return access.createMediaKeys();
49 }).then(function(mediaKeys) { 50 }).then(function(mediaKeys) {
50 debugMessage = 'setMediaKeys()'; 51 debugMessage = 'setMediaKeys()';
51 return video.setMediaKeys(mediaKeys); 52 return video.setMediaKeys(mediaKeys);
52 }).then(function() { 53 }).then(function() {
53 video.src = '../content/test-encrypted.webm'; 54 video.src = content;
54 video.play(); 55 video.play();
55 debugMessage = 'wait_for_encrypted_event()'; 56 debugMessage = 'wait_for_encrypted_event()';
56 return wait_for_encrypted_event(video); 57 return wait_for_encrypted_event(video);
57 }).then(function(e) { 58 }).then(function(e) {
58 // Received the 'encrypted' event(s), so keep a copy of 59 // Received the 'encrypted' event(s), so keep a copy of
59 // the initdata for use when creating the session later. 60 // the initdata for use when creating the session later.
60 initData = e.initData; 61 initData = e.initData;
61 initDataType = e.initDataType; 62 initDataType = e.initDataType;
62 63
63 // Wait until the video indicates that it needs a key to 64 // Wait until the video indicates that it needs a key to
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 if (video.currentTime < 0.2) 155 if (video.currentTime < 0.2)
155 return; 156 return;
156 video.removeEventListener('timeupdate', listener); 157 video.removeEventListener('timeupdate', listener);
157 resolve(e); 158 resolve(e);
158 }); 159 });
159 }); 160 });
160 }; 161 };
161 </script> 162 </script>
162 </body> 163 </body>
163 </html> 164 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698