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

Side by Side Diff: LayoutTests/media/encrypted-media/encrypted-media-lifetime-reload.html

Issue 655603003: Reland: Remove "needkey" event and add its replacement, "encrypted". (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 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 | « no previous file | LayoutTests/media/encrypted-media/encrypted-media-lifetime-reload-expected.txt » ('j') | 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>Reloading during encrypted media playback</title> 4 <title>Reloading during encrypted media playback</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 <p>Test reloading during encrypted media playback.</p> 12 <p>Test reloading during encrypted media playback.</p>
13 <script> 13 <script>
14 async_test(function(test) 14 async_test(function(test)
15 { 15 {
16 var video = document.getElementById('testVideo'); 16 var video = document.getElementById('testVideo');
17 var mediaKeySession = null; 17 var mediaKeySession = null;
18 var isSessionCreated = false; 18 var isSessionCreated = false;
19 var sessionReadyReceived = false; 19 var sessionReadyReceived = false;
20 20
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 onNeedKey(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.MediaKeyNeededEvent); 27 assert_true(event instanceof window.MediaEncryptedEvent);
28 assert_equals(event.type, 'needkey'); 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 shared by all streams so only
31 // create a shared session once. 31 // create a shared session once.
32 if (isSessionCreated) 32 if (isSessionCreated)
33 return; 33 return;
34 isSessionCreated = true; 34 isSessionCreated = true;
35 35
36 mediaKeySession = video.mediaKeys.createSession(); 36 mediaKeySession = video.mediaKeys.createSession();
37 waitForEventAndRunStep('message', mediaKeySession, onMessage , test); 37 waitForEventAndRunStep('message', mediaKeySession, onMessage , test);
38 mediaKeySession.generateRequest(event.contentType, event.ini tData).catch(function(error) { 38 mediaKeySession.generateRequest(event.initDataType, event.in itData).catch(function(error) {
39 forceTestFailureFromPromise(test, error); 39 forceTestFailureFromPromise(test, error);
40 }); 40 });
41 } 41 }
42 42
43 function onMessage(event) 43 function onMessage(event)
44 { 44 {
45 assert_true(event instanceof window.MediaKeyMessageEvent); 45 assert_true(event instanceof window.MediaKeyMessageEvent);
46 assert_equals(event.target, mediaKeySession); 46 assert_equals(event.target, mediaKeySession);
47 assert_equals(event.type, 'message'); 47 assert_equals(event.type, 'message');
48 48
(...skipping 22 matching lines...) Expand all
71 if (location.hash == '#x') { 71 if (location.hash == '#x') {
72 test.done(); 72 test.done();
73 return; 73 return;
74 } 74 }
75 75
76 location.hash += 'x'; 76 location.hash += 'x';
77 location.reload(); 77 location.reload();
78 } 78 }
79 79
80 MediaKeys.create('org.w3.clearkey').then(function(mediaKeys) { 80 MediaKeys.create('org.w3.clearkey').then(function(mediaKeys) {
81 waitForEventAndRunStep('needkey', video, onNeedKey, test); 81 waitForEventAndRunStep('encrypted', video, onEncrypted, test );
82 waitForEventAndRunStep('playing', video, onPlaying, test); 82 waitForEventAndRunStep('playing', video, onPlaying, test);
83 video.src = '../content/test-encrypted.webm'; 83 video.src = '../content/test-encrypted.webm';
84 return video.setMediaKeys(mediaKeys); 84 return video.setMediaKeys(mediaKeys);
85 }).then(function(result) { 85 }).then(function(result) {
86 video.play(); 86 video.play();
87 }).catch(function(error) { 87 }).catch(function(error) {
88 forceTestFailureFromPromise(test, error); 88 forceTestFailureFromPromise(test, error);
89 }); 89 });
90 }, 'Reloading during encrypted media playback.'); 90 }, 'Reloading during encrypted media playback.');
91 </script> 91 </script>
92 </body> 92 </body>
93 </html> 93 </html>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/media/encrypted-media/encrypted-media-lifetime-reload-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698