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

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 expectedInitData = stringToUint8Array('0123456789012345');
18 var validKey = stringToUint8Array(
19 '{"keys":[{"kty":"oct","kid":"691i8WgU0nto7xIq/OSuPA","k":"MDEyM zQ1Njc4OTAxMjM0"}]}');
20
21 // Will get 2 identical events, one for audio, one for video.
22 var expectedEvents = 2;
23
24 function runTest()
25 {
26 video = document.getElementsByTagName('video')[0];
27 run('video.src = "../content/test-encrypted.webm"');
28 waitForEvent('needkey', needKey, false, false, video, false);
29 }
30
31 function needKey(event)
32 {
33 testExpected("event.target", video);
34 testExpected("event instanceof window.MediaKeyNeededEvent", true );
35 testExpected("event.type", "needkey");
36
37 // FIXME: Enable the following line when contentType set.
38 // testExpected("event.contentType", "video/webm");
39 testArraysEqual("event.initData", expectedInitData);
40
41 if (--expectedEvents == 0)
42 endTest();
43 }
44 </script>
45 </head>
46 <body onload="runTest()">
47 <p>This tests that the 'needkey' event is generated.</p>
48 <video></video>
49 </body>
50 </html>
OLDNEW
« no previous file with comments | « LayoutTests/media/content/test-encrypted.webm ('k') | LayoutTests/media/encrypted-media/encrypted-media-needkey-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698