<!DOCTYPE html>
<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></video>
<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.querySelector('video');
var content = '../content/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>