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

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: Add 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>
ddorwin 2014/01/13 19:08:38 We should start writing tests in a W3C test-compat
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=[];
acolwell GONE FROM CHROMIUM 2014/01/13 18:19:04 nit: Add spaces around '=' here and elsewhere
jrummell 2014/01/13 19:01:32 Done. This function (and most of the code) was cop
ddorwin 2014/01/13 19:08:38 add spaces to all of this
jrummell 2014/01/13 22:43:44 Done.
10 for(var i=0,j=str.length;i<j;++i)
acolwell GONE FROM CHROMIUM 2014/01/13 18:19:04 nit: add spaces around '<'
jrummell 2014/01/13 19:01:32 Done.
11 arr[i]=str.charCodeAt(i);
12 return new Uint8Array(arr);
13 }
14
15 var mediaKeys;
16 var mediaKeySession;
17 var initData = stringToUint8Array('mock');
ddorwin 2014/01/13 19:08:38 Why "mock"?
jrummell 2014/01/13 22:43:44 Clone from encrypted-media-v2-events.html. Now tha
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('mediaKeys = new MediaKeys("org.w3.clearkey")');
acolwell GONE FROM CHROMIUM 2014/01/13 18:19:04 nit: Why is this and the line below in a run()? Se
jrummell 2014/01/13 19:01:32 run() logs the statement and catches exceptions. I
acolwell GONE FROM CHROMIUM 2014/01/13 19:19:39 Ok. I'm not a fan of this style, but since it appe
27 run('mediaKeySession = mediaKeys.createSession("video/webm", ini tData)');
28 video.setMediaKeys(mediaKeys);
xhwang 2014/01/13 18:42:40 Based on the spec, we don't need a MediaKeys objec
jrummell 2014/01/13 19:01:32 Done.
29 video.src="../content/test-encrypted.webm";
ddorwin 2014/01/13 19:08:38 spaces
jrummell 2014/01/13 22:43:44 Done.
30
31 // Will get 2 identical events, one for audio, one for video.
ddorwin 2014/01/13 19:08:38 Would this comment be better above line 21?
jrummell 2014/01/13 22:43:44 Sure.
32 waitForEvent('needkey', needKey, false, false, video, false);
33 }
34
35 function needKey(event)
36 {
37 testExpected("event.target", video);
38 testExpected("event instanceof window.MediaKeyNeededEvent", true );
39 testExpected("event.type", "needkey");
40
41 // Following line commented out as contentType not currently set .
ddorwin 2014/01/13 19:08:38 FIXME: Enable the following line when...
jrummell 2014/01/13 22:43:44 Done.
42 // testExpected("event.contentType", "video/webm");
43 testArraysEqual("event.initData", expectedInitData);
44
45 if (--expectedEvents == 0)
46 endTest();
47 }
48 </script>
49 </head>
50 <body onload="runTest()">
51 <p>This tests that the 'needkey' event is generated.</p>
52 <video></video>
53 </body>
54 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698