4 <title>onencrypted
</title>
5 <script src=
"encrypted-media-utils.js"></script>
6 <script src=
"../../resources/testharness.js"></script>
7 <script src=
"../../resources/testharnessreport.js"></script>
10 <video id=
"testVideo" controls
></video>
13 var expectedInitData
= stringToUint8Array('0123456789012345');
15 // Will get 2 identical events, one for audio, one for video.
16 var expectedEvents
= 2;
18 async_test(function(test
)
20 var video
= document
.getElementById('testVideo');
22 var onEncrypted = function(event
)
24 assert_equals(event
.target
, video
);
25 assert_true(event
instanceof window
.MediaEncryptedEvent
);
26 assert_equals(event
.type
, 'encrypted');
27 assert_equals(event
.initDataType
, 'webm');
28 assert_array_equals(new Uint8Array(event
.initData
), expectedInitData
);
30 if (--expectedEvents
== 0)
34 waitForEventAndRunStep('encrypted', video
, onEncrypted
, test
);
35 video
.src
= '../content/test-encrypted.webm';
36 }, 'encrypted fired on encrypted media file.');