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

Side by Side Diff: LayoutTests/media/encrypted-media/encrypted-media-needkey.html

Issue 134663005: Add new needkey event for EME. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix test Created 6 years, 11 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>NeedKey</title>
5 <script src=../video-test.js></script>
6 <script>
7 function stringToUint8Array(str)
8 {
9 var arr = [];
10 for(var i = 0,j = str.length; i < j; ++i)
11 arr[i] = str.charCodeAt(i);
12 return new Uint8Array(arr);
13 }
14
15 var mediaKeys;
16 var mediaKeySession;
17 var initData = stringToUint8Array('mock');
18 var expectedInitData = stringToUint8Array('0123456789012345');
19 var validKey = stringToUint8Array(
20 '{"keys":[{"kty":"oct","kid":"691i8WgU0nto7xIq/OSuPA","k":"MDEyM zQ1Njc4OTAxMjM0"}]}');
21 var expectedEvents = 2;
22
23 function runTest()
24 {
25 video = document.getElementsByTagName('video')[0];
26 run('video.src = "../content/test-encrypted.webm"');
27
28 // Will get 2 identical events, one for audio, one for video.
29 waitForEvent('needkey', needKey, false, false, video, false);
30 }
31
32 function needKey(event)
33 {
34 testExpected("event.target", video);
35 testExpected("event instanceof window.MediaKeyNeededEvent", true );
36 testExpected("event.type", "needkey");
37
38 // Following line commented out as contentType not currently set .
39 // testExpected("event.contentType", "video/webm");
40 testArraysEqual("event.initData", expectedInitData);
41
42 if (--expectedEvents == 0)
43 endTest();
44 }
45 </script>
46 </head>
47 <body onload="runTest()">
48 <p>This tests that the 'needkey' event is generated.</p>
49 <video></video>
50 </body>
51 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698