mirror of
https://github.com/servo/servo.git
synced 2025-07-12 18:03:49 +01:00
41 lines
1.6 KiB
HTML
41 lines
1.6 KiB
HTML
<!DOCTYPE html>
|
|
<!-- Copyright © 2016 Chromium authors and World Wide Web Consortium, (Massachusetts Institute of Technology, ERCIM, Keio University, Beihang). -->
|
|
<html>
|
|
<head>
|
|
<title>onencrypted</title>
|
|
<script src="encrypted-media-utils.js"></script>
|
|
<script src="/resources/testharness.js"></script>
|
|
<script src="/resources/testharnessreport.js"></script>
|
|
</head>
|
|
<body>
|
|
<video id="testVideo" controls></video>
|
|
<div id="log"></div>
|
|
<script>
|
|
var expectedInitData = stringToUint8Array('0123456789012345');
|
|
|
|
// Will get 2 identical events, one for audio, one for video.
|
|
var expectedEvents = 2;
|
|
|
|
async_test(function(test)
|
|
{
|
|
var video = document.getElementById('testVideo');
|
|
var content = 'webm/test-encrypted.webm';
|
|
|
|
var onEncrypted = function(event)
|
|
{
|
|
assert_equals(event.target, video);
|
|
assert_true(event instanceof window.MediaEncryptedEvent);
|
|
assert_equals(event.type, 'encrypted');
|
|
assert_equals(event.initDataType, 'webm');
|
|
assert_array_equals(new Uint8Array(event.initData), expectedInitData);
|
|
|
|
if (--expectedEvents == 0)
|
|
test.done();
|
|
};
|
|
|
|
waitForEventAndRunStep('encrypted', video, onEncrypted, test);
|
|
video.src = content;
|
|
}, 'encrypted fired on encrypted media file.');
|
|
</script>
|
|
</body>
|
|
</html>
|