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

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

Issue 634243005: Improve reliability of EME tests (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Update comments Created 6 years, 2 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
« no previous file with comments | « LayoutTests/media/encrypted-media/encrypted-media-playback-setmediakeys-before-src.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 async_test(function(test) 13 async_test(function(test)
14 { 14 {
15 var video = document.getElementById('testVideo'); 15 var video = document.getElementById('testVideo');
16 var mediaKeySession = null; 16 var mediaKeySession = null;
17 var sessionCreated = false;
18 var sessionReadyReceived = false; 17 var sessionReadyReceived = false;
18 var encryptedEventCount = 0;
19 19
20 var keyId = null; 20 var keyId = null;
21 var rawKey = new Uint8Array([0xeb, 0xdd, 0x62, 0xf1, 0x68, 0x14, 0xd2, 0x7b, 21 var rawKey = new Uint8Array([0xeb, 0xdd, 0x62, 0xf1, 0x68, 0x14, 0xd2, 0x7b,
22 0x68, 0xef, 0x12, 0x2a, 0xfc, 0xe4, 0xae, 0x3c]); 22 0x68, 0xef, 0x12, 0x2a, 0xfc, 0xe4, 0xae, 0x3c]);
23 23
24 function onEncrypted(event) 24 function onEncrypted(event)
25 { 25 {
26 assert_equals(event.target, video); 26 assert_equals(event.target, video);
27 assert_true(event instanceof window.MediaEncryptedEvent); 27 assert_true(event instanceof window.MediaEncryptedEvent);
28 assert_equals(event.type, 'encrypted'); 28 assert_equals(event.type, 'encrypted');
29 29
30 // The same decryption key is shared by all streams so only 30 // The same decryption key is used by both the audio and
31 // create a shared session once. 31 // the video streams so only create a session once. To
32 if (sessionCreated) 32 // avoid issues when comparing the expected.txt file
33 // (which logs the events in the order they occur), create
34 // the session on the second event. This also ensures we
35 // see both events.
36 if (++encryptedEventCount != 2)
33 return; 37 return;
34 sessionCreated = true;
35 38
36 mediaKeySession = video.mediaKeys.createSession(); 39 mediaKeySession = video.mediaKeys.createSession();
37 waitForEventAndRunStep('message', mediaKeySession, onMessage , test); 40 waitForEventAndRunStep('message', mediaKeySession, onMessage , test);
38 mediaKeySession.generateRequest(event.initDataType, event.in itData).catch(function(error) { 41 mediaKeySession.generateRequest(event.initDataType, event.in itData).catch(function(error) {
39 forceTestFailureFromPromise(test, error); 42 forceTestFailureFromPromise(test, error);
40 }); 43 });
41 } 44 }
42 45
43 function onMessage(event) 46 function onMessage(event)
44 { 47 {
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 return video.setMediaKeys(mediaKeys); 98 return video.setMediaKeys(mediaKeys);
96 }).then(function(result) { 99 }).then(function(result) {
97 video.play(); 100 video.play();
98 }).catch(function(error) { 101 }).catch(function(error) {
99 forceTestFailureFromPromise(test, error); 102 forceTestFailureFromPromise(test, error);
100 }); 103 });
101 }, 'Waiting for a key.'); 104 }, 'Waiting for a key.');
102 </script> 105 </script>
103 </body> 106 </body>
104 </html> 107 </html>
OLDNEW
« no previous file with comments | « LayoutTests/media/encrypted-media/encrypted-media-playback-setmediakeys-before-src.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698